Deprecations on del functions
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 8 Mar 2023 20:53:57 +0000 (09:53 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 8 Mar 2023 20:53:57 +0000 (09:53 +1300)
13 files changed:
CRM/Admin/Form/LocationType.php
CRM/Admin/Form/Mapping.php
CRM/Admin/Form/ScheduleReminders.php
CRM/Campaign/BAO/Campaign.php
CRM/Campaign/BAO/Survey.php
CRM/Campaign/Form/Campaign.php
CRM/Campaign/Form/Petition.php
CRM/Campaign/Form/Survey/Delete.php
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/LocationType.php
CRM/Core/BAO/Mapping.php
CRM/Core/Form/RecurringEntity.php
CRM/Tag/Form/Edit.php

index bfbc0efa2202ee8a6cdb8d5660d2aba53c6e1569..e9a687b17c73608d2a03db90e49804bde0ebf799 100644 (file)
@@ -85,7 +85,7 @@ class CRM_Admin_Form_LocationType extends CRM_Admin_Form {
     CRM_Utils_System::flushCache();
 
     if ($this->_action & CRM_Core_Action::DELETE) {
-      CRM_Core_BAO_LocationType::del($this->_id);
+      CRM_Core_BAO_LocationType::deleteRecord(['id' => $this->_id]);
       CRM_Core_Session::setStatus(ts('Selected Location type has been deleted.'), ts('Record Deleted'), 'success');
       return;
     }
index b924ab1acfcec1cef34c21f2a6d971432b63e739..bf72f47c1d2a1d2088b49d728939909d99993c15 100644 (file)
@@ -83,7 +83,7 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form {
 
     if ($this->_action == CRM_Core_Action::DELETE) {
       if ($this->_id) {
-        CRM_Core_BAO_Mapping::del($this->_id);
+        CRM_Core_BAO_Mapping::deleteRecord(['id' => $this->_id]);
         CRM_Core_Session::setStatus(ts('Selected mapping has been deleted successfully.'), ts('Deleted'), 'success');
       }
     }
index 67e9bef5276661dc6ebf24ab0fd7b3b2ee038266..e042bae1d6fdf498755e2db511d3e95b1be25ea4 100644 (file)
@@ -439,7 +439,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
       // delete reminder
-      CRM_Core_BAO_ActionSchedule::del($this->_id);
+      CRM_Core_BAO_ActionSchedule::deleteRecord(['id' => $this->_id]);
       CRM_Core_Session::setStatus(ts('Selected Reminder has been deleted.'), ts('Record Deleted'), 'success');
       if ($this->getContext() === 'event' && $this->getComponentID()) {
         $url = CRM_Utils_System::url('civicrm/event/manage/reminder',
index 2314942c10c7cd6dbe050120ab07c91c1c45626f..8229c944cf44c29e26cf202daf3410a7e93b7825 100644 (file)
@@ -77,6 +77,7 @@ class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
    * @return bool|int
    */
   public static function del($id) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     try {
       self::deleteRecord(['id' => $id]);
     }
index 136d81b8af368465b08ea227cbf2d47a35c80f83..c6b0bd2aaa09fb8e2904b013a5899d89e52bdf4c 100644 (file)
@@ -363,6 +363,7 @@ SELECT  survey.id    as id,
    * @return mixed|null
    */
   public static function del($id) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     if (!$id) {
       return NULL;
     }
index 838405521b4f2e45f88c2a07d79506442805706a..6a3931a1e9941c55a1fe8887ffc5c3ba3104ef4e 100644 (file)
@@ -287,7 +287,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
     }
     if (!empty($params['id'])) {
       if ($this->_action & CRM_Core_Action::DELETE) {
-        CRM_Campaign_BAO_Campaign::del($params['id']);
+        CRM_Campaign_BAO_Campaign::deleteRecord(['id' => $params['id']]);
         CRM_Core_Session::setStatus(ts('Campaign has been deleted.'), ts('Record Deleted'), 'success');
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=campaign'));
         return;
index 934779f7ed8f4296755624119840a8517b75e042..d52c50e1f5ab1fc30400b392cc8b781ab7039869 100644 (file)
@@ -296,7 +296,7 @@ WHERE  $whereClause
     if ($this->_surveyId) {
 
       if ($this->_action & CRM_Core_Action::DELETE) {
-        CRM_Campaign_BAO_Survey::del($this->_surveyId);
+        CRM_Campaign_BAO_Survey::deleteRecord(['id' => $this->_surveyId]);
         CRM_Core_Session::setStatus(ts(' Petition has been deleted.'), ts('Record Deleted'), 'success');
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=petition'));
         return;
index 16715221eaae2f2fb1e414b6ffc98aa6575effbd..53a7d0c50e0a6024780fc8801cc6d28ac69bd271 100644 (file)
@@ -72,7 +72,7 @@ class CRM_Campaign_Form_Survey_Delete extends CRM_Core_Form {
    */
   public function postProcess() {
     if ($this->_surveyId) {
-      CRM_Campaign_BAO_Survey::del($this->_surveyId);
+      CRM_Campaign_BAO_Survey::deleteRecord(['id' => $this->_surveyId]);
       CRM_Core_Session::setStatus('', ts("'%1' survey has been deleted.", [1 => $this->_surveyTitle]), 'success');
       CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'));
     }
index 8307501bb60d56d50d0fb6c7e92884b0b6bbb2de..3ff899d91cb103a0c49f773fcd84eb93c9e0f0be 100644 (file)
@@ -179,6 +179,7 @@ FROM civicrm_action_schedule cas
    * @throws \CRM_Core_Exception
    */
   public static function add(array $params): CRM_Core_DAO_ActionSchedule {
+    CRM_Core_Error::deprecatedFunctionWarning('writeRecord');
     return self::writeRecord($params);
   }
 
@@ -210,6 +211,7 @@ FROM civicrm_action_schedule cas
    * @throws CRM_Core_Exception
    */
   public static function del($id) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     self::deleteRecord(['id' => $id]);
   }
 
index 6d119d7091645f6bc4d04d7f21ffd2fe837b09c8..3200e149d1cea27cce26bda5bcba0a493c84598c 100644 (file)
@@ -121,6 +121,7 @@ class CRM_Core_BAO_LocationType extends CRM_Core_DAO_LocationType implements \Ci
    * @deprecated
    */
   public static function del($locationTypeId) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     static::deleteRecord(['id' => $locationTypeId]);
   }
 
index a64a2176ab8d4e066cfdb42a54f52196a0b123e9..f184420c330618837a28bfd2231493202527737e 100644 (file)
@@ -42,6 +42,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping implements \Civi\Core\Ho
    * @return bool
    */
   public static function del($id) {
+    CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
     return (bool) static::deleteRecord(['id' => $id]);
   }
 
index 04d4a5e5ca2914a90f9c975776b7c6c5ee82b6f1..52ba505fdcb1bf5df791b422e396cb0493767e60 100644 (file)
@@ -346,10 +346,10 @@ class CRM_Core_Form_RecurringEntity {
 
         //Delete repeat configuration and rebuild
         if (!empty($params['id'])) {
-          CRM_Core_BAO_ActionSchedule::del($params['id']);
+          CRM_Core_BAO_ActionSchedule::deleteRecord($params);
           unset($params['id']);
         }
-        $actionScheduleObj = CRM_Core_BAO_ActionSchedule::add($dbParams);
+        $actionScheduleObj = CRM_Core_BAO_ActionSchedule::writeRecord($dbParams);
 
         //exclude dates
         $excludeDateList = [];
index 71fe9e8b47952651d8fcdcf5c05cd7268ed6ed9a..09d38c00f06f1f80a3ccaf1204742d25b3dbc186 100644 (file)
@@ -165,7 +165,7 @@ class CRM_Tag_Form_Edit extends CRM_Admin_Form {
       $deleted = 0;
       $tag = civicrm_api3('tag', 'getsingle', ['id' => $this->_id[0]]);
       foreach ($this->_id as $id) {
-        if (CRM_Core_BAO_Tag::del($id)) {
+        if (CRM_Core_BAO_Tag::deleteRecord(['id' => $id])) {
           $deleted++;
         }
       }