From d98b6e663cdeabe67900cf55a9bbff2d9cfdf16a Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 9 Mar 2023 09:53:57 +1300 Subject: [PATCH] Deprecations on del functions --- CRM/Admin/Form/LocationType.php | 2 +- CRM/Admin/Form/Mapping.php | 2 +- CRM/Admin/Form/ScheduleReminders.php | 2 +- CRM/Campaign/BAO/Campaign.php | 1 + CRM/Campaign/BAO/Survey.php | 1 + CRM/Campaign/Form/Campaign.php | 2 +- CRM/Campaign/Form/Petition.php | 2 +- CRM/Campaign/Form/Survey/Delete.php | 2 +- CRM/Core/BAO/ActionSchedule.php | 2 ++ CRM/Core/BAO/LocationType.php | 1 + CRM/Core/BAO/Mapping.php | 1 + CRM/Core/Form/RecurringEntity.php | 4 ++-- CRM/Tag/Form/Edit.php | 2 +- 13 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CRM/Admin/Form/LocationType.php b/CRM/Admin/Form/LocationType.php index bfbc0efa22..e9a687b17c 100644 --- a/CRM/Admin/Form/LocationType.php +++ b/CRM/Admin/Form/LocationType.php @@ -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; } diff --git a/CRM/Admin/Form/Mapping.php b/CRM/Admin/Form/Mapping.php index b924ab1acf..bf72f47c1d 100644 --- a/CRM/Admin/Form/Mapping.php +++ b/CRM/Admin/Form/Mapping.php @@ -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'); } } diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index 67e9bef527..e042bae1d6 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -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', diff --git a/CRM/Campaign/BAO/Campaign.php b/CRM/Campaign/BAO/Campaign.php index 2314942c10..8229c944cf 100644 --- a/CRM/Campaign/BAO/Campaign.php +++ b/CRM/Campaign/BAO/Campaign.php @@ -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]); } diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index 136d81b8af..c6b0bd2aaa 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -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; } diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index 838405521b..6a3931a1e9 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -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; diff --git a/CRM/Campaign/Form/Petition.php b/CRM/Campaign/Form/Petition.php index 934779f7ed..d52c50e1f5 100644 --- a/CRM/Campaign/Form/Petition.php +++ b/CRM/Campaign/Form/Petition.php @@ -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; diff --git a/CRM/Campaign/Form/Survey/Delete.php b/CRM/Campaign/Form/Survey/Delete.php index 16715221ea..53a7d0c50e 100644 --- a/CRM/Campaign/Form/Survey/Delete.php +++ b/CRM/Campaign/Form/Survey/Delete.php @@ -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')); } diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index 8307501bb6..3ff899d91c 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -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]); } diff --git a/CRM/Core/BAO/LocationType.php b/CRM/Core/BAO/LocationType.php index 6d119d7091..3200e149d1 100644 --- a/CRM/Core/BAO/LocationType.php +++ b/CRM/Core/BAO/LocationType.php @@ -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]); } diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index a64a2176ab..f184420c33 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -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]); } diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 04d4a5e5ca..52ba505fdc 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -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 = []; diff --git a/CRM/Tag/Form/Edit.php b/CRM/Tag/Form/Edit.php index 71fe9e8b47..09d38c00f0 100644 --- a/CRM/Tag/Form/Edit.php +++ b/CRM/Tag/Form/Edit.php @@ -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++; } } -- 2.25.1