Skip to content

Commit

Permalink
Merge pull request #25746 from eileenmcnaughton/colemanw
Browse files Browse the repository at this point in the history
Remove some deprecated del calls
  • Loading branch information
colemanw authored Mar 7, 2023
2 parents ab0bac0 + 8fed8f5 commit 24ed557
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CRM/Admin/Form/ContactType.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ public function postProcess() {
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;
Expand Down
1 change: 1 addition & 0 deletions CRM/Contact/BAO/ContactType.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ public static function getCreateNewList() {
* @return bool
*/
public static function del($contactTypeId) {
CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
if (!$contactTypeId) {
return FALSE;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Form/RecurringEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public static function postProcess($params, $type, $linkedEntities = []) {
'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,
Expand Down
2 changes: 1 addition & 1 deletion CRM/Extension/Manager/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function onPreUninstall(CRM_Extension_Info $info) {
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Extension/Manager/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function onPreUninstall(CRM_Extension_Info $info) {

$cs = $this->getCustomSearchesById();
$id = $cs[$customSearchesByName[$info->key]];
CRM_Core_BAO_OptionValue::del($id);
CRM_Core_BAO_OptionValue::deleteRecord(['id' => $id]);

return TRUE;
}
Expand Down
3 changes: 2 additions & 1 deletion CRM/Report/BAO/ReportInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public static function &create(&$params) {
* @return mixed
*/
public static function del($id = NULL) {
CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
self::deleteRecord(['id' => $id]);
return 1;
}
Expand Down Expand Up @@ -325,7 +326,7 @@ public static function doFormDelete($instanceId, $bounceTo = 'civicrm/report/lis
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) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static function formRule($fields, $files, $self) {
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"));
}
Expand Down
2 changes: 1 addition & 1 deletion api/v3/ActivityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 24ed557

Please sign in to comment.