Remove some deprecated del calls
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 7 Mar 2023 02:51:55 +0000 (15:51 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 7 Mar 2023 02:55:19 +0000 (15:55 +1300)
CRM/Admin/Form/ContactType.php
CRM/Contact/BAO/ContactType.php
CRM/Core/Form/RecurringEntity.php
CRM/Extension/Manager/Report.php
CRM/Extension/Manager/Search.php
CRM/Report/BAO/ReportInstance.php
CRM/Report/Form/Register.php
api/v3/ActivityType.php

index 20bedf59c5ccdb7034aeb893922449a3bffb318e..77b92cb89a5510ba84644c05b14b0f61313b65a5 100644 (file)
@@ -117,11 +117,11 @@ class CRM_Admin_Form_ContactType extends CRM_Admin_Form {
     CRM_Utils_System::flushCache();
 
     if ($this->_action & CRM_Core_Action::DELETE) {
-      $isDelete = CRM_Contact_BAO_ContactType::del($this->_id);
-      if ($isDelete) {
+      try {
+        CRM_Contact_BAO_ContactType::deleteRecord(['id' => $this->_id]);
         CRM_Core_Session::setStatus(ts('Selected contact type has been deleted.'), ts('Record Deleted'), 'success');
       }
-      else {
+      catch (CRM_Core_Exception $e) {
         CRM_Core_Session::setStatus(ts("Selected contact type can not be deleted. Make sure contact type doesn't have any associated custom data or group."), ts('Sorry'), 'error');
       }
       return;
index d02752fe9d353111ee316c31accde0464ee21f42..05f9177e4c2ed60805099804c628c94710c66d9e 100644 (file)
@@ -459,6 +459,7 @@ WHERE  subtype.name IN ('" . implode("','", $subType) . "' )";
    * @return bool
    */
   public static function del($contactTypeId) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     if (!$contactTypeId) {
       return FALSE;
     }
index 05435a6aa857a1639384775d32019832f13c4094..04d4a5e5ca2914a90f9c975776b7c6c5ee82b6f1 100644 (file)
@@ -364,7 +364,7 @@ class CRM_Core_Form_RecurringEntity {
             'name'
           );
           if ($optionGroupIdExists) {
-            CRM_Core_BAO_OptionGroup::del($optionGroupIdExists);
+            CRM_Core_BAO_OptionGroup::deleteRecord(['id' => $optionGroupIdExists]);
           }
           $optionGroupParams = [
             'name' => $type . '_repeat_exclude_dates_' . $actionScheduleObj->entity_value,
index 06160d34fb3360911b1ac2f0f8ae64f5620ce38c..45f1adae1c60e99fb173055bdbdb93a4ba39a41a 100644 (file)
@@ -79,7 +79,7 @@ class CRM_Extension_Manager_Report extends CRM_Extension_Manager_Base {
     $customReports = $this->getCustomReportsByName();
     $cr = $this->getCustomReportsById();
     $id = $cr[$customReports[$info->key]];
-    $optionValue = CRM_Core_BAO_OptionValue::del($id);
+    $optionValue = CRM_Core_BAO_OptionValue::deleteRecord(['id' => $id]);
 
     return $optionValue ? TRUE : FALSE;
   }
index 2f3910896c32c1b8292ab87fb118c55e28cffbac..c251555bcaecc25f6b4ff68d2b68b6c76dbd29cf 100644 (file)
@@ -77,7 +77,7 @@ class CRM_Extension_Manager_Search extends CRM_Extension_Manager_Base {
 
     $cs = $this->getCustomSearchesById();
     $id = $cs[$customSearchesByName[$info->key]];
-    CRM_Core_BAO_OptionValue::del($id);
+    CRM_Core_BAO_OptionValue::deleteRecord(['id' => $id]);
 
     return TRUE;
   }
index 930b44aad15476d76f5b73e22b53b82af44d942a..1554cc0cce250d3b0ab4b2779b072597f664b55a 100644 (file)
@@ -223,6 +223,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance implem
    * @return mixed
    */
   public static function del($id = NULL) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     self::deleteRecord(['id' => $id]);
     return 1;
   }
@@ -325,7 +326,7 @@ class CRM_Report_BAO_ReportInstance extends CRM_Report_DAO_ReportInstance implem
       CRM_Core_Error::statusBounce($statusMessage, $bounceTo);
     }
 
-    CRM_Report_BAO_ReportInstance::del($instanceId);
+    CRM_Report_BAO_ReportInstance::deleteRecord(['id' => $instanceId]);
 
     CRM_Core_Session::setStatus(ts('Selected report has been deleted.'), ts('Deleted'), 'success');
     if ($successRedirect) {
index c4a8f659458a027420ae3543769fe823cf450969..af5c12e4e3f4b43c4d9020057ede1961d9016412 100644 (file)
@@ -158,7 +158,7 @@ class CRM_Report_Form_Register extends CRM_Core_Form {
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
 
-      if (CRM_Core_BAO_OptionValue::del($this->_id)) {
+      if (CRM_Core_BAO_OptionValue::deleteRecord(['id' => $this->_id])) {
         CRM_Core_Session::setStatus(ts('Selected %1 Report has been deleted.', [1 => $this->_GName]), ts('Record Deleted'), 'success');
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/report/options/report_template', "reset=1"));
       }
index 774e9b3101dbaae6464cee5a5b17ff37a9621722..6880e6ae7ef27b18b8cc314e6f19d2a8fbfb5abf 100644 (file)
@@ -98,7 +98,7 @@ function _civicrm_api3_activity_type_create_spec(&$params) {
  * @deprecated use OptionValue api
  */
 function civicrm_api3_activity_type_delete($params) {
-  $result = CRM_Core_BAO_OptionValue::del($params['id']);
+  $result = CRM_Core_BAO_OptionValue::deleteRecord($params);
   if ($result) {
     return civicrm_api3_create_success(TRUE, $params);
   }