From: Eileen McNaughton Date: Thu, 30 Nov 2023 20:34:01 +0000 (+1300) Subject: Remove some calls to deprecated function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=26c10f6d6ffd9f381f651d97f526a159345952ba;p=civicrm-core.git Remove some calls to deprecated function https://github.com/civicrm/civicrm-core/pull/23880 is thoroughly stale so I'm closing it - but just thought I'd rescue a couple of changes These are in the barely maintained legacycustomsearches so of marginal risk & marginal benefit but since I looked maybe no-one else has to ever again... --- diff --git a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/ActivitySearch.php b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/ActivitySearch.php index 79ed104952..159577b173 100644 --- a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/ActivitySearch.php +++ b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/ActivitySearch.php @@ -96,7 +96,7 @@ class CRM_Contact_Form_Search_Custom_ActivitySearch extends CRM_Contact_Form_Sea ); // Select box for Activity Type - $activityType = ['' => ts(' - select activity - ')] + CRM_Core_PseudoConstant::activityType(); + $activityType = ['' => ts(' - select activity - ')] + CRM_Activity_BAO_Activity::buildOptions('activity_type_id', 'search'); $form->add('select', 'activity_type_id', ts('Activity Type'), $activityType, @@ -104,7 +104,7 @@ class CRM_Contact_Form_Search_Custom_ActivitySearch extends CRM_Contact_Form_Sea ); // textbox for Activity Status - $activityStatus = ['' => ts(' - select status - ')] + CRM_Core_PseudoConstant::activityStatus(); + $activityStatus = ['' => ts(' - select status - ')] + CRM_Activity_BAO_Activity::buildOptions('status_id', 'search'); $form->add('select', 'activity_status_id', ts('Activity Status'), $activityStatus, diff --git a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/FullText.php b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/FullText.php index ae6eeec70c..d19435aaa6 100644 --- a/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/FullText.php +++ b/ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/FullText.php @@ -112,8 +112,8 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu // 1. this custom search has slightly different structure , // 2. we are in constructor right now, // we 'll use a small hack - - $rowCount = CRM_Utils_Array::value('crmRowCount', $_REQUEST, Civi::settings()->get('default_pager_size')); - $pageId = CRM_Utils_Array::value('crmPID', $_REQUEST, 1); + $rowCount = $_REQUEST['crmRowCount'] ?? Civi::settings()->get('default_pager_size'); + $pageId = $_REQUEST['crmPID'] ?? 1; $offset = ($pageId - 1) * $rowCount; $this->_limitClause = NULL; $this->_limitRowClause = [$rowCount, NULL]; @@ -137,7 +137,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu public function getFieldValue(array $formValues, string $field, $type, $default = NULL) { $value = $formValues[$field] ?? NULL; if (!$value) { - return CRM_Utils_Request::retrieve($field, $type, CRM_Core_DAO::$_nullObject, FALSE, $default); + return CRM_Utils_Request::retrieve($field, $type, NULL, FALSE, $default); } return $value; } @@ -377,8 +377,6 @@ WHERE t.table_name = 'Activity' AND } $dao = CRM_Core_DAO::executeQuery($sql); - $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE); - $roleIds = CRM_Event_PseudoConstant::participantRole(); while ($dao->fetch()) { $row = []; foreach ($this->_tableFields as $name => $dontCare) { @@ -386,14 +384,14 @@ WHERE t.table_name = 'Activity' AND $row[$name] = $dao->$name; } else { - $row['activity_type'] = $activityTypes[$dao->$name] ?? NULL; + $row['activity_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $dao->$name); } } if (isset($row['participant_role'])) { $participantRole = explode(CRM_Core_DAO::VALUE_SEPARATOR, $row['participant_role']); $viewRoles = []; foreach ($participantRole as $v) { - $viewRoles[] = $roleIds[$v]; + $viewRoles[] = CRM_Core_PseudoConstant::getLabel('CRM_Event_BAO_Participant', 'role_id', $v); } $row['participant_role'] = implode(', ', $viewRoles); }