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;
* @return bool
*/
public static function del($contactTypeId) {
+ CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
if (!$contactTypeId) {
return FALSE;
}
'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,
$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;
}
$cs = $this->getCustomSearchesById();
$id = $cs[$customSearchesByName[$info->key]];
- CRM_Core_BAO_OptionValue::del($id);
+ CRM_Core_BAO_OptionValue::deleteRecord(['id' => $id]);
return TRUE;
}
* @return mixed
*/
public static function del($id = NULL) {
+ CRM_Core_Error::deprecatedFunctionWarning('deleteRecord');
self::deleteRecord(['id' => $id]);
return 1;
}
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) {
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"));
}
* @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);
}