diff --git a/CRM/ACL/Page/ACL.php b/CRM/ACL/Page/ACL.php index fabb7de4252d..7816abcfe0da 100644 --- a/CRM/ACL/Page/ACL.php +++ b/CRM/ACL/Page/ACL.php @@ -135,7 +135,7 @@ public function browse() { $acl[$dao->id]['is_active'] = $dao->is_active; if ($acl[$dao->id]['entity_id']) { - $acl[$dao->id]['entity'] = CRM_Utils_Array::value($acl[$dao->id]['entity_id'], $roles); + $acl[$dao->id]['entity'] = $roles[$acl[$dao->id]['entity_id']] ?? NULL; } else { $acl[$dao->id]['entity'] = ts('Everyone'); @@ -143,22 +143,22 @@ public function browse() { switch ($acl[$dao->id]['object_table']) { case 'civicrm_saved_search': - $acl[$dao->id]['object'] = CRM_Utils_Array::value($acl[$dao->id]['object_id'], $group); + $acl[$dao->id]['object'] = $group[$acl[$dao->id]['object_id']] ?? NULL; $acl[$dao->id]['object_name'] = ts('Group'); break; case 'civicrm_uf_group': - $acl[$dao->id]['object'] = CRM_Utils_Array::value($acl[$dao->id]['object_id'], $ufGroup); + $acl[$dao->id]['object'] = $ufGroup[$acl[$dao->id]['object_id']] ?? NULL; $acl[$dao->id]['object_name'] = ts('Profile'); break; case 'civicrm_custom_group': - $acl[$dao->id]['object'] = CRM_Utils_Array::value($acl[$dao->id]['object_id'], $customGroup); + $acl[$dao->id]['object'] = $customGroup[$acl[$dao->id]['object_id']] ?? NULL; $acl[$dao->id]['object_name'] = ts('Custom Group'); break; case 'civicrm_event': - $acl[$dao->id]['object'] = CRM_Utils_Array::value($acl[$dao->id]['object_id'], $event); + $acl[$dao->id]['object'] = $event[$acl[$dao->id]['object_id']] ?? NULL; $acl[$dao->id]['object_name'] = ts('Event'); break; } diff --git a/CRM/ACL/Page/ACLBasic.php b/CRM/ACL/Page/ACLBasic.php index 0129f0390662..ff643d0890f2 100644 --- a/CRM/ACL/Page/ACLBasic.php +++ b/CRM/ACL/Page/ACLBasic.php @@ -114,7 +114,7 @@ public function browse() { $acl[$dao->entity_id]['name'] = $dao->name; $acl[$dao->entity_id]['entity_id'] = $dao->entity_id; $acl[$dao->entity_id]['entity_table'] = $dao->entity_table; - $acl[$dao->entity_id]['object_table'] = CRM_Utils_Array::value($dao->object_table, $permissions); + $acl[$dao->entity_id]['object_table'] = $permissions[$dao->object_table] ?? NULL; $acl[$dao->entity_id]['is_active'] = 1; if ($acl[$dao->entity_id]['entity_id']) { diff --git a/CRM/ACL/Page/EntityRole.php b/CRM/ACL/Page/EntityRole.php index 3b2ca6d762a4..0e7b5b809773 100644 --- a/CRM/ACL/Page/EntityRole.php +++ b/CRM/ACL/Page/EntityRole.php @@ -127,7 +127,7 @@ public function browse() { $entityRoles[$dao->id] = []; CRM_Core_DAO::storeValues($dao, $entityRoles[$dao->id]); - $entityRoles[$dao->id]['acl_role'] = CRM_Utils_Array::value($dao->acl_role_id, $aclRoles); + $entityRoles[$dao->id]['acl_role'] = $aclRoles[$dao->acl_role_id] ?? NULL; $entityRoles[$dao->id]['entity'] = $groups[$dao->entity_id]; // form all action links diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 06f0e91b62bd..77607f4616a2 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -153,7 +153,7 @@ public static function deleteActivity(&$params, $moveToTrash = FALSE) { $sourceRecordIds = implode(',', $params['source_record_id']); } else { - $sourceRecordIds = CRM_Utils_Array::value('source_record_id', $params); + $sourceRecordIds = $params['source_record_id'] ?? NULL; } $result = NULL; @@ -490,7 +490,7 @@ public static function create(&$params) { } else { // at worst, take source for recently viewed display - $recentContactId = CRM_Utils_Array::value('source_contact_id', $params); + $recentContactId = $params['source_contact_id'] ?? NULL; } if (isset($params['assignee_contact_id'])) { @@ -582,7 +582,7 @@ public static function create(&$params) { // if the subject contains a ‘[case #…]’ string, file that activity on the related case (CRM-5916) $matches = []; - $subjectToMatch = CRM_Utils_Array::value('subject', $params); + $subjectToMatch = $params['subject'] ?? NULL; if (preg_match('/\[case #([0-9a-h]{7})\]/', $subjectToMatch, $matches)) { $key = CRM_Core_DAO::escapeString(CIVICRM_SITE_KEY); $hash = $matches[1]; @@ -804,7 +804,7 @@ public static function getActivities($params) { } // case related fields elseif ($apiKey == 'case_id' && !$isBulkActivity) { - $activities[$id][$expectedName] = CRM_Utils_Array::value($apiKey, $activity); + $activities[$id][$expectedName] = $activity[$apiKey] ?? NULL; // fetch case subject for case ID found if (!empty($activity['case_id'])) { @@ -815,9 +815,9 @@ public static function getActivities($params) { } else { // @todo this generic assign could just be handled in array declaration earlier. - $activities[$id][$expectedName] = CRM_Utils_Array::value($apiKey, $activity); + $activities[$id][$expectedName] = $activity[$apiKey] ?? NULL; if ($apiKey == 'campaign_id') { - $activities[$id]['campaign'] = CRM_Utils_Array::value($activities[$id][$expectedName], $allCampaigns); + $activities[$id]['campaign'] = $allCampaigns[$activities[$id][$expectedName]] ?? NULL; } } } @@ -1427,7 +1427,7 @@ public static function sendSMSMessage( // To get primary mobile phonenumber, if not get the first mobile phonenumber if (!empty($toPhoneNumbers)) { $toPhoneNumberDetails = reset($toPhoneNumbers); - $toPhoneNumber = CRM_Utils_Array::value('phone', $toPhoneNumberDetails); + $toPhoneNumber = $toPhoneNumberDetails['phone'] ?? NULL; // Contact allows to send sms } } @@ -2002,8 +2002,8 @@ public static function createFollowupActivity($activityId, $params) { $followupParams['activity_type_id'] = $params['followup_activity_type_id']; // Get Subject of Follow-up Activiity, CRM-4491 - $followupParams['subject'] = CRM_Utils_Array::value('followup_activity_subject', $params); - $followupParams['assignee_contact_id'] = CRM_Utils_Array::value('followup_assignee_contact_id', $params); + $followupParams['subject'] = $params['followup_activity_subject'] ?? NULL; + $followupParams['assignee_contact_id'] = $params['followup_assignee_contact_id'] ?? NULL; // Create target contact for followup. if (!empty($params['target_contact_id'])) { @@ -2523,9 +2523,9 @@ public static function getContactActivitySelector(&$params) { // Format the params. $params['offset'] = ($params['page'] - 1) * $params['rp']; $params['rowCount'] = $params['rp']; - $params['sort'] = CRM_Utils_Array::value('sortBy', $params); + $params['sort'] = $params['sortBy'] ?? NULL; $params['caseId'] = NULL; - $context = CRM_Utils_Array::value('context', $params); + $context = $params['context'] ?? NULL; $showContactOverlay = !CRM_Utils_String::startsWith($context, "dashlet"); $activityTypeInfo = civicrm_api3('OptionValue', 'get', [ 'option_group_id' => "activity_type", @@ -2897,8 +2897,8 @@ public function setApiFilter(&$params) { */ public static function sendToAssignee($activity, $mailToContacts, $params = []) { if (!CRM_Utils_Array::crmIsEmptyArray($mailToContacts)) { - $clientID = CRM_Utils_Array::value('client_id', $params); - $caseID = CRM_Utils_Array::value('case_id', $params); + $clientID = $params['client_id'] ?? NULL; + $caseID = $params['case_id'] ?? NULL; $ics = new CRM_Activity_BAO_ICalendar($activity); $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', $activity->id); diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 84880f2c020d..6f1885e7bd39 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -230,7 +230,7 @@ public function setFields() { */ public function preProcess() { CRM_Core_Form_RecurringEntity::preProcess('civicrm_activity'); - $this->_atypefile = CRM_Utils_Array::value('atypefile', $_GET); + $this->_atypefile = $_GET['atypefile'] ?? NULL; $this->assign('atypefile', FALSE); if ($this->_atypefile) { $this->assign('atypefile', TRUE); @@ -444,7 +444,7 @@ public function preProcess() { // hack to retrieve activity type id from post variables if (!$this->_activityTypeId) { - $this->_activityTypeId = CRM_Utils_Array::value('activity_type_id', $_POST); + $this->_activityTypeId = $_POST['activity_type_id'] ?? NULL; } // when custom data is included in this page @@ -540,8 +540,8 @@ public function setDefaultValues() { } // Fixme: why are we getting the wrong keys from upstream? - $defaults['target_contact_id'] = CRM_Utils_Array::value('target_contact', $defaults); - $defaults['assignee_contact_id'] = CRM_Utils_Array::value('assignee_contact', $defaults); + $defaults['target_contact_id'] = $defaults['target_contact'] ?? NULL; + $defaults['assignee_contact_id'] = $defaults['assignee_contact'] ?? NULL; // set default tags if exists $defaults['tag'] = implode(',', CRM_Core_BAO_EntityTag::getTag($this->_activityId, 'civicrm_activity')); @@ -649,7 +649,7 @@ public function buildQuickForm() { foreach ($this->_fields as $field => $values) { if (!empty($this->_fields[$field])) { - $attribute = CRM_Utils_Array::value('attributes', $values); + $attribute = $values['attributes'] ?? NULL; $required = !empty($values['required']); if ($values['type'] == 'select' && empty($attribute)) { @@ -831,8 +831,8 @@ public static function formRule($fields, $files, $self) { $errors['activity_type_id'] = ts('Activity Type is a required field'); } - $activity_type_id = CRM_Utils_Array::value('activity_type_id', $fields); - $activity_status_id = CRM_Utils_Array::value('status_id', $fields); + $activity_type_id = $fields['activity_type_id'] ?? NULL; + $activity_status_id = $fields['status_id'] ?? NULL; $scheduled_status_id = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Scheduled'); if ($activity_type_id && $activity_status_id == $scheduled_status_id) { @@ -1237,7 +1237,7 @@ public function assignActivityType() { // Set title. if (isset($activityTypeDisplayLabels)) { // FIXME - it's not clear why the if line just above is needed here and why we can't just set this once above and re-use. What is interesting, but can't possibly be the reason, is that the first if block will fail if the label is the string '0', whereas this one won't. But who would have an activity type called '0'? - $activityTypeDisplayLabel = CRM_Utils_Array::value($this->_activityTypeId, $activityTypeDisplayLabels); + $activityTypeDisplayLabel = $activityTypeDisplayLabels[$this->_activityTypeId] ?? NULL; if ($this->_currentlyViewedContactId) { $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); diff --git a/CRM/Activity/Form/ActivityView.php b/CRM/Activity/Form/ActivityView.php index e3df30c80a04..172ff26c394d 100644 --- a/CRM/Activity/Form/ActivityView.php +++ b/CRM/Activity/Form/ActivityView.php @@ -59,7 +59,7 @@ public function preProcess() { $this->assign('activityTypeDescription', $activityTypeDescription); if (!empty($defaults['mailingId'])) { - $this->_mailing_id = CRM_Utils_Array::value('source_record_id', $defaults); + $this->_mailing_id = $defaults['source_record_id'] ?? NULL; $mailingReport = CRM_Mailing_BAO_Mailing::report($this->_mailing_id, TRUE); CRM_Mailing_BAO_Mailing::getMailingContent($mailingReport, $this); $this->assign('mailingReport', $mailingReport); diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 06dab35143ad..56035b42a19f 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -251,7 +251,7 @@ public function fixFormValues() { if ($survey) { $this->_formValues['activity_survey_id'] = $this->_defaults['activity_survey_id'] = $survey; - $sid = CRM_Utils_Array::value('activity_survey_id', $this->_formValues); + $sid = $this->_formValues['activity_survey_id'] ?? NULL; $activity_type_id = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $sid, 'activity_type_id'); // since checkbox are replaced by multiple select option diff --git a/CRM/Activity/Form/Task/Batch.php b/CRM/Activity/Form/Task/Batch.php index ce68c080d95e..b061e86ec40e 100644 --- a/CRM/Activity/Form/Task/Batch.php +++ b/CRM/Activity/Form/Task/Batch.php @@ -146,7 +146,7 @@ public function buildQuickForm() { $typeId = CRM_Core_DAO::getFieldValue("CRM_Activity_DAO_Activity", $activityId, 'activity_type_id'); foreach ($this->_fields as $name => $field) { if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) { - $customValue = CRM_Utils_Array::value($customFieldID, $customFields); + $customValue = $customFields[$customFieldID] ?? NULL; if (!empty($customValue['extends_entity_column_value'])) { $entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value'] diff --git a/CRM/Activity/Import/Form/MapField.php b/CRM/Activity/Import/Form/MapField.php index 7d68f31b0a60..51cb5aa42baf 100644 --- a/CRM/Activity/Import/Form/MapField.php +++ b/CRM/Activity/Import/Form/MapField.php @@ -309,7 +309,7 @@ public static function formRule($fields) { } if (!empty($fields['saveMapping'])) { - $nameField = CRM_Utils_Array::value('saveMappingName', $fields); + $nameField = $fields['saveMappingName'] ?? NULL; if (empty($nameField)) { $errors['saveMappingName'] = ts('Name is required to save Import Mapping'); } diff --git a/CRM/Activity/Page/AJAX.php b/CRM/Activity/Page/AJAX.php index 26da6433d521..1edf516e6f88 100644 --- a/CRM/Activity/Page/AJAX.php +++ b/CRM/Activity/Page/AJAX.php @@ -249,7 +249,7 @@ public static function convertToCaseActivity() { $params = ['caseID', 'activityID', 'contactID', 'newSubject', 'targetContactIds', 'mode']; $vals = []; foreach ($params as $param) { - $vals[$param] = CRM_Utils_Array::value($param, $_POST); + $vals[$param] = $_POST[$param] ?? NULL; } CRM_Utils_JSON::output(self::_convertToCaseActivity($vals)); diff --git a/CRM/Activity/Selector/Search.php b/CRM/Activity/Selector/Search.php index e2d38c551d9e..d0367750cb8b 100644 --- a/CRM/Activity/Selector/Search.php +++ b/CRM/Activity/Selector/Search.php @@ -282,9 +282,9 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) { } } - $contactId = CRM_Utils_Array::value('contact_id', $row); + $contactId = $row['contact_id'] ?? NULL; if (!$contactId) { - $contactId = CRM_Utils_Array::value('source_contact_id', $row); + $contactId = $row['source_contact_id'] ?? NULL; } $row['target_contact_name'] = CRM_Activity_BAO_ActivityContact::getNames($row['activity_id'], $targetID); @@ -339,7 +339,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) { ); // Carry campaign to selector. - $row['campaign'] = CRM_Utils_Array::value($result->activity_campaign_id, $allCampaigns); + $row['campaign'] = $allCampaigns[$result->activity_campaign_id] ?? NULL; $row['campaign_id'] = $result->activity_campaign_id; if ($engagementLevel = CRM_Utils_Array::value('activity_engagement_level', $row)) { diff --git a/CRM/Activity/StateMachine/Search.php b/CRM/Activity/StateMachine/Search.php index 7249d8c45441..56c408af1248 100644 --- a/CRM/Activity/StateMachine/Search.php +++ b/CRM/Activity/StateMachine/Search.php @@ -65,7 +65,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) { */ public function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff - $value = CRM_Utils_Array::value('task', $_POST); + $value = $_POST['task'] ?? NULL; if (!isset($value)) { $value = $this->_controller->get('task'); } diff --git a/CRM/Admin/Form/MailSettings.php b/CRM/Admin/Form/MailSettings.php index 034228b8a57e..4de49fe41356 100644 --- a/CRM/Admin/Form/MailSettings.php +++ b/CRM/Admin/Form/MailSettings.php @@ -157,7 +157,7 @@ public function postProcess() { $params[$f] = CRM_Utils_Array::value($f, $formValues, FALSE); } else { - $params[$f] = CRM_Utils_Array::value($f, $formValues); + $params[$f] = $formValues[$f] ?? NULL; } } diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index 47aa143ccbd4..b1bb3419728f 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -94,7 +94,7 @@ public function buildQuickForm() { ]); } else { - $this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values); + $this->_workflow_id = $this->_values['workflow_id'] ?? NULL; $this->checkUserPermission($this->_workflow_id); $this->assign('workflow_id', $this->_workflow_id); @@ -289,7 +289,7 @@ public function postProcess() { } } - $this->_workflow_id = CRM_Utils_Array::value('workflow_id', $this->_values); + $this->_workflow_id = $this->_values['workflow_id'] ?? NULL; if ($this->_workflow_id) { $params['workflow_id'] = $this->_workflow_id; $params['is_active'] = TRUE; diff --git a/CRM/Admin/Form/Navigation.php b/CRM/Admin/Form/Navigation.php index ffd148fc485f..510d039c1372 100644 --- a/CRM/Admin/Form/Navigation.php +++ b/CRM/Admin/Form/Navigation.php @@ -98,7 +98,7 @@ public function setDefaultValues() { if (isset($this->_id)) { //Take parent id in object variable to calculate the menu //weight if menu parent id changed - $this->_currentParentID = CRM_Utils_Array::value('parent_id', $this->_defaults); + $this->_currentParentID = $this->_defaults['parent_id'] ?? NULL; } else { $defaults['permission'] = "access CiviCRM"; diff --git a/CRM/Admin/Form/ParticipantStatusType.php b/CRM/Admin/Form/ParticipantStatusType.php index 4f7516d8d11d..d25661c40bd9 100644 --- a/CRM/Admin/Form/ParticipantStatusType.php +++ b/CRM/Admin/Form/ParticipantStatusType.php @@ -65,7 +65,7 @@ public function setDefaultValues() { if (empty($defaults['weight'])) { $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Event_DAO_ParticipantStatusType'); } - $this->_isReserved = CRM_Utils_Array::value('is_reserved', $defaults); + $this->_isReserved = $defaults['is_reserved'] ?? NULL; if ($this->_isReserved) { $this->freeze(['name', 'class', 'is_active']); } diff --git a/CRM/Admin/Form/RelationshipType.php b/CRM/Admin/Form/RelationshipType.php index 5fc015bd8ed7..ea8bf121351d 100644 --- a/CRM/Admin/Form/RelationshipType.php +++ b/CRM/Admin/Form/RelationshipType.php @@ -138,12 +138,12 @@ public function setDefaultValues() { $params = ['id' => $this->_id]; $baoName = $this->_BAOName; $baoName::retrieve($params, $defaults); - $defaults['contact_types_a'] = CRM_Utils_Array::value('contact_type_a', $defaults); + $defaults['contact_types_a'] = $defaults['contact_type_a'] ?? NULL; if (!empty($defaults['contact_sub_type_a'])) { $defaults['contact_types_a'] .= '__' . $defaults['contact_sub_type_a']; } - $defaults['contact_types_b'] = CRM_Utils_Array::value('contact_type_b', $defaults); + $defaults['contact_types_b'] = $defaults['contact_type_b'] ?? NULL; if (!empty($defaults['contact_sub_type_b'])) { $defaults['contact_types_b'] .= '__' . $defaults['contact_sub_type_b']; } @@ -187,7 +187,7 @@ public function postProcess() { $params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'null'; if (!strlen(trim(CRM_Utils_Array::value('label_b_a', $params)))) { - $params['label_b_a'] = CRM_Utils_Array::value('label_a_b', $params); + $params['label_b_a'] = $params['label_a_b'] ?? NULL; } if (empty($params['id'])) { diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php index e0fd77de3cb4..a7b94e70f411 100644 --- a/CRM/Admin/Form/ScheduleReminders.php +++ b/CRM/Admin/Form/ScheduleReminders.php @@ -387,7 +387,7 @@ public function setDefaultValues() { $entityValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('entity_value', $defaults)); $entityStatus = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('entity_status', $defaults)); if (empty($this->getContext())) { - $defaults['entity'][0] = CRM_Utils_Array::value('mapping_id', $defaults); + $defaults['entity'][0] = $defaults['mapping_id'] ?? NULL; $defaults['entity'][1] = $entityValue; $defaults['entity'][2] = $entityStatus; } @@ -400,11 +400,11 @@ public function setDefaultValues() { $recipientListing ); } - $defaults['text_message'] = CRM_Utils_Array::value('body_text', $defaults); - $defaults['html_message'] = CRM_Utils_Array::value('body_html', $defaults); - $defaults['sms_text_message'] = CRM_Utils_Array::value('sms_body_text', $defaults); - $defaults['template'] = CRM_Utils_Array::value('msg_template_id', $defaults); - $defaults['SMStemplate'] = CRM_Utils_Array::value('sms_template_id', $defaults); + $defaults['text_message'] = $defaults['body_text'] ?? NULL; + $defaults['html_message'] = $defaults['body_html'] ?? NULL; + $defaults['sms_text_message'] = $defaults['sms_body_text'] ?? NULL; + $defaults['template'] = $defaults['msg_template_id'] ?? NULL; + $defaults['SMStemplate'] = $defaults['sms_template_id'] ?? NULL; if (!empty($defaults['group_id'])) { $defaults['recipient'] = 'group'; } @@ -489,7 +489,7 @@ public function parseActionSchedule($values) { 'from_email', ]; foreach ($keys as $key) { - $params[$key] = CRM_Utils_Array::value($key, $values); + $params[$key] = $values[$key] ?? NULL; } $params['is_repeat'] = CRM_Utils_Array::value('is_repeat', $values, 0); @@ -515,15 +515,15 @@ public function parseActionSchedule($values) { $params[$mkey] = 'null'; continue; } - $params[$mkey] = CRM_Utils_Array::value($mkey, $values); + $params[$mkey] = $values[$mkey] ?? NULL; } - $params['body_text'] = CRM_Utils_Array::value('text_message', $values); - $params['sms_body_text'] = CRM_Utils_Array::value('sms_text_message', $values); - $params['body_html'] = CRM_Utils_Array::value('html_message', $values); + $params['body_text'] = $values['text_message'] ?? NULL; + $params['sms_body_text'] = $values['sms_text_message'] ?? NULL; + $params['body_html'] = $values['html_message'] ?? NULL; if (CRM_Utils_Array::value('recipient', $values) == 'manual') { - $params['recipient_manual'] = CRM_Utils_Array::value('recipient_manual_id', $values); + $params['recipient_manual'] = $values['recipient_manual_id'] ?? NULL; $params['group_id'] = $params['recipient'] = $params['recipient_listing'] = 'null'; } elseif (CRM_Utils_Array::value('recipient', $values) == 'group') { @@ -531,14 +531,14 @@ public function parseActionSchedule($values) { $params['recipient_manual'] = $params['recipient'] = $params['recipient_listing'] = 'null'; } elseif (isset($values['recipient_listing']) && isset($values['limit_to']) && !CRM_Utils_System::isNull($values['recipient_listing']) && !CRM_Utils_System::isNull($values['limit_to'])) { - $params['recipient'] = CRM_Utils_Array::value('recipient', $values); + $params['recipient'] = $values['recipient'] ?? NULL; $params['recipient_listing'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('recipient_listing', $values) ); $params['group_id'] = $params['recipient_manual'] = 'null'; } else { - $params['recipient'] = CRM_Utils_Array::value('recipient', $values); + $params['recipient'] = $values['recipient'] ?? NULL; $params['group_id'] = $params['recipient_manual'] = $params['recipient_listing'] = 'null'; } @@ -573,7 +573,7 @@ public function parseActionSchedule($values) { // multilingual options $params['filter_contact_language'] = CRM_Utils_Array::value('filter_contact_language', $values, []); $params['filter_contact_language'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $params['filter_contact_language']); - $params['communication_language'] = CRM_Utils_Array::value('communication_language', $values, NULL); + $params['communication_language'] = $values['communication_language'] ?? NULL; if ($this->_action & CRM_Core_Action::UPDATE) { $params['id'] = $this->_id; @@ -657,7 +657,7 @@ public function parseActionSchedule($values) { $params['sms_template_id'] = $msgTemplate->id; } else { - $params['sms_template_id'] = CRM_Utils_Array::value('SMStemplate', $values); + $params['sms_template_id'] = $values['SMStemplate'] ?? NULL; } } else { @@ -665,7 +665,7 @@ public function parseActionSchedule($values) { $params['msg_template_id'] = $msgTemplate->id; } else { - $params['msg_template_id'] = CRM_Utils_Array::value('template', $values); + $params['msg_template_id'] = $values['template'] ?? NULL; } } } diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 416409979af7..f1d0e918931c 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -162,7 +162,7 @@ protected function addFieldsDefinedInSettingsMetadata() { foreach ($settingMetaData as $setting => $props) { $quickFormType = $this->getQuickFormType($props); if (isset($quickFormType)) { - $options = CRM_Utils_Array::value('options', $props); + $options = $props['options'] ?? NULL; if ($options) { if ($props['html_type'] === 'Select' && isset($props['is_required']) && $props['is_required'] === FALSE && !isset($options[''])) { // If the spec specifies the field is not required add a null option. @@ -233,7 +233,7 @@ protected function addFieldsDefinedInSettingsMetadata() { $this->$add($setting, $props['title'], $options); } // Migrate to using an array as easier in smart... - $description = CRM_Utils_Array::value('description', $props); + $description = $props['description'] ?? NULL; $descriptions[$setting] = $description; $this->assign("{$setting}_description", $description); if ($setting === 'max_attachments') { diff --git a/CRM/Admin/Form/WordReplacements.php b/CRM/Admin/Form/WordReplacements.php index 820b3c9aeab0..646379a50788 100644 --- a/CRM/Admin/Form/WordReplacements.php +++ b/CRM/Admin/Form/WordReplacements.php @@ -31,7 +31,7 @@ public function preProcess() { // should rewrite this UI. CRM_Core_BAO_WordReplacement::rebuild(FALSE); - $this->_soInstance = CRM_Utils_Array::value('instance', $_GET); + $this->_soInstance = $_GET['instance'] ?? NULL; $this->assign('soInstance', $this->_soInstance); } @@ -148,10 +148,10 @@ public function buildQuickForm() { public static function formRule($values) { $errors = []; - $oldValues = CRM_Utils_Array::value('old', $values); - $newValues = CRM_Utils_Array::value('new', $values); - $enabled = CRM_Utils_Array::value('enabled', $values); - $exactMatch = CRM_Utils_Array::value('cb', $values); + $oldValues = $values['old'] ?? NULL; + $newValues = $values['new'] ?? NULL; + $enabled = $values['enabled'] ?? NULL; + $exactMatch = $values['cb'] ?? NULL; foreach ($oldValues as $k => $v) { if ($v && !$newValues[$k]) { diff --git a/CRM/Admin/Page/APIExplorer.php b/CRM/Admin/Page/APIExplorer.php index c3669134ed1b..13363ee23122 100644 --- a/CRM/Admin/Page/APIExplorer.php +++ b/CRM/Admin/Page/APIExplorer.php @@ -131,9 +131,9 @@ public static function getExampleFile() { public static function getDoc() { // Verify the API handler we're talking to is valid. $entities = civicrm_api3('Entity', 'get'); - $entity = CRM_Utils_Array::value('entity', $_GET); + $entity = $_GET['entity'] ?? NULL; if (!empty($entity) && in_array($entity, $entities['values']) && strpos($entity, '.') === FALSE) { - $action = CRM_Utils_Array::value('action', $_GET); + $action = $_GET['action'] ?? NULL; $doc = self::getDocblock($entity, $action); $result = [ 'doc' => $doc ? self::formatDocBlock($doc[0]) : 'Not found.', diff --git a/CRM/Admin/Page/MailSettings.php b/CRM/Admin/Page/MailSettings.php index 475f8c5a7d7e..6ede83649efa 100644 --- a/CRM/Admin/Page/MailSettings.php +++ b/CRM/Admin/Page/MailSettings.php @@ -84,7 +84,7 @@ public function browse() { $mailSetting->find(); while ($mailSetting->fetch()) { //replace protocol value with name - $mailSetting->protocol = CRM_Utils_Array::value($mailSetting->protocol, $allProtocols); + $mailSetting->protocol = $allProtocols[$mailSetting->protocol] ?? NULL; CRM_Core_DAO::storeValues($mailSetting, $allMailSettings[$mailSetting->id]); //form all action links diff --git a/CRM/Badge/BAO/Badge.php b/CRM/Badge/BAO/Badge.php index 892c719e31cb..dea0e356c74e 100644 --- a/CRM/Badge/BAO/Badge.php +++ b/CRM/Badge/BAO/Badge.php @@ -204,10 +204,10 @@ public function labelCreator(&$formattedRow, $cellspacing = 0) { if ((CRM_Utils_Array::value('height_image_1', $formattedRow) > CRM_Utils_Array::value('height_image_2', $formattedRow)) && !empty($formattedRow['height_image_1']) ) { - $startOffset = CRM_Utils_Array::value('height_image_1', $formattedRow); + $startOffset = $formattedRow['height_image_1'] ?? NULL; } elseif (!empty($formattedRow['height_image_2'])) { - $startOffset = CRM_Utils_Array::value('height_image_2', $formattedRow); + $startOffset = $formattedRow['height_image_2'] ?? NULL; } if (!empty($formattedRow['participant_image'])) { diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 782c6697ab8a..c777fa4acb36 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -43,7 +43,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { */ public static function create(&$params) { $op = 'edit'; - $batchId = CRM_Utils_Array::value('id', $params); + $batchId = $params['id'] ?? NULL; if (!$batchId) { $op = 'create'; $params['name'] = CRM_Utils_String::titleToVar($params['title']); @@ -150,7 +150,7 @@ public static function getBatchListSelector(&$params) { // format the params $params['offset'] = ($params['page'] - 1) * $params['rp']; $params['rowCount'] = $params['rp']; - $params['sort'] = CRM_Utils_Array::value('sortBy', $params); + $params['sort'] = $params['sortBy'] ?? NULL; // get batches $batches = self::getBatchList($params); @@ -185,8 +185,8 @@ public static function getBatchListSelector(&$params) { $batch['batch_name'] = $value['title']; $batch['total'] = ''; $batch['payment_instrument'] = $value['payment_instrument']; - $batch['item_count'] = CRM_Utils_Array::value('item_count', $value); - $batch['type'] = CRM_Utils_Array::value('batch_type', $value); + $batch['item_count'] = $value['item_count'] ?? NULL; + $batch['type'] = $value['batch_type'] ?? NULL; if (!empty($value['total'])) { // CRM-21205 $batch['total'] = CRM_Utils_Money::format($value['total'], $value['currency']); diff --git a/CRM/Batch/BAO/EntityBatch.php b/CRM/Batch/BAO/EntityBatch.php index 581f6db0b10f..caebb1a87074 100644 --- a/CRM/Batch/BAO/EntityBatch.php +++ b/CRM/Batch/BAO/EntityBatch.php @@ -24,7 +24,7 @@ class CRM_Batch_BAO_EntityBatch extends CRM_Batch_DAO_EntityBatch { */ public static function create(&$params) { $op = 'edit'; - $entityId = CRM_Utils_Array::value('id', $params); + $entityId = $params['id'] ?? NULL; if (!$entityId) { $op = 'create'; } @@ -46,7 +46,7 @@ public static function del($params) { $params = ['id' => $params]; } $entityBatch = new CRM_Batch_DAO_EntityBatch(); - $entityId = CRM_Utils_Array::value('id', $params); + $entityId = $params['id'] ?? NULL; CRM_Utils_Hook::pre('delete', 'EntityBatch', $entityId, $params); $entityBatch->copyValues($params); $entityBatch->delete(); diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index a62c649b3254..687c4282e056 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -463,7 +463,7 @@ private function processContribution(&$params) { continue; } - $value['contact_id'] = CRM_Utils_Array::value($key, $params['primary_contact_id']); + $value['contact_id'] = $params['primary_contact_id'][$key] ?? NULL; // update contact information $this->updateContactInfo($value); @@ -647,7 +647,7 @@ private function processMembership(&$params) { continue; } - $value['contact_id'] = CRM_Utils_Array::value($key, $params['primary_contact_id']); + $value['contact_id'] = $params['primary_contact_id'][$key] ?? NULL; // update contact information $this->updateContactInfo($value); @@ -779,12 +779,12 @@ private function processMembership(&$params) { // The following parameter setting may be obsolete. $this->_params = $params; $value['is_renew'] = TRUE; - $isPayLater = CRM_Utils_Array::value('is_pay_later', $params); + $isPayLater = $params['is_pay_later'] ?? NULL; $campaignId = NULL; if (isset($this->_values) && is_array($this->_values) && !empty($this->_values)) { - $campaignId = CRM_Utils_Array::value('campaign_id', $this->_params); + $campaignId = $this->_params['campaign_id'] ?? NULL; if (!array_key_exists('campaign_id', $this->_params)) { - $campaignId = CRM_Utils_Array::value('campaign_id', $this->_values); + $campaignId = $this->_values['campaign_id'] ?? NULL; } } @@ -792,7 +792,7 @@ private function processMembership(&$params) { 'end_date' => $value['membership_end_date'] ?? NULL, 'start_date' => $value['membership_start_date'] ?? NULL, ]; - $membershipSource = CRM_Utils_Array::value('source', $value); + $membershipSource = $value['source'] ?? NULL; list($membership) = CRM_Member_BAO_Membership::processMembership( $value['contact_id'], $value['membership_type_id'], FALSE, //$numTerms should be default to 1. @@ -822,7 +822,7 @@ private function processMembership(&$params) { ]; foreach ($dateTypes as $dateField => $dateVariable) { $$dateVariable = CRM_Utils_Date::processDate($value[$dateField]); - $fDate[$dateField] = CRM_Utils_Array::value($dateField, $value); + $fDate[$dateField] = $value[$dateField] ?? NULL; } $calcDates = []; @@ -833,9 +833,9 @@ private function processMembership(&$params) { foreach ($calcDates as $memType => $calcDate) { foreach ($dates as $d) { //first give priority to form values then calDates. - $date = CRM_Utils_Array::value($d, $value); + $date = $value[$d] ?? NULL; if (!$date) { - $date = CRM_Utils_Array::value($d, $calcDate); + $date = $calcDate[$d] ?? NULL; } $value[$d] = CRM_Utils_Date::processDate($date); diff --git a/CRM/Campaign/BAO/Campaign.php b/CRM/Campaign/BAO/Campaign.php index 3446316570c2..4696f9e655f6 100644 --- a/CRM/Campaign/BAO/Campaign.php +++ b/CRM/Campaign/BAO/Campaign.php @@ -577,7 +577,7 @@ public static function addCampaign(&$form, $connectedCampaignId = NULL) { $campaignDetails = self::getPermissionedCampaigns($connectedCampaignId, NULL, TRUE, TRUE, $appendDates); $fields = ['campaigns', 'hasAccessCampaign', 'isCampaignEnabled']; foreach ($fields as $fld) { - $$fld = CRM_Utils_Array::value($fld, $campaignDetails); + $$fld = $campaignDetails[$fld] ?? NULL; } $showAddCampaign = FALSE; @@ -618,7 +618,7 @@ public static function addCampaignInComponentSearch(&$form, $elementName = 'camp $campaignDetails = self::getPermissionedCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE); $fields = ['campaigns', 'hasAccessCampaign', 'isCampaignEnabled']; foreach ($fields as $fld) { - $$fld = CRM_Utils_Array::value($fld, $campaignDetails); + $$fld = $campaignDetails[$fld] ?? NULL; } $showCampaignInSearch = FALSE; if ($isCampaignEnabled && $hasAccessCampaign && !empty($campaigns)) { diff --git a/CRM/Campaign/BAO/Query.php b/CRM/Campaign/BAO/Query.php index 8e3191cbcc5f..e70340cffbb4 100644 --- a/CRM/Campaign/BAO/Query.php +++ b/CRM/Campaign/BAO/Query.php @@ -440,8 +440,8 @@ public static function voterClause($params) { if (!is_array($params) || empty($params)) { return $voterClause; } - $surveyId = CRM_Utils_Array::value('campaign_survey_id', $params); - $searchVoterFor = CRM_Utils_Array::value('campaign_search_voter_for', $params); + $surveyId = $params['campaign_survey_id'] ?? NULL; + $searchVoterFor = $params['campaign_search_voter_for'] ?? NULL; //get the survey activities. $activityStatus = CRM_Core_PseudoConstant::activityStatus('name'); @@ -478,7 +478,7 @@ public static function voterClause($params) { ) { $voterIds = []; foreach ($voterActValues as $values) { - $numOfDays = CRM_Utils_Array::value($values['result'], $recontactInterval); + $numOfDays = $recontactInterval[$values['result']] ?? NULL; if ($numOfDays && $values['status_id'] == $completedStatusId ) { diff --git a/CRM/Campaign/Form/Gotv.php b/CRM/Campaign/Form/Gotv.php index bab464051f89..cea96a40baf3 100644 --- a/CRM/Campaign/Form/Gotv.php +++ b/CRM/Campaign/Form/Gotv.php @@ -35,7 +35,7 @@ class CRM_Campaign_Form_Gotv extends CRM_Core_Form { * Processing needed for buildForm and later. */ public function preProcess() { - $this->_search = CRM_Utils_Array::value('search', $_GET); + $this->_search = $_GET['search'] ?? NULL; $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this); $this->_interviewerId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); diff --git a/CRM/Campaign/Form/Petition/Signature.php b/CRM/Campaign/Form/Petition/Signature.php index 4e72b62cf9bc..97dfcea1c443 100644 --- a/CRM/Campaign/Form/Petition/Signature.php +++ b/CRM/Campaign/Form/Petition/Signature.php @@ -487,7 +487,7 @@ public function postProcess() { // create the signature activity record $params['contactId'] = $this->_contactId; - $params['activity_campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->petition); + $params['activity_campaign_id'] = $this->petition['campaign_id'] ?? NULL; $result = $this->bao->createSignature($params); // send thank you or email verification emails diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index ca86ffd86b55..66d744995c68 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -186,7 +186,7 @@ public function buildQuickForm() { 'release' => CRM_Campaign_Task::RELEASE, ); - $currentTaskValue = CRM_Utils_Array::value($this->_operation, $taskMapping); + $currentTaskValue = $taskMapping[$this->_operation] ?? NULL; $taskValue = array($currentTaskValue => $allTasks[$currentTaskValue]); if ($this->_operation == 'interview' && !empty($this->_formValues['campaign_survey_id'])) { $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE); @@ -288,7 +288,7 @@ public function postProcess() { } public function formatParams() { - $interviewerId = CRM_Utils_Array::value('survey_interviewer_id', $this->_formValues); + $interviewerId = $this->_formValues['survey_interviewer_id'] ?? NULL; if ($interviewerId) { $this->set('interviewerId', $interviewerId); } @@ -298,7 +298,7 @@ public function formatParams() { if ($this->_force) { continue; } - $paramValue = CRM_Utils_Array::value($param, $this->_formValues); + $paramValue = $this->_formValues[$param] ?? NULL; if ($paramValue && is_array($paramValue)) { unset($this->_formValues[$param]); foreach ($paramValue as $key => $value) { @@ -323,7 +323,7 @@ public function formatParams() { //allow voter search in sub-part of given constituents, //but make sure in case user does not select any group. //get all associated campaign groups in where filter, CRM-7406 - $groups = CRM_Utils_Array::value('group', $this->_formValues); + $groups = $this->_formValues['group'] ?? NULL; if ($campaignId && CRM_Utils_System::isNull($groups)) { $campGroups = CRM_Campaign_BAO_Campaign::getCampaignGroups($campaignId); foreach ($campGroups as $id => $title) { @@ -410,7 +410,7 @@ public function voterClause() { ); foreach ($clauseFields as $param => $key) { - $params[$key] = CRM_Utils_Array::value($key, $this->_formValues); + $params[$key] = $this->_formValues[$key] ?? NULL; if (!$params[$key]) { $params[$key] = $this->get($param); } diff --git a/CRM/Campaign/Form/Search/Campaign.php b/CRM/Campaign/Form/Search/Campaign.php index 1471311c5997..3b9928a63469 100644 --- a/CRM/Campaign/Form/Search/Campaign.php +++ b/CRM/Campaign/Form/Search/Campaign.php @@ -40,7 +40,7 @@ public function getDefaultEntity() { * Processing needed for buildForm and later. */ public function preProcess() { - $this->_search = CRM_Utils_Array::value('search', $_GET); + $this->_search = $_GET['search'] ?? NULL; $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE); $this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'campaign'); diff --git a/CRM/Campaign/Form/Search/Petition.php b/CRM/Campaign/Form/Search/Petition.php index ac753280739c..bf26cc626ba2 100644 --- a/CRM/Campaign/Form/Search/Petition.php +++ b/CRM/Campaign/Form/Search/Petition.php @@ -31,7 +31,7 @@ class CRM_Campaign_Form_Search_Petition extends CRM_Core_Form { * Processing needed for buildForm and later. */ public function preProcess() { - $this->_search = CRM_Utils_Array::value('search', $_GET); + $this->_search = $_GET['search'] ?? NULL; $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE); $this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'petition'); diff --git a/CRM/Campaign/Form/Search/Survey.php b/CRM/Campaign/Form/Search/Survey.php index be1664a1ea40..cdc54144da1c 100644 --- a/CRM/Campaign/Form/Search/Survey.php +++ b/CRM/Campaign/Form/Search/Survey.php @@ -31,7 +31,7 @@ class CRM_Campaign_Form_Search_Survey extends CRM_Core_Form { * Processing needed for buildForm and later. */ public function preProcess() { - $this->_search = CRM_Utils_Array::value('search', $_GET); + $this->_search = $_GET['search'] ?? NULL; $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE, FALSE); $this->_searchTab = CRM_Utils_Request::retrieve('type', 'String', $this, FALSE, 'survey'); diff --git a/CRM/Campaign/Form/Task.php b/CRM/Campaign/Form/Task.php index 4e93fc577e36..f59cc30ea60f 100644 --- a/CRM/Campaign/Form/Task.php +++ b/CRM/Campaign/Form/Task.php @@ -35,7 +35,7 @@ public function preProcess() { $this->_task = $values['task']; $campaignTasks = CRM_Campaign_Task::tasks(); - $taskName = CRM_Utils_Array::value($this->_task, $campaignTasks); + $taskName = $campaignTasks[$this->_task] ?? NULL; $this->assign('taskName', $taskName); $ids = []; diff --git a/CRM/Campaign/Form/Task/Interview.php b/CRM/Campaign/Form/Task/Interview.php index fb178f363601..19df2380e9e3 100644 --- a/CRM/Campaign/Form/Task/Interview.php +++ b/CRM/Campaign/Form/Task/Interview.php @@ -87,7 +87,7 @@ public function preProcess() { $buttonName = $this->controller->getButtonName(); $walkListActivityId = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'WalkList'); if ($buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) { - $orderByParams = CRM_Utils_Array::value('order_bys', $_POST); + $orderByParams = $_POST['order_bys'] ?? NULL; } elseif ($walkListActivityId == $this->_surveyDetails['activity_type_id']) { $orderByParams @@ -160,9 +160,9 @@ public function preProcess() { $activityIds = []; foreach ($this->_contactIds as $key => $voterId) { - $actVals = CRM_Utils_Array::value($voterId, $this->_surveyActivityIds); - $statusId = CRM_Utils_Array::value('status_id', $actVals); - $activityId = CRM_Utils_Array::value('activity_id', $actVals); + $actVals = $this->_surveyActivityIds[$voterId] ?? NULL; + $statusId = $actVals['status_id'] ?? NULL; + $activityId = $actVals['activity_id'] ?? NULL; if ($activityId && $statusId && $scheduledStatusId == $statusId @@ -233,7 +233,7 @@ public function preProcess() { } //set the title. - $this->_surveyTypeId = CRM_Utils_Array::value('activity_type_id', $this->_surveyValues); + $this->_surveyTypeId = $this->_surveyValues['activity_type_id'] ?? NULL; $surveyTypeLabel = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $this->_surveyTypeId); CRM_Utils_System::setTitle(ts('Record %1 Responses', [1 => $surveyTypeLabel])); } @@ -446,8 +446,8 @@ public function postProcess() { * @return mixed */ public static function registerInterview($params) { - $activityId = CRM_Utils_Array::value('activity_id', $params); - $surveyTypeId = CRM_Utils_Array::value('activity_type_id', $params); + $activityId = $params['activity_id'] ?? NULL; + $surveyTypeId = $params['activity_type_id'] ?? NULL; if (!is_array($params) || !$surveyTypeId || !$activityId) { return FALSE; } @@ -496,7 +496,7 @@ public static function registerInterview($params) { } } - $contactId = CRM_Utils_Array::value('voter_id', $params); + $contactId = $params['voter_id'] ?? NULL; if ($contactId && !empty($contactParams)) { CRM_Contact_BAO_Contact::createProfileContact($contactParams, $fields, $contactId); } @@ -516,7 +516,7 @@ public static function registerInterview($params) { } $subject = ''; - $surveyTitle = CRM_Utils_Array::value('surveyTitle', $params); + $surveyTitle = $params['surveyTitle'] ?? NULL; if ($surveyTitle) { $subject = $surveyTitle . ' - '; } diff --git a/CRM/Campaign/Form/Task/Reserve.php b/CRM/Campaign/Form/Task/Reserve.php index aebc1692c434..b0b814b6905a 100644 --- a/CRM/Campaign/Form/Task/Reserve.php +++ b/CRM/Campaign/Form/Task/Reserve.php @@ -104,7 +104,7 @@ public function preProcess() { public function validateSurvey() { $errorMsg = NULL; - $maxVoters = CRM_Utils_Array::value('max_number_of_contacts', $this->_surveyDetails); + $maxVoters = $this->_surveyDetails['max_number_of_contacts'] ?? NULL; if ($maxVoters) { if ($maxVoters <= $this->_numVoters) { $errorMsg = ts('The maximum number of contacts is already reserved for this interviewer.'); @@ -119,7 +119,7 @@ public function validateSurvey() { } } - $defaultNum = CRM_Utils_Array::value('default_number_of_contacts', $this->_surveyDetails); + $defaultNum = $this->_surveyDetails['default_number_of_contacts'] ?? NULL; if (!$errorMsg && $defaultNum && (count($this->_contactIds) > $defaultNum)) { $errorMsg = ts('You can reserve a maximum of %count contact at a time for this survey.', [ @@ -219,7 +219,7 @@ public static function formRule($fields, $files, $self) { public function postProcess() { //add reservation. $countVoters = 0; - $maxVoters = CRM_Utils_Array::value('max_number_of_contacts', $this->_surveyDetails); + $maxVoters = $this->_surveyDetails['max_number_of_contacts'] ?? NULL; $activityStatus = CRM_Core_PseudoConstant::activityStatus('name'); $statusHeld = array_search('Scheduled', $activityStatus); @@ -297,8 +297,8 @@ private function _addRespondentToGroup($contactIds) { $params = $this->controller->exportValues($this->_name); $groups = CRM_Utils_Array::value('groups', $params, []); - $newGroupName = CRM_Utils_Array::value('newGroupName', $params); - $newGroupDesc = CRM_Utils_Array::value('newGroupDesc', $params); + $newGroupName = $params['newGroupName'] ?? NULL; + $newGroupDesc = $params['newGroupDesc'] ?? NULL; $newGroupId = NULL; //create new group. @@ -317,7 +317,7 @@ private function _addRespondentToGroup($contactIds) { $existingGroups = CRM_Core_PseudoConstant::group(); foreach ($groups as $groupId) { $addCount = CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId); - $totalCount = CRM_Utils_Array::value(1, $addCount); + $totalCount = $addCount[1] ?? NULL; if ($groupId == $newGroupId) { $name = $newGroupName; $new = TRUE; diff --git a/CRM/Campaign/Page/AJAX.php b/CRM/Campaign/Page/AJAX.php index 45005703b596..79dcfff17af6 100644 --- a/CRM/Campaign/Page/AJAX.php +++ b/CRM/Campaign/Page/AJAX.php @@ -34,9 +34,9 @@ public static function registerInterview() { $params = []; foreach ($fields as $fld) { - $params[$fld] = CRM_Utils_Array::value($fld, $_POST); + $params[$fld] = $_POST[$fld] ?? NULL; } - $params['details'] = CRM_Utils_Array::value('note', $_POST); + $params['details'] = $_POST['note'] ?? NULL; $voterId = $params['voter_id']; $activityId = $params['activity_id']; @@ -145,7 +145,7 @@ public function voterList() { 'group', 'contact_type', ] as $param) { - $paramValue = CRM_Utils_Array::value($param, $params); + $paramValue = $params[$param] ?? NULL; if ($paramValue) { unset($params[$param]); $paramValue = explode(',', $paramValue); @@ -161,7 +161,7 @@ public function voterList() { 'survey_interviewer_id', 'campaign_search_voter_for', ] as $fld) { - $voterClauseParams[$fld] = CRM_Utils_Array::value($fld, $params); + $voterClauseParams[$fld] = $params[$fld] ?? NULL; } $interviewerId = $surveyTypeId = $surveyId = NULL; @@ -178,7 +178,7 @@ public function voterList() { //allow voter search in sub-part of given constituents, //but make sure in case user does not select any group. //get all associated campaign groups in where filter, CRM-7406 - $groups = CRM_Utils_Array::value('group', $params); + $groups = $params['group'] ?? NULL; if ($campaignId && CRM_Utils_System::isNull($groups)) { $campaignGroups = CRM_Campaign_BAO_Campaign::getCampaignGroups($campaignId); foreach ($campaignGroups as $id => $group) { @@ -392,7 +392,7 @@ public function processVoterData() { ]; $activityParams = []; foreach ($ids as $id) { - $val = CRM_Utils_Array::value($id, $_POST); + $val = $_POST[$id] ?? NULL; if (!$val) { $createActivity = FALSE; break; @@ -415,7 +415,7 @@ public function processVoterData() { $activityTypeId = $surveyValues['activity_type_id']; - $surveytitle = CRM_Utils_Array::value('surveyTitle', $_POST); + $surveytitle = $_POST['surveyTitle'] ?? NULL; if (!$surveytitle) { $surveytitle = $surveyValues['title']; } @@ -442,7 +442,7 @@ public function processVoterData() { [$scheduledStatusId] ); foreach ($activities as $voterId => $values) { - $activityId = CRM_Utils_Array::value('activity_id', $values); + $activityId = $values['activity_id'] ?? NULL; if ($activityId && ($values['status_id'] == $scheduledStatusId)) { CRM_Core_DAO::setFieldValue('CRM_Activity_DAO_Activity', $activityId, @@ -604,7 +604,7 @@ public static function campaignList() { } foreach ($campaigns as $campaignID => $values) { foreach ($selectorCols as $col) { - $searchRows[$campaignID][$col] = CRM_Utils_Array::value($col, $values); + $searchRows[$campaignID][$col] = $values[$col] ?? NULL; } } } @@ -709,7 +709,7 @@ public function surveyList() { } foreach ($surveys as $surveyID => $values) { foreach ($selectorCols as $col) { - $searchRows[$surveyID][$col] = CRM_Utils_Array::value($col, $values); + $searchRows[$surveyID][$col] = $values[$col] ?? NULL; } } } @@ -809,7 +809,7 @@ public function petitionList() { } foreach ($petitions as $petitionID => $values) { foreach ($selectorCols as $col) { - $searchRows[$petitionID][$col] = CRM_Utils_Array::value($col, $values); + $searchRows[$petitionID][$col] = $values[$col] ?? NULL; } } } diff --git a/CRM/Campaign/Page/DashBoard.php b/CRM/Campaign/Page/DashBoard.php index 9af9324cc507..1318dd1c576b 100644 --- a/CRM/Campaign/Page/DashBoard.php +++ b/CRM/Campaign/Page/DashBoard.php @@ -202,10 +202,10 @@ public static function getCampaignSummary($params = []) { ]; foreach ($campaigns as $cmpid => $campaign) { foreach ($properties as $prop) { - $campaignsData[$cmpid][$prop] = CRM_Utils_Array::value($prop, $campaign); + $campaignsData[$cmpid][$prop] = $campaign[$prop] ?? NULL; } - $statusId = CRM_Utils_Array::value('status_id', $campaign); - $campaignsData[$cmpid]['status'] = CRM_Utils_Array::value($statusId, $campaignStatus); + $statusId = $campaign['status_id'] ?? NULL; + $campaignsData[$cmpid]['status'] = $campaignStatus[$statusId] ?? NULL; $campaignsData[$cmpid]['campaign_id'] = $campaign['id']; $campaignsData[$cmpid]['campaign_type'] = $campaignType[$campaign['campaign_type_id']]; @@ -291,8 +291,8 @@ public static function getSurveySummary($params = []) { $surveyType = CRM_Campaign_BAO_Survey::getSurveyActivityType(); foreach ($surveys as $sid => $survey) { $surveysData[$sid] = $survey; - $campaignId = CRM_Utils_Array::value('campaign_id', $survey); - $surveysData[$sid]['campaign'] = CRM_Utils_Array::value($campaignId, $campaigns); + $campaignId = $survey['campaign_id'] ?? NULL; + $surveysData[$sid]['campaign'] = $campaigns[$campaignId] ?? NULL; $surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']]; if (!empty($survey['release_frequency'])) { $surveysData[$sid]['release_frequency'] = ts('1 Day', ['plural' => '%count Days', 'count' => $survey['release_frequency']]); @@ -397,8 +397,8 @@ public static function getPetitionSummary($params = []) { $petitionType = CRM_Campaign_BAO_Survey::getSurveyActivityType('label', TRUE); foreach ($petitions as $pid => $petition) { $petitionsData[$pid] = $petition; - $camapignId = CRM_Utils_Array::value('campaign_id', $petition); - $petitionsData[$pid]['campaign'] = CRM_Utils_Array::value($camapignId, $campaigns); + $camapignId = $petition['campaign_id'] ?? NULL; + $petitionsData[$pid]['campaign'] = $campaigns[$camapignId] ?? NULL; $petitionsData[$pid]['activity_type'] = $petitionType[$petition['activity_type_id']]; $action = array_sum(array_keys(self::petitionActionLinks())); diff --git a/CRM/Campaign/Selector/Search.php b/CRM/Campaign/Selector/Search.php index a0d3c096e860..73ae1cb41d7b 100644 --- a/CRM/Campaign/Selector/Search.php +++ b/CRM/Campaign/Selector/Search.php @@ -140,8 +140,8 @@ public function __construct( $this->_context = $context; $this->_campaignClause = $surveyClause; - $this->_campaignFromClause = CRM_Utils_Array::value('fromClause', $surveyClause); - $this->_campaignWhereClause = CRM_Utils_Array::value('whereClause', $surveyClause); + $this->_campaignFromClause = $surveyClause['fromClause'] ?? NULL; + $this->_campaignWhereClause = $surveyClause['whereClause'] ?? NULL; // type of selector $this->_action = $action; diff --git a/CRM/Campaign/StateMachine/Search.php b/CRM/Campaign/StateMachine/Search.php index 4b69cbc0368f..f69e47296827 100644 --- a/CRM/Campaign/StateMachine/Search.php +++ b/CRM/Campaign/StateMachine/Search.php @@ -67,7 +67,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) { */ public function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff - $value = CRM_Utils_Array::value('task', $_POST); + $value = $_POST['task'] ?? NULL; if (!isset($value)) { $value = $this->_controller->get('task'); } diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 1af50d3a0387..0d12748dfe33 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -602,15 +602,15 @@ public static function getCases($allCases = TRUE, $params = [], $context = 'dash $case['case_id'] ); $casesList[$key]['subject'] = $case['case_subject']; - $casesList[$key]['case_status'] = CRM_Utils_Array::value($case['case_status_id'], $caseStatuses); + $casesList[$key]['case_status'] = $caseStatuses[$case['case_status_id']] ?? NULL; if ($case['case_status_id'] == CRM_Case_PseudoConstant::getKey('CRM_Case_BAO_Case', 'case_status_id', 'Urgent')) { $casesList[$key]['case_status'] = sprintf('%s', strtoupper($casesList[$key]['case_status'])); } - $casesList[$key]['case_type'] = CRM_Utils_Array::value($case['case_type_id'], $caseTypeTitles); + $casesList[$key]['case_type'] = $caseTypeTitles[$case['case_type_id']] ?? NULL; $casesList[$key]['case_role'] = CRM_Utils_Array::value('case_role', $case, '---'); $casesList[$key]['manager'] = self::getCaseManagerContact($caseTypes[$case['case_type_id']], $case['case_id']); - $casesList[$key]['date'] = CRM_Utils_Array::value($case['activity_type_id'], $activityTypeLabels); + $casesList[$key]['date'] = $activityTypeLabels[$case['activity_type_id']] ?? NULL; if ($actId = CRM_Utils_Array::value('activity_id', $case)) { if (self::checkPermission($actId, 'view', $case['activity_type_id'], $userID)) { if ($type == 'recent') { @@ -951,7 +951,7 @@ public static function getCaseActivity($caseID, &$params, $contactID, $context = $groupBy = " GROUP BY ca.id, tcc.id, scc.id, acc.id, ov.value"; - $sortBy = CRM_Utils_Array::value('sortBy', $params); + $sortBy = $params['sortBy'] ?? NULL; if (!$sortBy) { // CRM-5081 - added id to act like creation date $orderBy = " @@ -962,8 +962,8 @@ public static function getCaseActivity($caseID, &$params, $contactID, $context = $orderBy = " ORDER BY $sortBy "; } - $page = CRM_Utils_Array::value('page', $params); - $rp = CRM_Utils_Array::value('rp', $params); + $page = $params['page'] ?? NULL; + $rp = $params['rp'] ?? NULL; if (!$page) { $page = 1; @@ -1198,7 +1198,7 @@ public static function getRelatedContacts($caseID, $includeDetails = TRUE) { ]; // Add more info about the role (creator, manager) // The XML historically has the reverse direction, so look up reverse. - $role = CRM_Utils_Array::value($dao->role_name_reverse, $caseRoles); + $role = $caseRoles[$dao->role_name_reverse] ?? NULL; if ($role) { unset($role['name']); $details += $role; @@ -1300,7 +1300,7 @@ public static function sendActivityCopy($clientId, $activityId, $contacts, $atta $tplParams['contact'] = $info; self::buildPermissionLinks($tplParams, $activityParams); - $displayName = CRM_Utils_Array::value('display_name', $info); + $displayName = $info['display_name'] ?? NULL; list($result[CRM_Utils_Array::value('contact_id', $info)], $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate( [ @@ -1417,11 +1417,11 @@ public static function getNextScheduledActivity($cases, $type = 'upcoming') { while ($res->fetch()) { if ($type == 'upcoming') { $activityInfo[$res->case_id]['date'] = $res->activity_date_time; - $activityInfo[$res->case_id]['type'] = CRM_Utils_Array::value($res->activity_type_id, $activityTypes); + $activityInfo[$res->case_id]['type'] = $activityTypes[$res->activity_type_id] ?? NULL; } else { $activityInfo[$res->case_id]['date'] = $res->activity_date_time; - $activityInfo[$res->case_id]['type'] = CRM_Utils_Array::value($res->activity_type_id, $activityTypes); + $activityInfo[$res->case_id]['type'] = $activityTypes[$res->activity_type_id] ?? NULL; } } @@ -2022,7 +2022,7 @@ public static function mergeCases( //for duplicate cases do not process singleton activities. $otherActivityIds = $singletonActivityIds = []; foreach ($otherCaseActivities as $caseActivityId => $otherIds) { - $otherActId = CRM_Utils_Array::value('activity_id', $otherIds); + $otherActId = $otherIds['activity_id'] ?? NULL; if (!$otherActId || in_array($otherActId, $otherActivityIds)) { continue; } @@ -2425,7 +2425,7 @@ public static function checkPermission($activityId, $operation, $actTypeId = NUL //check for core permission. $hasPermissions = []; - $checkPermissions = CRM_Utils_Array::value($operation, $permissions); + $checkPermissions = $permissions[$operation] ?? NULL; if (is_array($checkPermissions)) { foreach ($checkPermissions as $per) { if (CRM_Core_Permission::check($per)) { diff --git a/CRM/Case/BAO/CaseType.php b/CRM/Case/BAO/CaseType.php index a65deb470bdf..9937c5627257 100644 --- a/CRM/Case/BAO/CaseType.php +++ b/CRM/Case/BAO/CaseType.php @@ -45,7 +45,7 @@ public static function add(&$params) { $caseTypeDAO = new CRM_Case_DAO_CaseType(); // form the name only if missing: CRM-627 - $nameParam = CRM_Utils_Array::value('name', $params, NULL); + $nameParam = $params['name'] ?? NULL; if (!$nameParam && empty($params['id'])) { $params['name'] = CRM_Utils_String::titleToVar($params['title']); } diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index 219fa7dc057d..293d179aa9ef 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -616,7 +616,7 @@ public function postProcess($params = NULL) { if (isset($id) && array_key_exists($id, $this->_relatedContacts) && isset($this->_relatedContacts[$id]['email'])) { //if email already exists in array then append with ', ' another role only otherwise add it to array. if ($contactDetails = CRM_Utils_Array::value($this->_relatedContacts[$id]['email'], $mailToContacts)) { - $caseRole = CRM_Utils_Array::value('role', $this->_relatedContacts[$id]); + $caseRole = $this->_relatedContacts[$id]['role'] ?? NULL; $mailToContacts[$this->_relatedContacts[$id]['email']]['role'] = $contactDetails['role'] . ', ' . $caseRole; } else { diff --git a/CRM/Case/Form/Activity/ChangeCaseStatus.php b/CRM/Case/Form/Activity/ChangeCaseStatus.php index 9c985a2257dd..4acf0cf93f3e 100644 --- a/CRM/Case/Form/Activity/ChangeCaseStatus.php +++ b/CRM/Case/Form/Activity/ChangeCaseStatus.php @@ -127,7 +127,7 @@ public static function formRule($values, $files, $form) { * @param array $params */ public static function beginPostProcess(&$form, &$params) { - $params['id'] = CRM_Utils_Array::value('case_id', $params); + $params['id'] = $params['case_id'] ?? NULL; if (CRM_Utils_Array::value('updateLinkedCases', $params) === '1') { $caseID = CRM_Utils_Array::first($form->_caseId); diff --git a/CRM/Case/Form/Activity/LinkCases.php b/CRM/Case/Form/Activity/LinkCases.php index 3e39759d57af..d8c9ea4fe3eb 100644 --- a/CRM/Case/Form/Activity/LinkCases.php +++ b/CRM/Case/Form/Activity/LinkCases.php @@ -98,7 +98,7 @@ public static function buildQuickForm(&$form) { public static function formRule($values, $files, $form) { $errors = []; - $linkCaseId = CRM_Utils_Array::value('link_to_case_id', $values); + $linkCaseId = $values['link_to_case_id'] ?? NULL; assert('is_numeric($linkCaseId)'); if ($linkCaseId == CRM_Utils_Array::first($form->_caseId)) { $errors['link_to_case'] = ts('Please select some other case to link.'); @@ -133,7 +133,7 @@ public static function beginPostProcess(&$form, &$params) { */ public static function endPostProcess(&$form, &$params, &$activity) { $activityId = $activity->id; - $linkCaseID = CRM_Utils_Array::value('link_to_case_id', $params); + $linkCaseID = $params['link_to_case_id'] ?? NULL; //create a link between two cases. if ($activityId && $linkCaseID) { diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index ae9405cc1e32..6c5f82aaaa48 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -212,7 +212,7 @@ public static function beginPostProcess(&$form, &$params) { } // rename activity_location param to the correct column name for activity DAO - $params['location'] = CRM_Utils_Array::value('activity_location', $params); + $params['location'] = $params['activity_location'] ?? NULL; // Add attachments CRM_Core_BAO_File::formatAttachment( diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index 89283b99131d..a6a244219fea 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -29,7 +29,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { * Set variables up before form is built. */ public function preProcess() { - $this->_showRelatedCases = CRM_Utils_Array::value('relatedCases', $_GET); + $this->_showRelatedCases = $_GET['relatedCases'] ?? NULL; $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process(); $isMultiClient = $xmlProcessorProcess->getAllowMultipleCaseClients(); @@ -470,7 +470,7 @@ public static function activityForm($form, $aTypes = []) { $allCaseActTypes = CRM_Case_PseudoConstant::caseActivityType(); foreach ($allCaseActTypes as $typeDetails) { if (!in_array($typeDetails['name'], ['Open Case'])) { - $aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails); + $aTypesFilter[$typeDetails['id']] = $typeDetails['label'] ?? NULL; } } $aTypesFilter = $aTypesFilter + $aTypes; diff --git a/CRM/Case/Form/Task/Batch.php b/CRM/Case/Form/Task/Batch.php index 702e0971f02e..ed0d9e050cdd 100644 --- a/CRM/Case/Form/Task/Batch.php +++ b/CRM/Case/Form/Task/Batch.php @@ -60,7 +60,7 @@ public function postProcess() { // Get the case status $daoClass = 'CRM_Case_DAO_Case'; - $caseStatus = CRM_Utils_Array::value('case_status', $value); + $caseStatus = $value['case_status'] ?? NULL; if (!$caseStatus) { // default to existing status ID $caseStatus = CRM_Core_DAO::getFieldValue($daoClass, $key, 'status_id'); diff --git a/CRM/Case/StateMachine/Search.php b/CRM/Case/StateMachine/Search.php index 327fb746dce5..a89c2c6a3674 100644 --- a/CRM/Case/StateMachine/Search.php +++ b/CRM/Case/StateMachine/Search.php @@ -69,7 +69,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) { */ public function taskName($controller, $formName = 'Search') { // total hack, check POST vars and then session to determine stuff - $value = CRM_Utils_Array::value('task', $_POST); + $value = $_POST['task'] ?? NULL; if (!isset($value)) { $value = $this->_controller->get('task'); } diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index 066f01f02691..90e1adeb5010 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -81,8 +81,8 @@ public function get($caseType, $fieldSet, $isLabel = FALSE, $maskAction = FALSE) * @throws Exception */ public function process($xml, &$params) { - $standardTimeline = CRM_Utils_Array::value('standardTimeline', $params); - $activitySetName = CRM_Utils_Array::value('activitySetName', $params); + $standardTimeline = $params['standardTimeline'] ?? NULL; + $activitySetName = $params['activitySetName'] ?? NULL; if ('Open Case' == CRM_Utils_Array::value('activityTypeName', $params)) { // create relationships for the ones that are required @@ -269,7 +269,7 @@ public function activityTypes($activityTypesXML, $maxInst = FALSE, $isLabel = FA foreach ($activityTypeXML as $recordXML) { $activityTypeName = (string ) $recordXML->name; $maxInstances = (string ) $recordXML->max_instances; - $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes); + $activityTypeInfo = $activityTypes[$activityTypeName] ?? NULL; if ($activityTypeInfo['id']) { if ($maskAction) { @@ -415,7 +415,7 @@ public function isActivityPresent(&$params) { public function createActivity($activityTypeXML, &$params) { $activityTypeName = (string) $activityTypeXML->name; $activityTypes = &$this->allActivityTypes(TRUE, TRUE); - $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $activityTypes); + $activityTypeInfo = $activityTypes[$activityTypeName] ?? NULL; if (!$activityTypeInfo) { $docLink = CRM_Utils_System::docURL2("user/case-management/set-up"); @@ -503,7 +503,7 @@ public function createActivity($activityTypeXML, &$params) { $activityDate = $params['activity_date_time']; } else { - $referenceActivityInfo = CRM_Utils_Array::value($referenceActivityName, $activityTypes); + $referenceActivityInfo = $activityTypes[$referenceActivityName] ?? NULL; if ($referenceActivityInfo['id']) { $caseActivityParams = ['activity_type_id' => $referenceActivityInfo['id']]; @@ -516,7 +516,7 @@ public function createActivity($activityTypeXML, &$params) { if (is_array($referenceActivity)) { foreach ($referenceActivity as $aId => $details) { - $activityDate = CRM_Utils_Array::value('activity_date', $details); + $activityDate = $details['activity_date'] ?? NULL; break; } } diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index 453f39ecf965..20ab7a2a650e 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -116,7 +116,7 @@ public function getActivityTypes($xml, $activitySetName) { foreach ($activitySetXML->ActivityTypes as $activityTypesXML) { foreach ($activityTypesXML as $activityTypeXML) { $activityTypeName = (string ) $activityTypeXML->name; - $activityTypeInfo = CRM_Utils_Array::value($activityTypeName, $allActivityTypes); + $activityTypeInfo = $allActivityTypes[$activityTypeName] ?? NULL; if ($activityTypeInfo) { $activityTypes[$activityTypeInfo['id']] = $activityTypeInfo; } @@ -743,7 +743,7 @@ public static function populateCaseReportTemplate($clientID, $caseID, $activityS $xml = $form->retrieve($case['caseTypeName']); $activitySetNames = CRM_Case_XMLProcessor_Process::activitySets($xml->ActivitySets); - $pageTitle = CRM_Utils_Array::value($activitySetName, $activitySetNames); + $pageTitle = $activitySetNames[$activitySetName] ?? NULL; $template->assign('pageTitle', $pageTitle); if ($activitySetName) { diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 50eb6d391462..4f973287651c 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -105,7 +105,7 @@ public function __construct() { */ public static function add(&$params) { $contact = new CRM_Contact_DAO_Contact(); - $contactID = CRM_Utils_Array::value('contact_id', $params); + $contactID = $params['contact_id'] ?? NULL; if (empty($params)) { return NULL; } @@ -164,7 +164,7 @@ public static function add(&$params) { $contact->sort_name = substr($contact->sort_name, 0, 128); } - $privacy = CRM_Utils_Array::value('privacy', $params); + $privacy = $params['privacy'] ?? NULL; if ($privacy && is_array($privacy) && !empty($privacy) @@ -199,7 +199,7 @@ public static function add(&$params) { if ($contact->contact_type === 'Individual' && (isset($params['current_employer']) || isset($params['employer_id']))) { // Create current employer. - $newEmployer = !empty($params['employer_id']) ? $params['employer_id'] : CRM_Utils_Array::value('current_employer', $params); + $newEmployer = !empty($params['employer_id']) ? $params['employer_id'] : $params['current_employer'] ?? NULL; $newContact = FALSE; if (empty($params['contact_id'])) { @@ -433,7 +433,7 @@ public static function unsetProtectedFields(&$contacts) { $currentUser = CRM_Core_Session::getLoggedInContactID(); $editOwn = $currentUser && CRM_Core_Permission::check('edit own api keys'); foreach ($contacts as &$contact) { - $cid = is_object($contact) ? $contact->id : CRM_Utils_Array::value('id', $contact); + $cid = is_object($contact) ? $contact->id : $contact['id'] ?? NULL; if (!($editOwn && $cid == $currentUser)) { if (is_object($contact)) { unset($contact->api_key); @@ -1602,7 +1602,7 @@ public static function &exportableFields($contactType = 'Individual', $status = //Sorting fields in alphabetical order(CRM-1507) foreach ($fields as $k => $v) { - $sortArray[$k] = CRM_Utils_Array::value('title', $v); + $sortArray[$k] = $v['title'] ?? NULL; } $fields = array_merge($sortArray, $fields); @@ -1740,7 +1740,7 @@ public static function &makeHierReturnProperties($fields, $contactId = NULL) { $locationTypeName = 1; } else { - $locationTypeName = CRM_Utils_Array::value($id, $locationTypes); + $locationTypeName = $locationTypes[$id] ?? NULL; if (!$locationTypeName) { continue; } @@ -1806,7 +1806,7 @@ public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = $blocks = CRM_Core_BAO_Location::getValues($entityBlock); foreach ($blocks[$block] as $key => $value) { if (!empty($value['is_primary'])) { - $locationType = CRM_Utils_Array::value('location_type_id', $value); + $locationType = $value['location_type_id'] ?? NULL; } } } @@ -2048,8 +2048,8 @@ public static function formatProfileContactParams( $details = self::getHierContactDetails($contactID, $fields); $contactDetails = $details[$contactID]; - $data['contact_type'] = CRM_Utils_Array::value('contact_type', $contactDetails); - $data['contact_sub_type'] = CRM_Utils_Array::value('contact_sub_type', $contactDetails); + $data['contact_type'] = $contactDetails['contact_type'] ?? NULL; + $data['contact_sub_type'] = $contactDetails['contact_sub_type'] ?? NULL; } else { //we should get contact type only if contact @@ -2098,10 +2098,10 @@ public static function formatProfileContactParams( } if ($ctype == 'Organization') { - $data['organization_name'] = CRM_Utils_Array::value('organization_name', $contactDetails); + $data['organization_name'] = $contactDetails['organization_name'] ?? NULL; } elseif ($ctype == 'Household') { - $data['household_name'] = CRM_Utils_Array::value('household_name', $contactDetails); + $data['household_name'] = $contactDetails['household_name'] ?? NULL; } $locationType = []; @@ -2598,7 +2598,7 @@ public static function getValues(&$params, &$values) { CRM_Core_OptionGroup::lookupValues($temp, $names, FALSE); $values['preferred_communication_method'] = $preffComm; - $values['preferred_communication_method_display'] = CRM_Utils_Array::value('preferred_communication_method_display', $temp); + $values['preferred_communication_method_display'] = $temp['preferred_communication_method_display'] ?? NULL; if ($contact->preferred_mail_format) { $preferredMailingFormat = CRM_Core_SelectValues::pmf(); @@ -2615,8 +2615,8 @@ public static function getValues(&$params, &$values) { $birthDate = CRM_Utils_Date::customFormat($contact->birth_date, '%Y%m%d'); if ($birthDate < date('Ymd')) { $age = CRM_Utils_Date::calculateAge($birthDate); - $values['age']['y'] = CRM_Utils_Array::value('years', $age); - $values['age']['m'] = CRM_Utils_Array::value('months', $age); + $values['age']['y'] = $age['years'] ?? NULL; + $values['age']['m'] = $age['months'] ?? NULL; } } @@ -3246,7 +3246,7 @@ public static function contextMenu($contactId = NULL) { * TRUE if user has all permissions, FALSE if otherwise. */ public static function checkUserMenuPermissions($aclPermissionedTasks, $corePermission, $menuOptions) { - $componentName = CRM_Utils_Array::value('component', $menuOptions); + $componentName = $menuOptions['component'] ?? NULL; // if component action - make sure component is enable. if ($componentName && !in_array($componentName, CRM_Core_Config::singleton()->enableComponents)) { @@ -3256,7 +3256,7 @@ public static function checkUserMenuPermissions($aclPermissionedTasks, $corePerm // make sure user has all required permissions. $hasAllPermissions = FALSE; - $permissions = CRM_Utils_Array::value('permissions', $menuOptions); + $permissions = $menuOptions['permissions'] ?? NULL; if (!is_array($permissions) || empty($permissions)) { $hasAllPermissions = TRUE; } diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 2e43667b7325..c72691a78a04 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -63,7 +63,7 @@ public static function getImage($contactType, $urlOnly = FALSE, $contactId = NUL $type = CRM_Contact_BAO_ContactType::getBasicType($typeInfo['name']) . '-subtype'; } else { - $type = CRM_Utils_Array::value('name', $typeInfo); + $type = $typeInfo['name'] ?? NULL; } // do not add title since it hides contact name @@ -209,9 +209,9 @@ public static function validChecksum($contactID, $inputCheck) { $input = CRM_Utils_System::explode('_', $inputCheck, 3); - $inputCS = CRM_Utils_Array::value(0, $input); - $inputTS = CRM_Utils_Array::value(1, $input); - $inputLF = CRM_Utils_Array::value(2, $input); + $inputCS = $input[0] ?? NULL; + $inputTS = $input[1] ?? NULL; + $inputLF = $input[2] ?? NULL; $check = self::generateChecksum($contactID, $inputTS, $inputLF); // Joomla_11 - If $inputcheck is null without explicitly casting to a string @@ -584,7 +584,7 @@ public static function formatContactIDSToLinks($contactIDs, $addViewLink = TRUE, $contactLinks['rows'][$i]['primary_email'] = $dao->email; // get the permission for current contact id. - $hasPermissions = CRM_Utils_Array::value($dao->id, $permissionedContactIds); + $hasPermissions = $permissionedContactIds[$dao->id] ?? NULL; if (!is_array($hasPermissions) || empty($hasPermissions)) { $i++; continue; @@ -799,7 +799,7 @@ public static function processSharedAddress(&$address) { // 3. get the address details for master_id $masterAddress = new CRM_Core_BAO_Address(); - $masterAddress->id = CRM_Utils_Array::value('master_id', $values); + $masterAddress->id = $values['master_id'] ?? NULL; $masterAddress->find(TRUE); // 4. CRM-10336: Empty all fields (execept the fields to skip) @@ -893,9 +893,9 @@ public static function clearContactCaches($isEmptyPrevNextTable = FALSE) { public static function updateGreeting($params) { $contactType = $params['ct']; $greeting = $params['gt']; - $valueID = $id = CRM_Utils_Array::value('id', $params); - $force = CRM_Utils_Array::value('force', $params); - $limit = CRM_Utils_Array::value('limit', $params); + $valueID = $id = $params['id'] ?? NULL; + $force = $params['force'] ?? NULL; + $limit = $params['limit'] ?? NULL; // if valueID is not passed use default value if (!$valueID) { @@ -908,14 +908,14 @@ public static function updateGreeting($params) { ]; $allGreetings = CRM_Core_PseudoConstant::greeting($filter); - $originalGreetingString = $greetingString = CRM_Utils_Array::value($valueID, $allGreetings); + $originalGreetingString = $greetingString = $allGreetings[$valueID] ?? NULL; if (!$greetingString) { throw new CRM_Core_Exception(ts('Incorrect greeting value id %1, or no default greeting for this contact type and greeting type.', [1 => $valueID])); } // build return properties based on tokens $greetingTokens = CRM_Utils_Token::getTokens($greetingString); - $tokens = CRM_Utils_Array::value('contact', $greetingTokens); + $tokens = $greetingTokens['contact'] ?? NULL; $greetingsReturnProperties = []; if (is_array($tokens)) { $greetingsReturnProperties = array_fill_keys(array_values($tokens), 1); diff --git a/CRM/Contact/BAO/ContactType.php b/CRM/Contact/BAO/ContactType.php index 69b774299b17..c79a77c14821 100644 --- a/CRM/Contact/BAO/ContactType.php +++ b/CRM/Contact/BAO/ContactType.php @@ -515,7 +515,7 @@ public static function getCreateNewList() { foreach ($contactTypes as $key => $value) { if ($key) { $typeValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $key); - $cType = CRM_Utils_Array::value('0', $typeValue); + $cType = $typeValue['0'] ?? NULL; $typeUrl = 'ct=' . $cType; if ($csType = CRM_Utils_Array::value('1', $typeValue)) { $typeUrl .= "&cst=$csType"; @@ -612,7 +612,7 @@ public static function add(&$params) { $contactType = new CRM_Contact_DAO_ContactType(); $contactType->copyValues($params); - $contactType->id = CRM_Utils_Array::value('id', $params); + $contactType->id = $params['id'] ?? NULL; $contactType->is_active = CRM_Utils_Array::value('is_active', $params, 0); $contactType->save(); diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 0dd64ed62eeb..ec214b814201 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -364,7 +364,7 @@ public static function create(&$params) { } } // form the name only if missing: CRM-627 - $nameParam = CRM_Utils_Array::value('name', $params, NULL); + $nameParam = $params['name'] ?? NULL; if (!$nameParam && empty($params['id'])) { $params['name'] = CRM_Utils_String::titleToVar($params['title']); } @@ -645,7 +645,7 @@ public function __toString() { * ( smartGroupId, ssId ) smart group id and saved search id */ public static function createHiddenSmartGroup($params) { - $ssId = CRM_Utils_Array::value('saved_search_id', $params); + $ssId = $params['saved_search_id'] ?? NULL; //add mapping record only for search builder saved search $mappingId = NULL; @@ -677,7 +677,7 @@ public static function createHiddenSmartGroup($params) { $formValues = $params['search_context'] === 'builder' ? $params['form_values'] : CRM_Contact_BAO_Query::convertFormValues($params['form_values']); $savedSearch->form_values = serialize($formValues); $savedSearch->mapping_id = $mappingId; - $savedSearch->search_custom_id = CRM_Utils_Array::value('search_custom_id', $params); + $savedSearch->search_custom_id = $params['search_custom_id'] ?? NULL; $savedSearch->save(); $ssId = $savedSearch->id; @@ -735,7 +735,7 @@ public static function getGroupListSelector(&$params) { // format the params $params['offset'] = ($params['page'] - 1) * $params['rp']; $params['rowCount'] = $params['rp']; - $params['sort'] = CRM_Utils_Array::value('sortBy', $params); + $params['sort'] = $params['sortBy'] ?? NULL; // get groups $groups = CRM_Contact_BAO_Group::getGroupList($params); @@ -781,7 +781,7 @@ public static function getGroupListSelector(&$params) { $group['DT_RowAttr']['data-id'] = $value['id']; $group['DT_RowAttr']['data-entity'] = 'group'; - $group['description'] = CRM_Utils_Array::value('description', $value); + $group['description'] = $value['description'] ?? NULL; if (!empty($value['group_type'])) { $group['group_type'] = $value['group_type']; @@ -792,8 +792,8 @@ public static function getGroupListSelector(&$params) { $group['visibility'] = $value['visibility']; $group['links'] = $value['action']; - $group['org_info'] = CRM_Utils_Array::value('org_info', $value); - $group['created_by'] = CRM_Utils_Array::value('created_by', $value); + $group['org_info'] = $value['org_info'] ?? NULL; + $group['created_by'] = $value['created_by'] ?? NULL; $group['is_parent'] = $value['is_parent']; @@ -942,7 +942,7 @@ public static function getGroupList(&$params) { ); $types = []; foreach ($groupTypes as $type) { - $types[] = CRM_Utils_Array::value($type, $allTypes); + $types[] = $allTypes[$type] ?? NULL; } $values[$object->id]['group_type'] = implode(', ', $types); } @@ -1167,7 +1167,7 @@ public static function getGroupCount(&$params) { */ public static function whereClause(&$params, $sortBy = TRUE, $excludeHidden = TRUE) { $values = []; - $title = CRM_Utils_Array::value('title', $params); + $title = $params['title'] ?? NULL; if ($title) { $clauses[] = "`groups`.title LIKE %1"; if (strpos($title, '%') !== FALSE) { @@ -1178,7 +1178,7 @@ public static function whereClause(&$params, $sortBy = TRUE, $excludeHidden = TR } } - $groupType = CRM_Utils_Array::value('group_type', $params); + $groupType = $params['group_type'] ?? NULL; if ($groupType) { $types = explode(',', $groupType); if (!empty($types)) { @@ -1188,13 +1188,13 @@ public static function whereClause(&$params, $sortBy = TRUE, $excludeHidden = TR } } - $visibility = CRM_Utils_Array::value('visibility', $params); + $visibility = $params['visibility'] ?? NULL; if ($visibility) { $clauses[] = '`groups`.visibility = %3'; $params[3] = [$visibility, 'String']; } - $groupStatus = CRM_Utils_Array::value('status', $params); + $groupStatus = $params['status'] ?? NULL; if ($groupStatus) { switch ($groupStatus) { case 1: @@ -1213,13 +1213,13 @@ public static function whereClause(&$params, $sortBy = TRUE, $excludeHidden = TR } } - $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params); + $parentsOnly = $params['parentsOnly'] ?? NULL; if ($parentsOnly) { $clauses[] = '`groups`.parents IS NULL'; } // only show child groups of a specific parent group - $parent_id = CRM_Utils_Array::value('parent_id', $params); + $parent_id = $params['parent_id'] ?? NULL; if ($parent_id) { $clauses[] = '`groups`.id IN (SELECT child_group_id FROM civicrm_group_nesting WHERE parent_group_id = %5)'; $params[5] = [$parent_id, 'Integer']; diff --git a/CRM/Contact/BAO/Individual.php b/CRM/Contact/BAO/Individual.php index f19325b3b26f..679e9229f50f 100644 --- a/CRM/Contact/BAO/Individual.php +++ b/CRM/Contact/BAO/Individual.php @@ -225,7 +225,7 @@ public static function format(&$params, &$contact) { } } } - $uniqId = CRM_Utils_Array::value('user_unique_id', $params); + $uniqId = $params['user_unique_id'] ?? NULL; if (!$email && $contact->id) { $email = CRM_Contact_BAO_Contact::getPrimaryEmail($contact->id); } diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 9be1b0f2075d..fce0081f3930 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1118,7 +1118,7 @@ public function addHierarchicalElements() { $elementType = '-' . $elementType; } - $field = CRM_Utils_Array::value($elementName, $this->_fields); + $field = $this->_fields[$elementName] ?? NULL; // hack for profile, add location id if (!$field) { @@ -1127,28 +1127,28 @@ public function addHierarchicalElements() { !is_numeric($elementType) ) { if (is_numeric($name)) { - $field = CRM_Utils_Array::value($elementName . "-Primary$elementType", $this->_fields); + $field = $this->_fields[$elementName . "-Primary$elementType"] ?? NULL; } else { - $field = CRM_Utils_Array::value($elementName . "-$locationTypeId$elementType", $this->_fields); + $field = $this->_fields[$elementName . "-$locationTypeId$elementType"] ?? NULL; } } elseif (is_numeric($name)) { //this for phone type to work if (in_array($elementName, ['phone', 'phone_ext'])) { - $field = CRM_Utils_Array::value($elementName . "-Primary" . $elementType, $this->_fields); + $field = $this->_fields[$elementName . "-Primary" . $elementType] ?? NULL; } else { - $field = CRM_Utils_Array::value($elementName . "-Primary", $this->_fields); + $field = $this->_fields[$elementName . "-Primary"] ?? NULL; } } else { //this is for phone type to work for profile edit if (in_array($elementName, ['phone', 'phone_ext'])) { - $field = CRM_Utils_Array::value($elementName . "-$locationTypeId$elementType", $this->_fields); + $field = $this->_fields[$elementName . "-$locationTypeId$elementType"] ?? NULL; } else { - $field = CRM_Utils_Array::value($elementName . "-$locationTypeId", $this->_fields); + $field = $this->_fields[$elementName . "-$locationTypeId"] ?? NULL; } } } @@ -2040,7 +2040,7 @@ public function whereClause($isForcePrimaryEmailOnly = NULL) { // check for both id and contact_id if ($this->_params[$id][0] == 'id' || $this->_params[$id][0] == 'contact_id') { $this->_where[0][] = self::buildClause("contact_a.id", $this->_params[$id][1], $this->_params[$id][2]); - $field = CRM_Utils_Array::value('id', $this->_fields); + $field = $this->_fields['id'] ?? NULL; list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue( 'CRM_Contact_BAO_Contact', "contact_a.id", @@ -2108,11 +2108,11 @@ public function whereClause($isForcePrimaryEmailOnly = NULL) { * @throws Exception */ public function restWhere(&$values) { - $name = CRM_Utils_Array::value(0, $values); - $op = CRM_Utils_Array::value(1, $values); - $value = CRM_Utils_Array::value(2, $values); - $grouping = CRM_Utils_Array::value(3, $values); - $wildcard = CRM_Utils_Array::value(4, $values); + $name = $values[0] ?? NULL; + $op = $values[1] ?? NULL; + $value = $values[2] ?? NULL; + $grouping = $values[3] ?? NULL; + $wildcard = $values[4] ?? NULL; if (isset($grouping) && empty($this->_where[$grouping])) { $this->_where[$grouping] = []; @@ -2131,10 +2131,10 @@ public function restWhere(&$values) { } } - $field = CRM_Utils_Array::value($name, $this->_fields); + $field = $this->_fields[$name] ?? NULL; if (!$field) { - $field = CRM_Utils_Array::value($locType[0], $this->_fields); + $field = $this->_fields[$locType[0]] ?? NULL; if (!$field) { // Strip any trailing _high & _low that might be appended. @@ -2893,7 +2893,7 @@ public function contactType(&$values) { else { $contactTypeANDSubType = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value, 2); $contactType = $contactTypeANDSubType[0]; - $subType = CRM_Utils_Array::value(1, $contactTypeANDSubType); + $subType = $contactTypeANDSubType[1] ?? NULL; if (!empty($subType)) { $subTypes[$subType] = 1; } @@ -3902,7 +3902,7 @@ public function county(&$values, $status = NULL) { $county = CRM_Core_PseudoConstant::county(); foreach ($value as $id) { - $names[] = CRM_Utils_Array::value($id, $county); + $names[] = $county[$id] ?? NULL; } } else { @@ -4058,7 +4058,7 @@ public function privacy(&$values) { else { $this->_where[$grouping][] = "contact_a.{$name} $op $value"; } - $field = CRM_Utils_Array::value($name, $this->_fields); + $field = $this->_fields[$name] ?? NULL; $op = CRM_Utils_Array::value($op, CRM_Core_SelectValues::getSearchBuilderOperators(), $op); $title = $field ? $field['title'] : $name; $this->_qill[$grouping][] = "$title $op $value"; @@ -4096,7 +4096,7 @@ public function privacyOptions($values) { $qill = []; foreach ($value as $dontCare => $pOption) { $clauses[] = " ( contact_a.{$pOption} = 1 ) "; - $field = CRM_Utils_Array::value($pOption, $this->_fields); + $field = $this->_fields[$pOption] ?? NULL; $title = $field ? $field['title'] : $pOption; $qill[] = " $title = 1 "; } @@ -4255,7 +4255,7 @@ public function relationship(&$values) { if (!empty($relQill)) { $relQill .= ' OR '; } - $relQill .= CRM_Utils_Array::value($rel, $allRelationshipType); + $relQill .= $allRelationshipType[$rel] ?? NULL; } $this->_qill[$grouping][] = 'Relationship Type(s) ' . $relQill . " ( " . implode(", ", $qillNames) . " )"; } @@ -4732,8 +4732,8 @@ protected static function convertCustomRelativeFields(&$formValues, &$params, $v return; } - $from = CRM_Utils_Array::value($customFieldName . '_from', $formValues, NULL); - $to = CRM_Utils_Array::value($customFieldName . '_to', $formValues, NULL); + $from = $formValues[$customFieldName . '_from'] ?? NULL; + $to = $formValues[$customFieldName . '_to'] ?? NULL; if (self::isCustomDateField($customFieldName)) { list($from, $to) = CRM_Utils_Date::getFromTo(NULL, $from, $to); @@ -6024,7 +6024,7 @@ public function convertToPseudoNames(&$dao, $return = FALSE, $usedForAPI = FALSE } $dao->$key = ($usedForAPI) ? $convertedValues : implode(', ', $convertedValues); - $realFieldName = CRM_Utils_Array::value('field_name', $this->_pseudoConstantsSelect[$key]); + $realFieldName = $this->_pseudoConstantsSelect[$key]['field_name'] ?? NULL; if ($usedForAPI && $realFieldName) { // normally we would see 2 fields returned for pseudoConstants. An exception is // preferred_communication_method where there is no id-variant. @@ -6316,7 +6316,7 @@ public static function processSpecialFormValue(&$formValues, $specialFields, $ch $nullableFields = ['contribution_batch_id']; foreach ($specialFields as $element) { - $value = CRM_Utils_Array::value($element, $formValues); + $value = $formValues[$element] ?? NULL; if ($value) { if (is_array($value)) { if (in_array($element, array_keys($changeNames))) { @@ -6809,9 +6809,9 @@ public function getSearchSQLParts($offset = 0, $rowCount = 0, $sort = NULL, // if we’re explicitly looking for a certain contact’s contribs, events, etc. // and that contact happens to be deleted, set $onlyDeleted to true foreach ($this->_params as $values) { - $name = CRM_Utils_Array::value(0, $values); - $op = CRM_Utils_Array::value(1, $values); - $value = CRM_Utils_Array::value(2, $values); + $name = $values[0] ?? NULL; + $op = $values[1] ?? NULL; + $value = $values[2] ?? NULL; if ($name == 'contact_id' and $op == '=') { if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $value, 'is_deleted')) { $onlyDeleted = TRUE; @@ -6953,7 +6953,7 @@ public function getMetadataForRealField($fieldName) { protected function addPseudoconstantFieldToSelect($name) { $field = $this->getMetadataForRealField($name); $realFieldName = $field['name']; - $pseudoFieldName = CRM_Utils_Array::value('pseudofield_name', $field); + $pseudoFieldName = $field['pseudofield_name'] ?? NULL; if ($pseudoFieldName) { // @todo - we don't really need to build this array now we have metadata more available with getMetadataForField fn. $this->_pseudoConstantsSelect[$pseudoFieldName] = [ @@ -7054,7 +7054,7 @@ protected function isADateRangeField($fieldName) { * @param $values */ protected function buildRelativeDateQuery(&$values) { - $value = CRM_Utils_Array::value(2, $values); + $value = $values[2] ?? NULL; if (empty($value)) { return; } @@ -7062,7 +7062,7 @@ protected function buildRelativeDateQuery(&$values) { $fieldSpec = $this->_fields[$fieldName]; $tableName = $fieldSpec['table_name']; $filters = CRM_Core_OptionGroup::values('relative_date_filters'); - $grouping = CRM_Utils_Array::value(3, $values); + $grouping = $values[3] ?? NULL; // If the table value is already set for a custom field it will be more nuanced than just '1'. $this->_tables[$tableName] = $this->_tables[$tableName] ?? 1; $this->_whereTables[$tableName] = $this->_whereTables[$tableName] ?? 1; diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index a88193f071fb..18dd1a5472f8 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -288,7 +288,7 @@ public static function add($params, $ids = [], $contactId = NULL) { } CRM_Utils_Hook::pre($hook, 'Relationship', $params['id'], $params); - $relationshipTypes = CRM_Utils_Array::value('relationship_type_id', $params); + $relationshipTypes = $params['relationship_type_id'] ?? NULL; // explode the string with _ to get the relationship type id // and to know which contact has to be inserted in // contact_id_a and which one in contact_id_b @@ -475,14 +475,14 @@ public static function setContactABFromIDs($params, $ids = [], $contactID = NULL throw new CRM_Core_Exception('Cannot create relationship, insufficient contact IDs provided'); } if (isset($params['relationship_type_id']) && !is_numeric($params['relationship_type_id'])) { - $relationshipTypes = CRM_Utils_Array::value('relationship_type_id', $params); + $relationshipTypes = $params['relationship_type_id'] ?? NULL; list($relationshipTypeID, $first) = explode('_', $relationshipTypes); $returnFields['relationship_type_id'] = $relationshipTypeID; foreach (['a', 'b'] as $contactLetter) { if (empty($params['contact_' . $contactLetter])) { if ($first == $contactLetter) { - $returnFields['contact_id_' . $contactLetter] = CRM_Utils_Array::value('contact', $ids); + $returnFields['contact_id_' . $contactLetter] = $ids['contact'] ?? NULL; } else { $returnFields['contact_id_' . $contactLetter] = $contactID; @@ -931,7 +931,7 @@ public static function checkValidRelationship($params, $ids, $contactId) { * true if record exists else false */ public static function checkDuplicateRelationship(&$params, $id, $contactId = 0, $relationshipId = 0) { - $relationshipTypeId = CRM_Utils_Array::value('relationship_type_id', $params); + $relationshipTypeId = $params['relationship_type_id'] ?? NULL; list($type) = explode('_', $relationshipTypeId); $queryString = " @@ -1728,7 +1728,7 @@ public static function relatedMemberships($contactId, &$params, $ids, $action = $relIds = [$params['id']]; } else { - $relIds = CRM_Utils_Array::value('relationship_ids', $params); + $relIds = $params['relationship_ids'] ?? NULL; } if (self::isRelatedMembershipExpired($relTypeIds, $contactId, $mainRelatedContactId, $relTypeId, $relIds) && !empty($membershipValues['owner_membership_id'] @@ -2009,7 +2009,7 @@ public static function membershipTypeToRelationshipTypes(&$params, $direction = public static function getContactRelationshipSelector(&$params) { // format the params $params['offset'] = ($params['page'] - 1) * $params['rp']; - $params['sort'] = CRM_Utils_Array::value('sortBy', $params); + $params['sort'] = $params['sortBy'] ?? NULL; if ($params['context'] == 'past') { $relationshipStatus = CRM_Contact_BAO_Relationship::INACTIVE; @@ -2226,11 +2226,11 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) { * @return array */ public static function buildRelationshipTypeOptions($params = []) { - $contactId = CRM_Utils_Array::value('contact_id', $params); + $contactId = $params['contact_id'] ?? NULL; $direction = CRM_Utils_Array::value('relationship_direction', $params, 'a_b'); - $relationshipId = CRM_Utils_Array::value('relationship_id', $params); - $contactType = CRM_Utils_Array::value('contact_type', $params); - $isForm = CRM_Utils_Array::value('is_form', $params); + $relationshipId = $params['relationship_id'] ?? NULL; + $contactType = $params['contact_type'] ?? NULL; + $isForm = $params['is_form'] ?? NULL; $showAll = FALSE; // getContactRelationshipType will return an empty set if these are not set diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index f5753039acd1..7e1ddd302e5c 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -94,11 +94,11 @@ public static function getFormValues($id) { $specialFields = ['contact_type', 'group', 'contact_tags', 'member_membership_type_id', 'member_status_id']; foreach ($result as $element => $value) { if (CRM_Contact_BAO_Query::isAlreadyProcessedForQueryFormat($value)) { - $id = CRM_Utils_Array::value(0, $value); - $value = CRM_Utils_Array::value(2, $value); + $id = $value[0] ?? NULL; + $value = $value[2] ?? NULL; if (is_array($value) && in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) { $op = key($value); - $value = CRM_Utils_Array::value($op, $value); + $value = $value[$op] ?? NULL; if (in_array($op, ['BETWEEN', '>=', '<='])) { self::decodeRelativeFields($result, $id, $op, $value); unset($result[$element]); @@ -150,7 +150,7 @@ public static function getFormValues($id) { // As per the OK (Operator as Key) value format, value array may contain key // as an operator so to ensure the default is always set actual value elseif (in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) { - $result[$element] = CRM_Utils_Array::value(key($value), $value); + $result[$element] = $value[key($value)] ?? NULL; if (is_string($result[$element])) { $result[$element] = str_replace("%", '', $result[$element]); } diff --git a/CRM/Contact/DAO/Factory.php b/CRM/Contact/DAO/Factory.php index 8af2fc1ac416..ef11dad723c0 100644 --- a/CRM/Contact/DAO/Factory.php +++ b/CRM/Contact/DAO/Factory.php @@ -30,7 +30,7 @@ class CRM_Contact_DAO_Factory { * @return mixed */ public static function create($className) { - $type = CRM_Utils_Array::value($className, self::$_classes); + $type = self::$_classes[$className] ?? NULL; if (!$type) { return CRM_Core_DAO_Factory::create($className); } diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index fff3ef2c8c70..4911e878bb84 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -200,8 +200,8 @@ public function preProcess() { CRM_Core_Error::statusBounce(ts('A Contact with that ID does not exist: %1', [1 => $this->_contactId])); } - $this->_contactType = CRM_Utils_Array::value('contact_type', $defaults); - $this->_contactSubType = CRM_Utils_Array::value('contact_sub_type', $defaults); + $this->_contactType = $defaults['contact_type'] ?? NULL; + $this->_contactSubType = $defaults['contact_sub_type'] ?? NULL; // check for permissions $session = CRM_Core_Session::singleton(); @@ -321,7 +321,7 @@ public function preProcess() { // retain the multiple count custom fields value if (!empty($_POST['hidden_custom'])) { - $customGroupCount = CRM_Utils_Array::value('hidden_custom_group_count', $_POST); + $customGroupCount = $_POST['hidden_custom_group_count'] ?? NULL; if ($contactSubType = CRM_Utils_Array::value('contact_sub_type', $_POST)) { $paramSubType = implode(',', $contactSubType); @@ -614,7 +614,7 @@ public static function formRule($fields, &$errors, $contactId, $contactType) { $dataExists = self::blockDataExists($blockValues); if (!$dataExists && $name == 'address') { - $dataExists = CRM_Utils_Array::value('use_shared_address', $fields['address'][$instance]); + $dataExists = $fields['address'][$instance]['use_shared_address'] ?? NULL; } if ($dataExists) { @@ -652,7 +652,7 @@ public static function formRule($fields, &$errors, $contactId, $contactType) { if ($name == 'openid' && !empty($blockValues[$name])) { $oid = new CRM_Core_DAO_OpenID(); - $oid->openid = $openIds[$instance] = CRM_Utils_Array::value($name, $blockValues); + $oid->openid = $openIds[$instance] = $blockValues[$name] ?? NULL; $cid = isset($contactId) ? $contactId : 0; if ($oid->find(TRUE) && ($oid->contact_id != $cid)) { $errors["{$name}[$instance][openid]"] = ts('%1 already exist.', [1 => $blocks['OpenID']]); @@ -869,7 +869,7 @@ public function postProcess() { $params['preferred_communication_method'] = 'null'; } - $group = CRM_Utils_Array::value('group', $params); + $group = $params['group'] ?? NULL; if (!empty($group) && is_array($group)) { unset($params['group']); foreach ($group as $key => $value) { @@ -1175,15 +1175,15 @@ public static function checkDuplicateContacts(&$fields, &$errors, $contactID, $c for ($i = 0; $i < count($contactLinks['rows']); $i++) { $row .= '
";
diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php
index d560d734f9eb..5c3bf571e862 100644
--- a/CRM/Core/Permission.php
+++ b/CRM/Core/Permission.php
@@ -465,7 +465,7 @@ public static function checkActionPermission($module, $action) {
'CiviMail' => 'access CiviMail',
'CiviAuction' => 'add auction items',
];
- $permissionName = CRM_Utils_Array::value($module, $editPermissions);
+ $permissionName = $editPermissions[$module] ?? NULL;
}
if ($module == 'CiviCase' && !$permissionName) {
diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php
index 773194a1aea1..c179a8a4a957 100644
--- a/CRM/Core/PseudoConstant.php
+++ b/CRM/Core/PseudoConstant.php
@@ -824,7 +824,7 @@ public static function country($id = FALSE, $applyLimit = TRUE) {
$countryIsoCodes = self::countryIsoCode();
$defaultID = array_search(CRM_Core_BAO_Country::defaultContactCountry(), $countryIsoCodes);
if ($defaultID !== FALSE) {
- $default[$defaultID] = CRM_Utils_Array::value($defaultID, self::$country);
+ $default[$defaultID] = self::$country[$defaultID] ?? NULL;
self::$country = $default + self::$country;
}
}
@@ -1393,7 +1393,7 @@ public static function greeting($filter, $columnName = 'label') {
$index = $filter['greeting_type'] . '_' . $columnName;
// also add contactType to the array
- $contactType = CRM_Utils_Array::value('contact_type', $filter);
+ $contactType = $filter['contact_type'] ?? NULL;
if ($contactType) {
$index .= '_' . $contactType;
}
diff --git a/CRM/Core/Smarty/plugins/function.crmAPI.php b/CRM/Core/Smarty/plugins/function.crmAPI.php
index 57c8efe178be..c1eae333e22a 100644
--- a/CRM/Core/Smarty/plugins/function.crmAPI.php
+++ b/CRM/Core/Smarty/plugins/function.crmAPI.php
@@ -31,7 +31,7 @@ function smarty_function_crmAPI($params, &$smarty) {
$entity = $params['entity'];
$action = CRM_Utils_Array::value('action', $params, 'get');
$params['sequential'] = CRM_Utils_Array::value('sequential', $params, 1);
- $var = CRM_Utils_Array::value('var', $params);
+ $var = $params['var'] ?? NULL;
CRM_Utils_Array::remove($params, 'entity', 'action', 'var');
$params['version'] = 3;
require_once 'api/api.php';
diff --git a/CRM/Custom/Form/DeleteField.php b/CRM/Custom/Form/DeleteField.php
index 492a5847a13e..8298ec966065 100644
--- a/CRM/Custom/Form/DeleteField.php
+++ b/CRM/Custom/Form/DeleteField.php
@@ -49,7 +49,7 @@ public function preProcess() {
$params = ['id' => $this->_id];
CRM_Core_BAO_CustomField::retrieve($params, $defaults);
- $this->_title = CRM_Utils_Array::value('label', $defaults);
+ $this->_title = $defaults['label'] ?? NULL;
$this->assign('title', $this->_title);
CRM_Utils_System::setTitle(ts('Delete %1', [1 => $this->_title]));
}
diff --git a/CRM/Custom/Form/Field.php b/CRM/Custom/Form/Field.php
index 0aeb046607e3..3881c1d98085 100644
--- a/CRM/Custom/Form/Field.php
+++ b/CRM/Custom/Form/Field.php
@@ -90,7 +90,7 @@ public function preProcess() {
$params = ['id' => $this->_id];
CRM_Core_BAO_CustomField::retrieve($params, $this->_values);
// note_length is an alias for the text_length field
- $this->_values['note_length'] = CRM_Utils_Array::value('text_length', $this->_values);
+ $this->_values['note_length'] = $this->_values['text_length'] ?? NULL;
// custom group id
$this->_gid = $this->_values['custom_group_id'];
}
@@ -571,7 +571,7 @@ public function buildQuickForm() {
* true otherwise
*/
public static function formRule($fields, $files, $self) {
- $default = CRM_Utils_Array::value('default_value', $fields);
+ $default = $fields['default_value'] ?? NULL;
$errors = [];
diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php
index e21c34fe5ae3..10c582c32053 100644
--- a/CRM/Custom/Form/Group.php
+++ b/CRM/Custom/Form/Group.php
@@ -73,7 +73,7 @@ public function preProcess() {
$params = ['id' => $this->_id];
CRM_Core_BAO_CustomGroup::retrieve($params, $this->_defaults);
- $subExtends = CRM_Utils_Array::value('extends_entity_column_value', $this->_defaults);
+ $subExtends = $this->_defaults['extends_entity_column_value'] ?? NULL;
if (!empty($subExtends)) {
$this->_subtypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($subExtends, 1, -1));
}
@@ -255,7 +255,7 @@ public function buildQuickForm() {
$sel->_elements[1]->setSize(5);
}
if ($this->_action == CRM_Core_Action::UPDATE) {
- $subName = CRM_Utils_Array::value('extends_entity_column_id', $this->_defaults);
+ $subName = $this->_defaults['extends_entity_column_id'] ?? NULL;
if ($this->_defaults['extends'] == 'Participant') {
if ($subName == 1) {
$this->_defaults['extends'] = 'ParticipantRole';
diff --git a/CRM/Custom/Import/Form/MapField.php b/CRM/Custom/Import/Form/MapField.php
index b7a42335c242..30db99f01f13 100644
--- a/CRM/Custom/Import/Form/MapField.php
+++ b/CRM/Custom/Import/Form/MapField.php
@@ -83,7 +83,7 @@ public static function formRule($fields) {
}
if (!empty($fields['saveMapping'])) {
- $nameField = CRM_Utils_Array::value('saveMappingName', $fields);
+ $nameField = $fields['saveMappingName'] ?? NULL;
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
}
@@ -96,7 +96,7 @@ public static function formRule($fields) {
//display Error if loaded mapping is not selected
if (array_key_exists('loadMapping', $fields)) {
- $getMapName = CRM_Utils_Array::value('savedMapping', $fields);
+ $getMapName = $fields['savedMapping'] ?? NULL;
if (empty($getMapName)) {
$errors['savedMapping'] = ts('Select saved mapping');
}
@@ -172,9 +172,9 @@ public function postProcess() {
$updateMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = $explodedValues[0] ?? NULL;
+ $first = $explodedValues[1] ?? NULL;
+ $second = $explodedValues[2] ?? NULL;
$updateMappingFields->name = $mapper[$i];
$updateMappingFields->save();
@@ -196,9 +196,9 @@ public function postProcess() {
$saveMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = $explodedValues[0] ?? NULL;
+ $first = $explodedValues[1] ?? NULL;
+ $second = $explodedValues[2] ?? NULL;
$saveMappingFields->name = $mapper[$i];
$saveMappingFields->save();
diff --git a/CRM/Custom/Import/Parser/Api.php b/CRM/Custom/Import/Parser/Api.php
index da2eb78f098b..db3180adb737 100644
--- a/CRM/Custom/Import/Parser/Api.php
+++ b/CRM/Custom/Import/Parser/Api.php
@@ -242,7 +242,7 @@ public function getGroupFieldsForImport($id) {
$allFields = civicrm_api3('custom_field', 'get', $params);
$fields = $allFields['values'];
foreach ($fields as $id => $values) {
- $datatype = CRM_Utils_Array::value('data_type', $values);
+ $datatype = $values['data_type'] ?? NULL;
if ($datatype == 'File') {
continue;
}
@@ -261,8 +261,8 @@ public function getGroupFieldsForImport($id) {
'is_search_range' => $values['is_search_range'] ?? NULL,
];
if (CRM_Utils_Array::value('html_type', $values) == 'Select Date') {
- $importableFields[$key]['date_format'] = CRM_Utils_Array::value('date_format', $values);
- $importableFields[$key]['time_format'] = CRM_Utils_Array::value('time_format', $values);
+ $importableFields[$key]['date_format'] = $values['date_format'] ?? NULL;
+ $importableFields[$key]['time_format'] = $values['time_format'] ?? NULL;
$this->_dateFields[] = $key;
}
}
diff --git a/CRM/Custom/Page/Group.php b/CRM/Custom/Page/Group.php
index e0bb74ac159c..76fa828ea7a6 100644
--- a/CRM/Custom/Page/Group.php
+++ b/CRM/Custom/Page/Group.php
@@ -268,9 +268,9 @@ public function browse($action = NULL) {
CRM_Core_BAO_CustomGroup::getExtendedObjectTypes($subTypes);
foreach ($customGroup as $key => $values) {
- $subValue = CRM_Utils_Array::value('extends_entity_column_value', $customGroup[$key]);
- $subName = CRM_Utils_Array::value('extends_entity_column_id', $customGroup[$key]);
- $type = CRM_Utils_Array::value('extends', $customGroup[$key]);
+ $subValue = $customGroup[$key]['extends_entity_column_value'] ?? NULL;
+ $subName = $customGroup[$key]['extends_entity_column_id'] ?? NULL;
+ $type = $customGroup[$key]['extends'] ?? NULL;
if ($subValue) {
$subValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
substr($subValue, 1, -1)
diff --git a/CRM/Dedupe/BAO/Exception.php b/CRM/Dedupe/BAO/Exception.php
index 3c4c783cfcd7..6097887055a5 100644
--- a/CRM/Dedupe/BAO/Exception.php
+++ b/CRM/Dedupe/BAO/Exception.php
@@ -30,13 +30,13 @@ class CRM_Dedupe_BAO_Exception extends CRM_Dedupe_DAO_Exception {
public static function create($params) {
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'Exception', CRM_Utils_Array::value('id', $params), $params);
- $contact1 = CRM_Utils_Array::value('contact_id1', $params);
- $contact2 = CRM_Utils_Array::value('contact_id2', $params);
+ $contact1 = $params['contact_id1'] ?? NULL;
+ $contact2 = $params['contact_id2'] ?? NULL;
$dao = new CRM_Dedupe_BAO_Exception();
$dao->copyValues($params);
if ($contact1 && $contact2) {
CRM_Core_DAO::singleValueQuery("
- DELETE FROM civicrm_prevnext_cache
+ DELETE FROM civicrm_prevnext_cache
WHERE (entity_id1 = %1 AND entity_id2 = %2)
OR (entity_id1 = %2 AND entity_id2 = %2)",
[1 => [$contact1, 'Integer'], 2 => [$contact2, 'Integer']]
diff --git a/CRM/Dedupe/BAO/QueryBuilder/IndividualGeneral.php b/CRM/Dedupe/BAO/QueryBuilder/IndividualGeneral.php
index 373866f7a868..4a4b93d618d4 100644
--- a/CRM/Dedupe/BAO/QueryBuilder/IndividualGeneral.php
+++ b/CRM/Dedupe/BAO/QueryBuilder/IndividualGeneral.php
@@ -12,8 +12,8 @@ class CRM_Dedupe_BAO_QueryBuilder_IndividualGeneral extends CRM_Dedupe_BAO_Query
* @return array
*/
public static function record($rg) {
- $civicrm_contact = CRM_Utils_Array::value('civicrm_contact', $rg->params);
- $civicrm_address = CRM_Utils_Array::value('civicrm_address', $rg->params);
+ $civicrm_contact = $rg->params['civicrm_contact'] ?? NULL;
+ $civicrm_address = $rg->params['civicrm_address'] ?? NULL;
// Since definitely have first and last name, escape them upfront.
$first_name = CRM_Core_DAO::escapeString(CRM_Utils_Array::value('first_name', $civicrm_contact, ''));
diff --git a/CRM/Dedupe/Finder.php b/CRM/Dedupe/Finder.php
index 06863a2afabd..97e8abcf51bc 100644
--- a/CRM/Dedupe/Finder.php
+++ b/CRM/Dedupe/Finder.php
@@ -230,7 +230,7 @@ public static function formatParams($fields, $ctype) {
continue;
}
foreach ($cg['fields'] as $cf) {
- $flat[$cf['column_name']] = CRM_Utils_Array::value('data', $cf['customValue']);
+ $flat[$cf['column_name']] = $cf['customValue']['data'] ?? NULL;
}
}
diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php
index 6c1d7d6bfd21..d5d1c5a132d4 100644
--- a/CRM/Dedupe/Merger.php
+++ b/CRM/Dedupe/Merger.php
@@ -637,8 +637,8 @@ public static function retrieveFields($main, $other) {
if (strpos($key, '_')) {
continue;
}
- $key1 = CRM_Utils_Array::value($key, $mainEvs);
- $key2 = CRM_Utils_Array::value($key, $otherEvs);
+ $key1 = $mainEvs[$key] ?? NULL;
+ $key2 = $otherEvs[$key] ?? NULL;
// We wish to retain '0' as it has a different meaning than NULL on a checkbox.
// However I can't think of a case where an empty string is more meaningful than null
// or where it would be FALSE or something else nullish.
@@ -859,7 +859,7 @@ public static function getMergeStatsMsg($stats) {
public static function merge($dupePairs = [], $cacheParams = [], $mode = 'safe',
$redirectForPerformance = FALSE, $checkPermissions = TRUE
) {
- $cacheKeyString = CRM_Utils_Array::value('cache_key_string', $cacheParams);
+ $cacheKeyString = $cacheParams['cache_key_string'] ?? NULL;
$resultStats = ['merged' => [], 'skipped' => []];
// we don't want dupe caching to get reset after every-merge, and therefore set the
@@ -1716,7 +1716,7 @@ public static function mergeLocations($mainId, $otherId, $migrationInfo) {
// @todo Tidy this up
$operation = 0;
if ($fieldName != 'website') {
- $operation = CRM_Utils_Array::value('operation', $migrationInfo['location_blocks'][$fieldName][$fieldCount]);
+ $operation = $migrationInfo['location_blocks'][$fieldName][$fieldCount]['operation'] ?? NULL;
}
// default operation is overwrite.
if (!$operation) {
@@ -1744,7 +1744,7 @@ public static function mergeLocations($mainId, $otherId, $migrationInfo) {
$billingDAOId = (array_key_exists($name, $billingBlockIds)) ? array_pop($billingBlockIds[$name]) : NULL;
foreach ($block as $blkCount => $values) {
- $otherBlockId = CRM_Utils_Array::value('id', $migrationInfo['other_details']['location_blocks'][$name][$blkCount]);
+ $otherBlockId = $migrationInfo['other_details']['location_blocks'][$name][$blkCount]['id'] ?? NULL;
$mainBlockId = CRM_Utils_Array::value('mainContactBlockId', $migrationInfo['location_blocks'][$name][$blkCount], 0);
if (!$otherBlockId) {
continue;
@@ -1759,18 +1759,18 @@ public static function mergeLocations($mainId, $otherId, $migrationInfo) {
// Add/update location and type information from the form, if applicable
if ($locationBlocks[$name]['hasLocation']) {
- $locTypeId = CRM_Utils_Array::value('locTypeId', $migrationInfo['location_blocks'][$name][$blkCount]);
+ $locTypeId = $migrationInfo['location_blocks'][$name][$blkCount]['locTypeId'] ?? NULL;
$otherBlockDAO->location_type_id = $locTypeId;
}
if ($locationBlocks[$name]['hasType']) {
- $typeTypeId = CRM_Utils_Array::value('typeTypeId', $migrationInfo['location_blocks'][$name][$blkCount]);
+ $typeTypeId = $migrationInfo['location_blocks'][$name][$blkCount]['typeTypeId'] ?? NULL;
$otherBlockDAO->{$locationBlocks[$name]['hasType']} = $typeTypeId;
}
// If we're deliberately setting this as primary then add the flag
// and remove it from the current primary location (if there is one).
// But only once for each entity.
- $set_primary = CRM_Utils_Array::value('set_other_primary', $migrationInfo['location_blocks'][$name][$blkCount]);
+ $set_primary = $migrationInfo['location_blocks'][$name][$blkCount]['set_other_primary'] ?? NULL;
if (!$changePrimary && $set_primary == "1") {
$otherBlockDAO->is_primary = 1;
if ($primaryDAOId) {
@@ -2125,7 +2125,7 @@ public static function getConflicts(&$migrationInfo, $mainId, $otherId, $mode) {
// Load the address we're inspecting from the 'other' contact
$addressRecord = $migrationInfo['other_details']['location_blocks'][$fieldName][$fieldCount];
- $addressRecordLocTypeId = CRM_Utils_Array::value('location_type_id', $addressRecord);
+ $addressRecordLocTypeId = $addressRecord['location_type_id'] ?? NULL;
// If it exists on the 'main' contact already, skip it. Otherwise
// if the location type exists already, log a conflict.
@@ -2217,7 +2217,7 @@ protected static function formatConflictArray($conflicts, $migrationInfo, $toKee
if (in_array($fieldName, self::ignoredFields())) {
continue;
}
- $toRemoveValue = CRM_Utils_Array::value($fieldName, $toRemoveContactLocationBlocks[$entity][$blockIndex]);
+ $toRemoveValue = $toRemoveContactLocationBlocks[$entity][$blockIndex][$fieldName] ?? NULL;
if ($fieldValue !== $toRemoveValue) {
$entityConflicts[$fieldName] = [
$toKeepID => $fieldValue,
@@ -2296,7 +2296,7 @@ protected static function ignoredFields(): array {
*/
private static function getFieldValueAndLabel($field, $contact): array {
$fields = self::getMergeFieldsMetadata();
- $value = $label = CRM_Utils_Array::value($field, $contact);
+ $value = $label = $contact[$field] ?? NULL;
$fieldSpec = $fields[$field];
if (!empty($fieldSpec['serialize']) && is_array($value)) {
// In practice this only applies to preferred_communication_method as the sub types are skipped above
@@ -2475,7 +2475,7 @@ protected static function addLocationFieldInfo($mainId, $otherId, $blockInfo, $b
$lookupType = FALSE;
if ($blockInfo['hasType']) {
- $lookupType = CRM_Utils_Array::value($blockInfo['hasType'], $value);
+ $lookupType = $value[$blockInfo['hasType']] ?? NULL;
}
// Hold ID of main contact's matching block
@@ -2571,7 +2571,7 @@ protected static function addLocationFieldInfo($mainId, $otherId, $blockInfo, $b
// Load the type options for this entity
$typeOptions = civicrm_api3($blockName, 'getoptions', ['field' => $blockInfo['hasType']]);
- $thisTypeId = CRM_Utils_Array::value($blockInfo['hasType'], $value);
+ $thisTypeId = $value[$blockInfo['hasType']] ?? NULL;
// Put this field's location type at the top of the list
$tmpIdList = $typeOptions['values'];
diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php
index 29252fc27ef9..1e178acae2a7 100644
--- a/CRM/Event/BAO/Event.php
+++ b/CRM/Event/BAO/Event.php
@@ -134,7 +134,7 @@ public static function create(&$params) {
$contactId = CRM_Core_Session::getLoggedInContactID();
if (!$contactId) {
- $contactId = CRM_Utils_Array::value('contact_id', $params);
+ $contactId = $params['contact_id'] ?? NULL;
}
// Log the information on successful add/edit of Event
@@ -1104,8 +1104,8 @@ public static function sendMail($contactID, $values, $participantId, $isTest = F
//send email only when email is present
if (isset($email) || $returnMessageText) {
- $preProfileID = CRM_Utils_Array::value('custom_pre_id', $values);
- $postProfileID = CRM_Utils_Array::value('custom_post_id', $values);
+ $preProfileID = $values['custom_pre_id'] ?? NULL;
+ $postProfileID = $values['custom_post_id'] ?? NULL;
if (!empty($values['params']['additionalParticipant'])) {
$preProfileID = CRM_Utils_Array::value('additional_custom_pre_id', $values, $preProfileID);
@@ -1233,7 +1233,7 @@ public static function sendMail($contactID, $values, $participantId, $isTest = F
);
// append invoice pdf to email
$prefixValue = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
+ $invoicing = $prefixValue['invoicing'] ?? NULL;
if (isset($invoicing) && isset($prefixValue['is_email_pdf']) && !empty($values['contributionId'])) {
$sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $values['contributionId'];
@@ -1581,7 +1581,7 @@ public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$
}
elseif (substr($name, -11) == 'campaign_id') {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($params[$name]);
- $values[$index] = CRM_Utils_Array::value($params[$name], $campaigns);
+ $values[$index] = $campaigns[$params[$name]] ?? NULL;
}
elseif (strpos($name, '-') !== FALSE) {
list($fieldName, $id) = CRM_Utils_System::explode('-', $name, 2);
@@ -1598,7 +1598,7 @@ public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$
elseif ($fieldName == 'im') {
$providerName = NULL;
if ($providerId = $detailName . '-provider_id') {
- $providerName = CRM_Utils_Array::value($params[$providerId], $imProviders);
+ $providerName = $imProviders[$params[$providerId]] ?? NULL;
}
if ($providerName) {
$values[$index] = $params[$detailName] . " (" . $providerName . ")";
@@ -1638,8 +1638,8 @@ public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$
$htmlType = $dao->html_type;
if ($htmlType == 'File') {
- $path = CRM_Utils_Array::value('name', $params[$name]);
- $fileType = CRM_Utils_Array::value('type', $params[$name]);
+ $path = $params[$name]['name'] ?? NULL;
+ $fileType = $params[$name]['type'] ?? NULL;
$values[$index] = CRM_Utils_File::getFileURL($path, $fileType);
}
else {
@@ -1710,7 +1710,7 @@ public static function displayProfile(&$params, $gid, &$groupTitle, &$values, &$
$values[$index] = CRM_Utils_Date::customFormat(CRM_Utils_Date::format($params[$name]));
}
else {
- $values[$index] = CRM_Utils_Array::value($name, $params);
+ $values[$index] = $params[$name] ?? NULL;
}
}
}
@@ -1780,8 +1780,8 @@ public static function buildCustomProfile(
return $additionalIDs;
}
- $preProfileID = CRM_Utils_Array::value('additional_custom_pre_id', $values);
- $postProfileID = CRM_Utils_Array::value('additional_custom_post_id', $values);
+ $preProfileID = $values['additional_custom_pre_id'] ?? NULL;
+ $postProfileID = $values['additional_custom_post_id'] ?? NULL;
//else build array of Additional participant's information.
if (count($additionalIDs)) {
if ($preProfileID || $postProfileID) {
diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php
index ed598bd5ce86..8117991b406f 100644
--- a/CRM/Event/BAO/Participant.php
+++ b/CRM/Event/BAO/Participant.php
@@ -97,7 +97,7 @@ public static function &add(&$params) {
$participantBAO = new CRM_Event_BAO_Participant();
if (!empty($params['id'])) {
- $participantBAO->id = CRM_Utils_Array::value('id', $params);
+ $participantBAO->id = $params['id'] ?? NULL;
$participantBAO->find(TRUE);
$participantBAO->register_date = CRM_Utils_Date::isoToMysql($participantBAO->register_date);
}
@@ -203,7 +203,7 @@ public static function create(&$params) {
$session = CRM_Core_Session::singleton();
$id = $session->get('userID');
if (!$id) {
- $id = CRM_Utils_Array::value('contact_id', $params);
+ $id = $params['contact_id'] ?? NULL;
}
// add custom field values
@@ -666,7 +666,7 @@ public static function &importableFields($contactType = 'Individual', $status =
'column_name'
);
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
- $tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
+ $tmpContactField[trim($value)] = $contactFields[trim($value)] ?? NULL;
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . ' (match to contact)';
}
@@ -678,7 +678,7 @@ public static function &importableFields($contactType = 'Individual', $status =
}
}
}
- $extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
+ $extIdentifier = $contactFields['external_identifier'] ?? NULL;
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
$tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
@@ -904,8 +904,8 @@ public static function deleteParticipant($id) {
* @return CRM_Contribute_BAO_Contribution
*/
public static function checkDuplicate($input, &$duplicates) {
- $eventId = CRM_Utils_Array::value('event_id', $input);
- $contactId = CRM_Utils_Array::value('contact_id', $input);
+ $eventId = $input['event_id'] ?? NULL;
+ $contactId = $input['contact_id'] ?? NULL;
$clause = [];
$input = [];
@@ -1283,7 +1283,7 @@ public static function transitionParticipants(
CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$eventId]);
//get default participant role.
- $eventDetails[$eventId]['participant_role'] = CRM_Utils_Array::value($eventDetails[$eventId]['default_role_id'], $participantRoles);
+ $eventDetails[$eventId]['participant_role'] = $participantRoles[$eventDetails[$eventId]['default_role_id']] ?? NULL;
//get the location info
$locParams = ['entity_id' => $eventId, 'entity_table' => 'civicrm_event'];
@@ -1296,7 +1296,7 @@ public static function transitionParticipants(
$emailType = NULL;
$toStatus = $statusTypes[$toStatusId];
- $fromStatus = CRM_Utils_Array::value($fromStatusId, $statusTypes);
+ $fromStatus = $statusTypes[$fromStatusId] ?? NULL;
switch ($toStatus) {
case 'Pending from waitlist':
@@ -1432,7 +1432,7 @@ public static function sendTransitionParticipantMail(
) {
return $mailSent;
}
- $toEmail = CRM_Utils_Array::value('email', $contactDetails);
+ $toEmail = $contactDetails['email'] ?? NULL;
if ($toEmail) {
$contactId = $participantValues['contact_id'];
@@ -1442,7 +1442,7 @@ public static function sendTransitionParticipantMail(
$checksumValue = NULL;
if ($mailType == 'Confirm' && !$participantValues['registered_by_id']) {
$checksumLife = 'inf';
- $endDate = CRM_Utils_Array::value('end_date', $eventDetails);
+ $endDate = $eventDetails['end_date'] ?? NULL;
if ($endDate) {
$checksumLife = (CRM_Utils_Date::unixTime($endDate) - time()) / (60 * 60);
}
diff --git a/CRM/Event/BAO/ParticipantStatusType.php b/CRM/Event/BAO/ParticipantStatusType.php
index 51be2dfd3e0a..b0166dbff2f1 100644
--- a/CRM/Event/BAO/ParticipantStatusType.php
+++ b/CRM/Event/BAO/ParticipantStatusType.php
@@ -168,7 +168,7 @@ public static function process($params) {
continue;
}
- $expirationTime = CRM_Utils_Array::value('expiration_time', $values);
+ $expirationTime = $values['expiration_time'] ?? NULL;
if ($expirationTime && array_key_exists($values['status_id'], $pendingStatuses)) {
//get the expiration and registration pending time.
diff --git a/CRM/Event/Cart/BAO/MerParticipant.php b/CRM/Event/Cart/BAO/MerParticipant.php
index 0b672a168901..553ab9578b08 100644
--- a/CRM/Event/Cart/BAO/MerParticipant.php
+++ b/CRM/Event/Cart/BAO/MerParticipant.php
@@ -38,7 +38,7 @@ public function __construct($participant = NULL) {
$a = (array) $participant;
$this->copyValues($a);
- $this->email = CRM_Utils_Array::value('email', $participant);
+ $this->email = $participant['email'] ?? NULL;
}
/**
diff --git a/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php b/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php
index 57e28b704550..8f68053a1df0 100644
--- a/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php
+++ b/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php
@@ -128,7 +128,7 @@ public function postProcess() {
foreach ($this->events_by_slot as $slot_name => $events) {
$slot_index++;
$field_name = "slot_$slot_index";
- $session_event_id = CRM_Utils_Array::value($field_name, $params, NULL);
+ $session_event_id = $params[$field_name] ?? NULL;
if (!$session_event_id) {
continue;
}
diff --git a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php
index c9b2d90ea587..5067ccf33d0a 100644
--- a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php
+++ b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php
@@ -220,7 +220,7 @@ public function setDefaultValues() {
$price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE, TRUE);
$price_set = $price_sets[$price_set_id];
foreach ($price_set['fields'] as $field) {
- $options = CRM_Utils_Array::value('options', $field);
+ $options = $field['options'] ?? NULL;
if (!is_array($options)) {
continue;
}
diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php
index 96a64ead5633..df500acf96f1 100644
--- a/CRM/Event/Cart/Form/Checkout/Payment.php
+++ b/CRM/Event/Cart/Form/Checkout/Payment.php
@@ -439,7 +439,7 @@ public function postProcess() {
"email-{$this->_bltID}" => 1,
];
- $params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . CRM_Utils_Array::value('billing_last_name', $params);
+ $params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . $params['billing_last_name'] ?? NULL;
$params["email-{$this->_bltID}"] = $params['billing_contact_email'];
CRM_Contact_BAO_Contact::createProfileContact(
@@ -712,7 +712,7 @@ protected function apply_discount($discountCode, &$price_set_amount, &$cost, $ev
$stat = FALSE;
foreach ($discounts as $key => $discountValue) {
if ($key == $discountCode) {
- $events = CRM_Utils_Array::value('events', $discountValue);
+ $events = $discountValue['events'] ?? NULL;
$evt_ids = implode(",", $events);
if ($evt_ids == "0" || strpos($evt_ids, $event_id)) {
$event_match = TRUE;
diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php
index 192e54008e2e..14be8ec5f6e8 100644
--- a/CRM/Event/Form/EventFees.php
+++ b/CRM/Event/Form/EventFees.php
@@ -254,8 +254,8 @@ public static function setDefaultPriceSet($participantID, $eventID = NULL, $incl
$priceFields = $htmlTypes = $optionValues = [];
foreach ($lineItems[$participantID] as $lineId => $items) {
- $priceFieldId = CRM_Utils_Array::value('price_field_id', $items);
- $priceOptionId = CRM_Utils_Array::value('price_field_value_id', $items);
+ $priceFieldId = $items['price_field_id'] ?? NULL;
+ $priceOptionId = $items['price_field_value_id'] ?? NULL;
if ($priceFieldId && $priceOptionId) {
$priceFields[$priceFieldId][] = $priceOptionId;
}
@@ -277,7 +277,7 @@ public static function setDefaultPriceSet($participantID, $eventID = NULL, $incl
foreach ($lineItems[$participantID] as $lineId => $items) {
$fieldId = $items['price_field_id'];
- $htmlType = CRM_Utils_Array::value($fieldId, $htmlTypes);
+ $htmlType = $htmlTypes[$fieldId] ?? NULL;
if (!$htmlType) {
continue;
}
@@ -286,7 +286,7 @@ public static function setDefaultPriceSet($participantID, $eventID = NULL, $incl
$defaults["price_{$fieldId}"] = $items['qty'];
}
else {
- $fieldOptValues = CRM_Utils_Array::value($fieldId, $priceFields);
+ $fieldOptValues = $priceFields[$fieldId] ?? NULL;
if (!is_array($fieldOptValues)) {
continue;
}
diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php
index 19d2c816a16b..dda88ca5ec59 100644
--- a/CRM/Event/Form/ManageEvent.php
+++ b/CRM/Event/Form/ManageEvent.php
@@ -130,7 +130,7 @@ public function preProcess() {
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page.'));
}
- $participantListingID = CRM_Utils_Array::value('participant_listing_id', $eventInfo);
+ $participantListingID = $eventInfo['participant_listing_id'] ?? NULL;
//CRM_Core_DAO::getFieldValue( 'CRM_Event_DAO_Event', $this->_id, 'participant_listing_id' );
if ($participantListingID) {
$participantListingURL = CRM_Utils_System::url('civicrm/event/participant',
@@ -147,7 +147,7 @@ public function preProcess() {
// figure out whether we’re handling an event or an event template
if ($this->_id) {
- $this->_isTemplate = CRM_Utils_Array::value('is_template', $eventInfo);
+ $this->_isTemplate = $eventInfo['is_template'] ?? NULL;
}
elseif ($this->_action & CRM_Core_Action::ADD) {
$this->_isTemplate = CRM_Utils_Request::retrieve('is_template', 'Boolean', $this);
@@ -159,11 +159,11 @@ public function preProcess() {
$title = NULL;
if ($this->_id) {
if ($this->_isTemplate) {
- $title = ts('Edit Event Template') . ' - ' . CRM_Utils_Array::value('template_title', $eventInfo);
+ $title = ts('Edit Event Template') . ' - ' . $eventInfo['template_title'] ?? NULL;
}
else {
$configureText = $this->_isRepeatingEvent ? ts('Configure Repeating Event') : ts('Configure Event');
- $title = $configureText . ' - ' . CRM_Utils_Array::value('title', $eventInfo);
+ $title = $configureText . ' - ' . $eventInfo['title'] ?? NULL;
}
}
elseif ($this->_action & CRM_Core_Action::ADD) {
@@ -250,7 +250,7 @@ public function setDefaultValues() {
$params = ['id' => $this->_id];
CRM_Event_BAO_Event::retrieve($params, $defaults);
- $this->_campaignID = CRM_Utils_Array::value('campaign_id', $defaults);
+ $this->_campaignID = $defaults['campaign_id'] ?? NULL;
}
elseif ($this->_templateId) {
$params = ['id' => $this->_templateId];
@@ -275,7 +275,7 @@ public function setDefaultValues() {
public function buildQuickForm() {
$session = CRM_Core_Session::singleton();
- $this->_cancelURL = CRM_Utils_Array::value('cancelURL', $_POST);
+ $this->_cancelURL = $_POST['cancelURL'] ?? NULL;
if (!$this->_cancelURL) {
if ($this->_isTemplate) {
@@ -372,8 +372,8 @@ public function endPostProcess() {
$config = CRM_Core_Config::singleton();
if (in_array('CiviCampaign', $config->enableComponents)) {
$values = $this->controller->exportValues($this->_name);
- $newCampaignID = CRM_Utils_Array::value('campaign_id', $values);
- $eventID = CRM_Utils_Array::value('id', $values);
+ $newCampaignID = $values['campaign_id'] ?? NULL;
+ $eventID = $values['id'] ?? NULL;
if ($eventID && $this->_campaignID != $newCampaignID) {
CRM_Event_BAO_Event::updateParticipantCampaignID($eventID, $newCampaignID);
}
diff --git a/CRM/Event/Form/ManageEvent/EventInfo.php b/CRM/Event/Form/ManageEvent/EventInfo.php
index c72fc7e27a24..a820295fa163 100644
--- a/CRM/Event/Form/ManageEvent/EventInfo.php
+++ b/CRM/Event/Form/ManageEvent/EventInfo.php
@@ -215,8 +215,8 @@ public function postProcess() {
$params = array_merge($this->controller->exportValues($this->_name), $this->_submitValues);
//format params
- $params['start_date'] = CRM_Utils_Array::value('start_date', $params);
- $params['end_date'] = CRM_Utils_Array::value('end_date', $params);
+ $params['start_date'] = $params['start_date'] ?? NULL;
+ $params['end_date'] = $params['end_date'] ?? NULL;
$params['has_waitlist'] = CRM_Utils_Array::value('has_waitlist', $params, FALSE);
$params['is_map'] = CRM_Utils_Array::value('is_map', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php
index c09d9c91992d..1462a3697c73 100644
--- a/CRM/Event/Form/ManageEvent/Fee.php
+++ b/CRM/Event/Form/ManageEvent/Fee.php
@@ -476,7 +476,7 @@ public static function formRule($values) {
}
}
- $default = CRM_Utils_Array::value('default', $values);
+ $default = $values['default'] ?? NULL;
if ($default && !in_array($default, $optionKeys)) {
$errors['default'] = ts('Please select an appropriate option as default.');
}
@@ -577,9 +577,9 @@ public function postProcess() {
}
else {
// if there are label / values, create custom options for them
- $labels = CRM_Utils_Array::value('label', $params);
- $values = CRM_Utils_Array::value('value', $params);
- $default = CRM_Utils_Array::value('default', $params);
+ $labels = $params['label'] ?? NULL;
+ $values = $params['value'] ?? NULL;
+ $default = $params['default'] ?? NULL;
$options = [];
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < self::NUM_OPTION; $i++) {
@@ -624,7 +624,7 @@ public function postProcess() {
unset($params['price_field_value'][$arrayID]);
}
}
- $fieldParams['id'] = CRM_Utils_Array::value('price_field_id', $params);
+ $fieldParams['id'] = $params['price_field_id'] ?? NULL;
$fieldParams['option_id'] = $params['price_field_value'];
$priceSet = new CRM_Price_BAO_PriceSet();
@@ -654,9 +654,9 @@ public function postProcess() {
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
// if there are discounted set of label / values,
// create custom options for them
- $labels = CRM_Utils_Array::value('discounted_label', $params);
- $values = CRM_Utils_Array::value('discounted_value', $params);
- $default = CRM_Utils_Array::value('discounted_default', $params);
+ $labels = $params['discounted_label'] ?? NULL;
+ $values = $params['discounted_value'] ?? NULL;
+ $default = $params['discounted_default'] ?? NULL;
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($j = 1; $j <= self::NUM_DISCOUNT; $j++) {
diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php
index f3244105e58b..9cbf60c8aac1 100644
--- a/CRM/Event/Form/ManageEvent/Registration.php
+++ b/CRM/Event/Form/ManageEvent/Registration.php
@@ -102,7 +102,7 @@ public function setDefaultValues() {
// Set event registration as the default profile if none selected
if (!$defaults['custom_pre_id'] && count($defaults['custom_post']) == 0) {
- $defaults['custom_pre_id'] = CRM_Utils_Array::value('id', $eventRegistrationIdDefaults);
+ $defaults['custom_pre_id'] = $eventRegistrationIdDefaults['id'] ?? NULL;
}
if (isset($defaults['custom_post']) && is_numeric($defaults['custom_post'])) {
$defaults['custom_post_id'] = $defaults['custom_post'];
@@ -499,7 +499,7 @@ public static function formRule($values, $files, $form) {
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
//check for additional custom pre profile
- $additionalCustomPreId = CRM_Utils_Array::value('additional_custom_pre_id', $values);
+ $additionalCustomPreId = $values['additional_custom_pre_id'] ?? NULL;
if (!empty($additionalCustomPreId)) {
if (!($additionalCustomPreId == 'none')) {
$customPreId = $additionalCustomPreId;
@@ -527,7 +527,7 @@ public static function formRule($values, $files, $form) {
// We don't have required Individual fields in the pre-custom profile, so now check the post-custom profile
if ($isPreError) {
- $additionalCustomPostId = CRM_Utils_Array::value('additional_custom_post_id', $values);
+ $additionalCustomPostId = $values['additional_custom_post_id'] ?? NULL;
if (!empty($additionalCustomPostId)) {
if (!($additionalCustomPostId == 'none')) {
$customPostId = $additionalCustomPostId;
diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php
index 9a955b3cba99..3e022e477e41 100644
--- a/CRM/Event/Form/Participant.php
+++ b/CRM/Event/Form/Participant.php
@@ -266,7 +266,7 @@ public function getDefaultContext() {
*/
public function preProcess() {
parent::preProcess();
- $this->_showFeeBlock = CRM_Utils_Array::value('eventId', $_GET);
+ $this->_showFeeBlock = $_GET['eventId'] ?? NULL;
$this->assign('showFeeBlock', FALSE);
$this->assign('feeBlockPaid', FALSE);
@@ -421,7 +421,7 @@ public function preProcess() {
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
- $eventId = (int) CRM_Utils_Array::value('event_id', $_POST);
+ $eventId = (int) $_POST['event_id'] ?? NULL;
// Custom data of type participant role
// Note: Some earlier commits imply $_POST['role_id'] could be a comma separated string,
// not sure if that ever really happens
@@ -522,7 +522,7 @@ public function setDefaultValues() {
//setting default register date
if ($this->_action == CRM_Core_Action::ADD) {
$statuses = array_flip(CRM_Event_PseudoConstant::participantStatus());
- $defaults[$this->_id]['status_id'] = CRM_Utils_Array::value('Registered', $statuses);
+ $defaults[$this->_id]['status_id'] = $statuses['Registered'] ?? NULL;
if (!empty($defaults[$this->_id]['event_id'])) {
$contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event',
$defaults[$this->_id]['event_id'],
@@ -893,13 +893,13 @@ public static function formRule($values, $files, $self) {
// for this event.
if ($self->_single && ($self->_action & CRM_Core_Action::ADD)) {
if ($self->_context == 'standalone') {
- $contactId = CRM_Utils_Array::value('contact_id', $values);
+ $contactId = $values['contact_id'] ?? NULL;
}
else {
$contactId = $self->_contactId;
}
- $eventId = CRM_Utils_Array::value('event_id', $values);
+ $eventId = $values['event_id'] ?? NULL;
$event = new CRM_Event_DAO_Event();
$event->id = $eventId;
@@ -1061,7 +1061,7 @@ public function submit($params) {
// overwrite actual payment amount if entered
if (!empty($params['total_amount'])) {
- $contributionParams['total_amount'] = CRM_Utils_Array::value('total_amount', $params);
+ $contributionParams['total_amount'] = $params['total_amount'] ?? NULL;
}
// Retrieve the name and email of the current user - this will be the FROM for the receipt email
@@ -1110,7 +1110,7 @@ public function submit($params) {
$params["address_name-{$this->_bltID}"]
= CRM_Utils_Array::value('billing_first_name', $params) . ' ' .
CRM_Utils_Array::value('billing_middle_name', $params) . ' ' .
- CRM_Utils_Array::value('billing_last_name', $params);
+ $params['billing_last_name'] ?? NULL;
$params["address_name-{$this->_bltID}"] = trim($params["address_name-{$this->_bltID}"]);
$fields["address_name-{$this->_bltID}"] = 1;
@@ -1337,7 +1337,7 @@ public function submit($params) {
];
foreach ($recordContribution as $f) {
- $contributionParams[$f] = CRM_Utils_Array::value($f, $this->_params);
+ $contributionParams[$f] = $this->_params[$f] ?? NULL;
if ($f == 'trxn_id') {
$this->assign('trxn_id', $contributionParams[$f]);
}
@@ -1548,7 +1548,7 @@ public function submit($params) {
// fix amount for each of participants ( for bulk mode )
$eventAmount = [];
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$totalTaxAmount = 0;
//add dataArray in the receipts in ADD and UPDATE condition
@@ -1564,10 +1564,10 @@ public function submit($params) {
if (isset($value['tax_amount'])) {
$totalTaxAmount += $value['tax_amount'];
if (isset($dataArray[(string) $value['tax_rate']])) {
- $dataArray[(string) $value['tax_rate']] = $dataArray[(string) $value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value);
+ $dataArray[(string) $value['tax_rate']] = $dataArray[(string) $value['tax_rate']] + $value['tax_amount'] ?? NULL;
}
else {
- $dataArray[(string) $value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value);
+ $dataArray[(string) $value['tax_rate']] = $value['tax_amount'] ?? NULL;
}
}
}
@@ -1606,8 +1606,8 @@ public function submit($params) {
$sendTemplateParams['from'] = $receiptFrom;
$sendTemplateParams['toName'] = $this->_contributorDisplayName;
$sendTemplateParams['toEmail'] = $this->_contributorEmail;
- $sendTemplateParams['cc'] = CRM_Utils_Array::value('cc', $this->_fromEmails);
- $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc', $this->_fromEmails);
+ $sendTemplateParams['cc'] = $this->_fromEmails['cc'] ?? NULL;
+ $sendTemplateParams['bcc'] = $this->_fromEmails['bcc'] ?? NULL;
}
//send email with pdf invoice
@@ -1617,7 +1617,7 @@ public function submit($params) {
$this->_id, 'contribution_id', 'participant_id'
);
$prefixValue = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
+ $invoicing = $prefixValue['invoicing'] ?? NULL;
if (!empty($taxAmt) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
$sendTemplateParams['isEmailPdf'] = TRUE;
$sendTemplateParams['contributionId'] = $contributionId;
@@ -1627,7 +1627,7 @@ public function submit($params) {
$sent[] = $contactID;
foreach ($participants as $ids => $values) {
if ($values->contact_id == $contactID) {
- $values->details = CRM_Utils_Array::value('receipt_text', $params);
+ $values->details = $params['receipt_text'] ?? NULL;
CRM_Activity_BAO_Activity::addActivity($values, 'Email');
break;
}
@@ -1732,7 +1732,7 @@ public function buildEventFeeForm($form) {
CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId);
$lineItem = [];
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$totalTaxAmount = 0;
if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) {
$lineItem[] = $form->_values['line_items'];
@@ -1907,8 +1907,8 @@ protected function preparePaidEventProcessing($params): array {
//CRM-11529 for quick config backoffice transactions
//when financial_type_id is passed in form, update the
//lineitems with the financial type selected in form
- $submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $params);
- $isPaymentRecorded = CRM_Utils_Array::value('record_contribution', $params);
+ $submittedFinancialType = $params['financial_type_id'] ?? NULL;
+ $isPaymentRecorded = $params['record_contribution'] ?? NULL;
if ($isPaymentRecorded && $this->_quickConfig && $submittedFinancialType) {
foreach ($lineItem[0] as &$values) {
$values['financial_type_id'] = $submittedFinancialType;
@@ -1984,7 +1984,7 @@ protected function assignEventDetailsToTpl($eventID, $participantRoles, $receipt
$event['participant_role'] = implode(', ', $selectedRoles);
}
else {
- $event['participant_role'] = CRM_Utils_Array::value($participantRoles, $role);
+ $event['participant_role'] = $role[$participantRoles] ?? NULL;
}
$event['is_monetary'] = $isPaidEvent;
diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php
index bc604dbbc2f9..9cfa7ce2dab2 100644
--- a/CRM/Event/Form/ParticipantFeeSelection.php
+++ b/CRM/Event/Form/ParticipantFeeSelection.php
@@ -296,7 +296,7 @@ public function emailReceipt(&$params) {
unset($event['end_date']);
$role = CRM_Event_PseudoConstant::participantRole();
- $participantRoles = CRM_Utils_Array::value('role_id', $params);
+ $participantRoles = $params['role_id'] ?? NULL;
if (is_array($participantRoles)) {
$selectedRoles = [];
foreach (array_keys($participantRoles) as $roleId) {
@@ -305,7 +305,7 @@ public function emailReceipt(&$params) {
$event['participant_role'] = implode(', ', $selectedRoles);
}
else {
- $event['participant_role'] = CRM_Utils_Array::value($participantRoles, $role);
+ $event['participant_role'] = $role[$participantRoles] ?? NULL;
}
$event['is_monetary'] = $this->_isPaidEvent;
@@ -374,8 +374,8 @@ public function emailReceipt(&$params) {
$sendTemplateParams['from'] = $receiptFrom;
$sendTemplateParams['toName'] = $this->_contributorDisplayName;
$sendTemplateParams['toEmail'] = $this->_contributorEmail;
- $sendTemplateParams['cc'] = CRM_Utils_Array::value('cc', $this->_fromEmails);
- $sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc', $this->_fromEmails);
+ $sendTemplateParams['cc'] = $this->_fromEmails['cc'] ?? NULL;
+ $sendTemplateParams['bcc'] = $this->_fromEmails['bcc'] ?? NULL;
}
list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php
index 0d67d1033edc..efe72c2e7872 100644
--- a/CRM/Event/Form/ParticipantView.php
+++ b/CRM/Event/Form/ParticipantView.php
@@ -117,7 +117,7 @@ public function preProcess() {
$values[$participantID]['lineItem'][] = $lineItem;
}
- $values[$participantID]['totalAmount'] = CRM_Utils_Array::value('fee_amount', $values[$participantID]);
+ $values[$participantID]['totalAmount'] = $values[$participantID]['fee_amount'] ?? NULL;
// Get registered_by contact ID and display_name if participant was registered by someone else (CRM-4859)
if (!empty($values[$participantID]['participant_registered_by_id'])) {
@@ -193,7 +193,7 @@ public function preProcess() {
$participantCount = [];
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$totalTaxAmount = 0;
foreach ($lineItem as $k => $v) {
if (CRM_Utils_Array::value('participant_count', $lineItem[$k]) > 0) {
@@ -211,7 +211,7 @@ public function preProcess() {
// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
CRM_Utils_System::setTitle(ts('View Event Registration for') . ' ' . $displayName);
- $roleId = CRM_Utils_Array::value('role_id', $values[$participantID]);
+ $roleId = $values[$participantID]['role_id'] ?? NULL;
$title = $displayName . ' (' . CRM_Utils_Array::value($roleId, $participantRoles) . ' - ' . $eventTitle . ')';
$sep = CRM_Core_DAO::VALUE_SEPARATOR;
diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php
index 007e9b40176e..efa71d460556 100644
--- a/CRM/Event/Form/Registration.php
+++ b/CRM/Event/Form/Registration.php
@@ -238,7 +238,7 @@ public function preProcess() {
$params = array('id' => $this->_eventId);
CRM_Event_BAO_Event::retrieve($params, $this->_values['event']);
// check for is_monetary status
- $isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']);
+ $isMonetary = $this->_values['event']['is_monetary'] ?? NULL;
// check for ability to add contributions of type
if ($isMonetary
&& CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
@@ -272,7 +272,7 @@ public function preProcess() {
if ($eventFull && !$this->_allowConfirmation) {
$this->_isEventFull = TRUE;
//lets redirecting to info only when to waiting list.
- $this->_allowWaitlist = CRM_Utils_Array::value('has_waitlist', $this->_values['event']);
+ $this->_allowWaitlist = $this->_values['event']['has_waitlist'] ?? NULL;
if (!$this->_allowWaitlist) {
CRM_Utils_System::redirect($infoUrl);
}
@@ -380,21 +380,21 @@ public function preProcess() {
// we do not want to display recently viewed items on Registration pages
$this->assign('displayRecent', FALSE);
- $isShowLocation = CRM_Utils_Array::value('is_show_location', $this->_values['event']);
+ $isShowLocation = $this->_values['event']['is_show_location'] ?? NULL;
$this->assign('isShowLocation', $isShowLocation);
// Handle PCP
$pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this);
if ($pcpId) {
$pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'event', $this->_values['event']);
$this->_pcpId = $pcp['pcpId'];
- $this->_values['event']['intro_text'] = CRM_Utils_Array::value('intro_text', $pcp['pcpInfo']);
+ $this->_values['event']['intro_text'] = $pcp['pcpInfo']['intro_text'] ?? NULL;
}
// assign all event properties so wizard templates can display event info.
$this->assign('event', $this->_values['event']);
$this->assign('location', $this->_values['location']);
$this->assign('bltID', $this->_bltID);
- $isShowLocation = CRM_Utils_Array::value('is_show_location', $this->_values['event']);
+ $isShowLocation = $this->_values['event']['is_show_location'] ?? NULL;
$this->assign('isShowLocation', $isShowLocation);
CRM_Contribute_BAO_Contribution_Utils::overrideDefaultCurrency($this->_values['event']);
@@ -405,13 +405,13 @@ public function preProcess() {
}
// Set the same value for is_billing_required as contribution page so code can be shared.
- $this->_values['is_billing_required'] = CRM_Utils_Array::value('is_billing_required', $this->_values['event']);
+ $this->_values['is_billing_required'] = $this->_values['event']['is_billing_required'] ?? NULL;
// check if billing block is required for pay later
// note that I have started removing the use of isBillingAddressRequiredForPayLater in favour of letting
// the CRM_Core_Payment_Manual class handle it - but there are ~300 references to it in the code base so only
// removing in very limited cases.
if (!empty($this->_values['event']['is_pay_later'])) {
- $this->_isBillingAddressRequiredForPayLater = CRM_Utils_Array::value('is_billing_required', $this->_values['event']);
+ $this->_isBillingAddressRequiredForPayLater = $this->_values['event']['is_billing_required'] ?? NULL;
$this->assign('isBillingAddressRequiredForPayLater', $this->_isBillingAddressRequiredForPayLater);
}
}
@@ -630,8 +630,8 @@ public static function initEventFee(&$form, $eventID, $includeExpiredFields = TR
if (is_array($discountedEvent)) {
foreach ($discountedEvent as $key => $priceSetId) {
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId);
- $priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
- $form->_values['discount'][$key] = CRM_Utils_Array::value('fields', $priceSet);
+ $priceSet = $priceSet[$priceSetId] ?? NULL;
+ $form->_values['discount'][$key] = $priceSet['fields'] ?? NULL;
$fieldID = key($form->_values['discount'][$key]);
$form->_values['discount'][$key][$fieldID]['name'] = CRM_Core_DAO::getFieldValue(
'CRM_Price_DAO_PriceSet',
@@ -641,7 +641,7 @@ public static function initEventFee(&$form, $eventID, $includeExpiredFields = TR
}
}
}
- $eventFee = CRM_Utils_Array::value('fee', $form->_values);
+ $eventFee = $form->_values['fee'] ?? NULL;
if (!is_array($eventFee) || empty($eventFee)) {
$form->_values['fee'] = array();
}
@@ -651,7 +651,7 @@ public static function initEventFee(&$form, $eventID, $includeExpiredFields = TR
$isPaidEvent = $form->_isPaidEvent;
}
else {
- $isPaidEvent = CRM_Utils_Array::value('is_monetary', $form->_values['event']);
+ $isPaidEvent = $form->_values['event']['is_monetary'] ?? NULL;
}
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()
&& !empty($form->_values['fee'])
@@ -912,7 +912,7 @@ public static function getParticipantCount(&$form, $params, $skipCurrent = FALSE
$count = 1;
$usedCache = FALSE;
- $cacheCount = CRM_Utils_Array::value($key, $form->_lineItemParticipantsCount);
+ $cacheCount = $form->_lineItemParticipantsCount[$key] ?? NULL;
if ($cacheCount && is_numeric($cacheCount)) {
$count = $cacheCount;
$usedCache = TRUE;
@@ -1212,7 +1212,7 @@ public static function resetSubmittedValue($elementName, $optionIds = array(), &
if (!is_array($values) || empty($values)) {
continue;
}
- $eleVal = CRM_Utils_Array::value($elementName, $values);
+ $eleVal = $values[$elementName] ?? NULL;
if (empty($eleVal)) {
continue;
}
@@ -1567,7 +1567,7 @@ public function processRegistration($params, $contactID = NULL) {
//lets get additional participant id to cancel.
if ($this->_allowConfirmation && is_array($cancelledIds)) {
- $additonalId = CRM_Utils_Array::value('participant_id', $value);
+ $additonalId = $value['participant_id'] ?? NULL;
if ($additonalId && $key = array_search($additonalId, $cancelledIds)) {
unset($cancelledIds[$key]);
}
diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php
index 679139f75726..c29163ef0a73 100644
--- a/CRM/Event/Form/Registration/AdditionalParticipant.php
+++ b/CRM/Event/Form/Registration/AdditionalParticipant.php
@@ -39,7 +39,7 @@ public function preProcess() {
//lets process in-queue participants.
if ($this->_participantId && $this->_additionalParticipantIds) {
- $this->_additionalParticipantId = CRM_Utils_Array::value($participantNo, $this->_additionalParticipantIds);
+ $this->_additionalParticipantId = $this->_additionalParticipantIds[$participantNo] ?? NULL;
}
$participantCnt = $participantNo + 1;
@@ -130,7 +130,7 @@ public function setDefaultValues() {
//load default campaign from page.
if (array_key_exists('participant_campaign_id', $this->_fields)) {
- $defaults['participant_campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->_values['event']);
+ $defaults['participant_campaign_id'] = $this->_values['event']['campaign_id'] ?? NULL;
}
//CRM-17865 set custom field defaults
@@ -215,7 +215,7 @@ public function buildQuickForm() {
//lets allow to become a part of runtime waiting list, if primary selected pay later.
$realPayLater = FALSE;
if (!empty($this->_values['event']['is_monetary']) && !empty($this->_values['event']['is_pay_later'])) {
- $realPayLater = CRM_Utils_Array::value('is_pay_later', $this->_params[0]);
+ $realPayLater = $this->_params[0]['is_pay_later'] ?? NULL;
}
//truly spaces are greater than required.
@@ -360,7 +360,7 @@ public static function formRule($fields, $files, $self) {
$realPayLater = FALSE;
if (!empty($self->_values['event']['is_monetary']) && !empty($self->_values['event']['is_pay_later'])) {
- $realPayLater = CRM_Utils_Array::value('is_pay_later', $self->_params[0]);
+ $realPayLater = $self->_params[0]['is_pay_later'] ?? NULL;
}
if ($button != 'skip') {
@@ -579,7 +579,7 @@ public function postProcess() {
$params['campaign_id'] = $params['participant_campaign_id'];
}
else {
- $params['campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->_values['event']);
+ $params['campaign_id'] = $this->_values['event']['campaign_id'] ?? NULL;
}
// if waiting is enabled
diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php
index 060df998c8c8..4eb2a005972d 100644
--- a/CRM/Event/Form/Registration/Confirm.php
+++ b/CRM/Event/Form/Registration/Confirm.php
@@ -227,7 +227,7 @@ public function buildQuickForm() {
}
$this->_amount[$k]['label'] = preg_replace('//', '', $v['amount_level']) . ' - ' . $append;
- $this->_part[$k]['info'] = CRM_Utils_Array::value('first_name', $v) . ' ' . CRM_Utils_Array::value('last_name', $v);
+ $this->_part[$k]['info'] = CRM_Utils_Array::value('first_name', $v) . ' ' . $v['last_name'] ?? NULL;
if (empty($v['first_name'])) {
$this->_part[$k]['info'] = $append;
}
@@ -391,7 +391,7 @@ public function postProcess() {
foreach ($this->_params as $k => $v) {
if (CRM_Utils_Array::value('amount', $this->_params[$k]) > 0 && !empty($this->_params[$k]['discountAmount'])) {
$this->_params[$k]['amount'] -= $this->_params[$k]['discountAmount'];
- $this->_params[$k]['amount_level'] .= CRM_Utils_Array::value('discountMessage', $this->_params[$k]);
+ $this->_params[$k]['amount_level'] .= $this->_params[$k]['discountMessage'] ?? NULL;
}
}
$this->set('params', $this->_params);
@@ -426,7 +426,7 @@ public function postProcess() {
}
//lets get additional participant id to cancel.
if ($this->_allowConfirmation && is_array($cancelledIds)) {
- $additonalId = CRM_Utils_Array::value('participant_id', $record);
+ $additonalId = $record['participant_id'] ?? NULL;
if ($additonalId && $key = array_search($additonalId, $cancelledIds)) {
unset($cancelledIds[$key]);
}
@@ -473,7 +473,7 @@ public function postProcess() {
//Unset ContactID for additional participants and set RegisterBy Id.
if (empty($value['is_primary'])) {
- $contactID = CRM_Utils_Array::value('contact_id', $value);
+ $contactID = $value['contact_id'] ?? NULL;
$registerByID = $this->get('registerByID');
if ($registerByID) {
$value['registered_by_id'] = $registerByID;
@@ -600,7 +600,7 @@ public function postProcess() {
//CRM-4453.
if (!empty($value['is_primary'])) {
- $primaryCurrencyID = CRM_Utils_Array::value('currencyID', $value);
+ $primaryCurrencyID = $value['currencyID'] ?? NULL;
}
if (empty($value['currencyID'])) {
$value['currencyID'] = $primaryCurrencyID;
@@ -619,12 +619,12 @@ public function postProcess() {
}
}
- $value['fee_amount'] = CRM_Utils_Array::value('amount', $value);
+ $value['fee_amount'] = $value['amount'] ?? NULL;
$this->set('value', $value);
// handle register date CRM-4320
if ($this->_allowConfirmation) {
- $registerDate = CRM_Utils_Array::value('participant_register_date', $params);
+ $registerDate = $params['participant_register_date'] ?? NULL;
}
elseif (!empty($params['participant_register_date']) &&
is_array($params['participant_register_date'])
@@ -680,10 +680,10 @@ public function postProcess() {
if (isset($line['tax_amount']) && isset($line['tax_rate'])) {
$totalTaxAmount = $line['tax_amount'] + $totalTaxAmount;
if (isset($dataArray[$line['tax_rate']])) {
- $dataArray[$line['tax_rate']] = $dataArray[$line['tax_rate']] + CRM_Utils_Array::value('tax_amount', $line);
+ $dataArray[$line['tax_rate']] = $dataArray[$line['tax_rate']] + $line['tax_amount'] ?? NULL;
}
else {
- $dataArray[$line['tax_rate']] = CRM_Utils_Array::value('tax_amount', $line);
+ $dataArray[$line['tax_rate']] = $line['tax_amount'] ?? NULL;
}
}
}
@@ -1049,7 +1049,7 @@ public static function fixLocationFields(&$params, &$fields, &$form) {
// Add the billing names to the billing address, if a billing name is set
if (!empty($params['billing_first_name'])) {
- $params["address_name-{$form->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . CRM_Utils_Array::value('billing_last_name', $params);
+ $params["address_name-{$form->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . $params['billing_last_name'] ?? NULL;
$fields["address_name-{$form->_bltID}"] = 1;
}
@@ -1156,7 +1156,7 @@ public static function updateContactFields($contactID, $params, $fields, &$form)
//get email primary first if exist
$subscriptionEmail = ['email' => CRM_Utils_Array::value('email-Primary', $params)];
if (!$subscriptionEmail['email']) {
- $subscriptionEmail['email'] = CRM_Utils_Array::value("email-{$form->_bltID}", $params);
+ $subscriptionEmail['email'] = $params["email-{$form->_bltID}"] ?? NULL;
}
// subscribing contact to groups
if (!empty($subscribeGroupIds) && $subscriptionEmail['email']) {
@@ -1200,7 +1200,7 @@ public static function assignProfiles($form) {
if (count($values)) {
$formattedValues[$count][$prefix1 . 'CustomPre'] = $values;
}
- $formattedValues[$count][$prefix1 . 'CustomPreGroupTitle'] = CRM_Utils_Array::value('groupTitle', $groupName);
+ $formattedValues[$count][$prefix1 . 'CustomPreGroupTitle'] = $groupName['groupTitle'] ?? NULL;
}
//get the customPost profile info
if (!empty($form->_values[$prefix2 . 'custom_post_id'])) {
@@ -1259,9 +1259,9 @@ public static function testSubmit($params) {
// This happens in buildQuickForm so emulate here.
$form->_amount = $form->_totalAmount = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('totalAmount', $params));
$form->set('params', $params['params']);
- $form->_values['custom_pre_id'] = CRM_Utils_Array::value('custom_pre_id', $params);
- $form->_values['custom_post_id'] = CRM_Utils_Array::value('custom_post_id', $params);
- $form->_values['event'] = CRM_Utils_Array::value('event', $params);
+ $form->_values['custom_pre_id'] = $params['custom_pre_id'] ?? NULL;
+ $form->_values['custom_post_id'] = $params['custom_post_id'] ?? NULL;
+ $form->_values['event'] = $params['event'] ?? NULL;
$form->_contributeMode = $params['contributeMode'];
$eventParams = ['id' => $params['id']];
CRM_Event_BAO_Event::retrieve($eventParams, $form->_values['event']);
diff --git a/CRM/Event/Form/Registration/ParticipantConfirm.php b/CRM/Event/Form/Registration/ParticipantConfirm.php
index 6c23fce62082..4a4b95b5c0c5 100644
--- a/CRM/Event/Form/Registration/ParticipantConfirm.php
+++ b/CRM/Event/Form/Registration/ParticipantConfirm.php
@@ -50,9 +50,9 @@ public function preProcess() {
);
}
- $this->_participantStatusId = CRM_Utils_Array::value('status_id', $values);
- $this->_eventId = CRM_Utils_Array::value('event_id', $values);
- $csContactId = CRM_Utils_Array::value('contact_id', $values);
+ $this->_participantStatusId = $values['status_id'] ?? NULL;
+ $this->_eventId = $values['event_id'] ?? NULL;
+ $csContactId = $values['contact_id'] ?? NULL;
// make sure we have right permission to edit this user
$this->_csContactID = NULL;
diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php
index acbc6afed2f6..1d326b88eaa6 100644
--- a/CRM/Event/Form/Registration/Register.php
+++ b/CRM/Event/Form/Registration/Register.php
@@ -152,7 +152,7 @@ public function preProcess() {
$this->_allowWaitlist = FALSE;
if ($eventFull && !$this->_allowConfirmation && !empty($this->_values['event']['has_waitlist'])) {
$this->_allowWaitlist = TRUE;
- $this->_waitlistMsg = CRM_Utils_Array::value('waitlist_text', $this->_values['event']);
+ $this->_waitlistMsg = $this->_values['event']['waitlist_text'] ?? NULL;
if (!$this->_waitlistMsg) {
$this->_waitlistMsg = ts('This event is currently full. However you can register now and get added to a waiting list. You will be notified if spaces become available.');
}
@@ -523,14 +523,14 @@ public static function buildAmount(&$form, $required = TRUE, $discountId = NULL)
return;
}
- $feeFields = CRM_Utils_Array::value('fee', $form->_values);
+ $feeFields = $form->_values['fee'] ?? NULL;
if (is_array($feeFields)) {
$form->_feeBlock = &$form->_values['fee'];
}
//check for discount.
- $discountedFee = CRM_Utils_Array::value('discount', $form->_values);
+ $discountedFee = $form->_values['discount'] ?? NULL;
if (is_array($discountedFee) && !empty($discountedFee)) {
if (!$discountId) {
$form->_discountId = $discountId = CRM_Core_BAO_Discount::findSet($form->_eventId, 'civicrm_event');
@@ -586,13 +586,13 @@ public static function buildAmount(&$form, $required = TRUE, $discountId = NULL)
$fieldId = $field['id'];
$elementName = 'price_' . $fieldId;
- $isRequire = CRM_Utils_Array::value('is_required', $field);
+ $isRequire = $field['is_required'] ?? NULL;
if ($button == 'skip') {
$isRequire = FALSE;
}
//user might modified w/ hook.
- $options = CRM_Utils_Array::value('options', $field);
+ $options = $field['options'] ?? NULL;
$formClasses = ['CRM_Event_Form_Participant', 'CRM_Event_Form_ParticipantFeeSelection'];
if (!is_array($options)) {
@@ -654,7 +654,7 @@ public static function buildAmount(&$form, $required = TRUE, $discountId = NULL)
}
$form->assign('eventFeeBlockValues', json_encode($eventFeeBlockValues));
- $form->_defaults['amount'] = CRM_Utils_Array::value('default_fee_id', $form->_values['event']);
+ $form->_defaults['amount'] = $form->_values['event']['default_fee_id'] ?? NULL;
$element = &$form->addGroup($elements, 'amount', ts('Event Fee(s)'), '
');
if (isset($form->_online) && $form->_online) {
$element->freeze();
@@ -731,7 +731,7 @@ public static function formatFieldsForOptionFull(&$form) {
$optionFullIds[$optId] = $optId;
if ($field['html_type'] != 'Select') {
if (in_array($optId, $defaultPricefieldIds)) {
- $optionFullTotalAmount += CRM_Utils_Array::value('amount', $option);
+ $optionFullTotalAmount += $option['amount'] ?? NULL;
}
}
else {
@@ -967,7 +967,7 @@ public function postProcess() {
$params['campaign_id'] = $params['participant_campaign_id'];
}
else {
- $params['campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->_values['event']);
+ $params['campaign_id'] = $this->_values['event']['campaign_id'] ?? NULL;
}
//hack to allow group to register w/ waiting
diff --git a/CRM/Event/Form/SelfSvcTransfer.php b/CRM/Event/Form/SelfSvcTransfer.php
index 6dc21ffd9924..d44012ff4185 100644
--- a/CRM/Event/Form/SelfSvcTransfer.php
+++ b/CRM/Event/Form/SelfSvcTransfer.php
@@ -432,14 +432,14 @@ public function participantTransfer($participant) {
$eventParams = ['id' => $participant->event_id];
CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails);
//get default participant role.
- $eventDetails['participant_role'] = CRM_Utils_Array::value($eventDetails['default_role_id'], $participantRoles);
+ $eventDetails['participant_role'] = $participantRoles[$eventDetails['default_role_id']] ?? NULL;
//get the location info
$locParams = [
'entity_id' => $participant->event_id,
'entity_table' => 'civicrm_event',
];
$eventDetails['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
- $toEmail = CRM_Utils_Array::value('email', $contactDetails[$participant->contact_id]);
+ $toEmail = $contactDetails[$participant->contact_id]['email'] ?? NULL;
if ($toEmail) {
//take a receipt from as event else domain.
$receiptFrom = $domainValues['name'] . ' <' . $domainValues['email'] . '>';
@@ -512,7 +512,7 @@ public function sendCancellation() {
$eventParams = ['id' => $this->_event_id];
CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
//get default participant role.
- $eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
+ $eventDetails[$this->_event_id]['participant_role'] = $participantRoles[$eventDetails[$this->_event_id]['default_role_id']] ?? NULL;
//get the location info
$locParams = ['entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event'];
$eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
diff --git a/CRM/Event/Form/SelfSvcUpdate.php b/CRM/Event/Form/SelfSvcUpdate.php
index 760478a0588d..33b9f7f3f878 100644
--- a/CRM/Event/Form/SelfSvcUpdate.php
+++ b/CRM/Event/Form/SelfSvcUpdate.php
@@ -289,7 +289,7 @@ public function cancelParticipant($params) {
$eventParams = ['id' => $this->_event_id];
CRM_Event_BAO_Event::retrieve($eventParams, $eventDetails[$this->_event_id]);
//get default participant role.
- $eventDetails[$this->_event_id]['participant_role'] = CRM_Utils_Array::value($eventDetails[$this->_event_id]['default_role_id'], $participantRoles);
+ $eventDetails[$this->_event_id]['participant_role'] = $participantRoles[$eventDetails[$this->_event_id]['default_role_id']] ?? NULL;
//get the location info
$locParams = ['entity_id' => $this->_event_id, 'entity_table' => 'civicrm_event'];
$eventDetails[$this->_event_id]['location'] = CRM_Core_BAO_Location::getValues($locParams, TRUE);
diff --git a/CRM/Event/Form/Task/AddToGroup.php b/CRM/Event/Form/Task/AddToGroup.php
index 69d7f6a5ddd5..87c47c3fa6ee 100644
--- a/CRM/Event/Form/Task/AddToGroup.php
+++ b/CRM/Event/Form/Task/AddToGroup.php
@@ -189,7 +189,7 @@ public static function formRule($params) {
*/
public function postProcess() {
$params = $this->controller->exportValues();
- $groupOption = CRM_Utils_Array::value('group_option', $params, NULL);
+ $groupOption = $params['group_option'] ?? NULL;
if ($groupOption) {
$groupParams = [];
$groupParams['title'] = $params['title'];
diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php
index 2bd7321de6bd..3979b29edd7e 100644
--- a/CRM/Event/Form/Task/Batch.php
+++ b/CRM/Event/Form/Task/Batch.php
@@ -165,14 +165,14 @@ public function buildQuickForm() {
$eventTypeId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $eventId, 'event_type_id');
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
- $customValue = CRM_Utils_Array::value($customFieldID, $this->_customFields);
+ $customValue = $this->_customFields[$customFieldID] ?? NULL;
$entityColumnValue = [];
if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$customValue['extends_entity_column_value']
);
}
- $entityColumnValueRole = CRM_Utils_Array::value($roleId, $entityColumnValue);
+ $entityColumnValueRole = $entityColumnValue[$roleId] ?? NULL;
$entityColumnValueEventType = in_array($eventTypeId, $entityColumnValue) ? $eventTypeId : NULL;
if (($this->_roleCustomDataTypeID == $customValue['extends_entity_column_id']) &&
($entityColumnValueRole)
@@ -235,7 +235,7 @@ public function setDefaultValues() {
//get the from status ids, CRM-4323
if (array_key_exists('participant_status', $this->_fields)) {
- $this->_fromStatusIds[$participantId] = CRM_Utils_Array::value("field[$participantId][participant_status]", $defaults);
+ $this->_fromStatusIds[$participantId] = $defaults["field[$participantId][participant_status]"] ?? NULL;
}
if (array_key_exists('participant_role', $this->_fields)) {
if ($defaults["field[{$participantId}][participant_role]"]) {
@@ -325,10 +325,10 @@ public static function updatePendingOnlineContribution($participantId, $statusId
*/
public static function updateContributionStatus($params) {
// get minimum required values.
- $statusId = CRM_Utils_Array::value('contribution_status_id', $params);
- $componentId = CRM_Utils_Array::value('component_id', $params);
- $componentName = CRM_Utils_Array::value('componentName', $params);
- $contributionId = CRM_Utils_Array::value('contribution_id', $params);
+ $statusId = $params['contribution_status_id'] ?? NULL;
+ $componentId = $params['component_id'] ?? NULL;
+ $componentName = $params['componentName'] ?? NULL;
+ $contributionId = $params['contribution_id'] ?? NULL;
if (!$contributionId || !$componentId || !$componentName || !$statusId) {
return NULL;
@@ -383,7 +383,7 @@ public static function updateContributionStatus($params) {
'labelColumn' => 'name',
'flip' => 1,
]);
- $input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] = CRM_Utils_Array::value('IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved', $params);
+ $input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] = $params['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] ?? NULL;
if ($statusId == $contributionStatuses['Cancelled']) {
$baseIPN->cancelled($objects, $transaction, $input);
$transaction->commit();
@@ -487,7 +487,7 @@ public function submit($params) {
$relatedStatusChange = FALSE;
if (!empty($value['participant_status'])) {
$value['status_id'] = $value['participant_status'];
- $fromStatusId = CRM_Utils_Array::value($key, $this->_fromStatusIds);
+ $fromStatusId = $this->_fromStatusIds[$key] ?? NULL;
if (!$fromStatusId) {
$fromStatusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $key, 'status_id');
}
diff --git a/CRM/Event/Import/Form/MapField.php b/CRM/Event/Import/Form/MapField.php
index 6e0f51c1e0a6..b418566f2b28 100644
--- a/CRM/Event/Import/Form/MapField.php
+++ b/CRM/Event/Import/Form/MapField.php
@@ -100,9 +100,9 @@ public function buildQuickForm() {
$mappingName = $mappingName[1];
$mappingContactType = $mappingContactType[1];
- $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
- $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
- $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
+ $mappingLocation = $mappingLocation['1'] ?? NULL;
+ $mappingPhoneType = $mappingPhoneType['1'] ?? NULL;
+ $mappingRelation = $mappingRelation['1'] ?? NULL;
//mapping is to be loaded from database
@@ -339,7 +339,7 @@ public static function formRule($fields, $files, $self) {
}
if (!empty($fields['saveMapping'])) {
- $nameField = CRM_Utils_Array::value('saveMappingName', $fields);
+ $nameField = $fields['saveMappingName'] ?? NULL;
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
}
@@ -352,7 +352,7 @@ public static function formRule($fields, $files, $self) {
//display Error if loaded mapping is not selected
if (array_key_exists('loadMapping', $fields)) {
- $getMapName = CRM_Utils_Array::value('savedMapping', $fields);
+ $getMapName = $fields['savedMapping'] ?? NULL;
if (empty($getMapName)) {
$errors['savedMapping'] = ts('Select saved mapping');
}
@@ -428,9 +428,9 @@ public function postProcess() {
$updateMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = $explodedValues[0] ?? NULL;
+ $first = $explodedValues[1] ?? NULL;
+ $second = $explodedValues[2] ?? NULL;
$updateMappingFields->name = $mapper[$i];
$updateMappingFields->save();
@@ -452,9 +452,9 @@ public function postProcess() {
$saveMappingFields->column_number = $i;
$explodedValues = explode('_', $mapperKeys[$i][0]);
- $id = CRM_Utils_Array::value(0, $explodedValues);
- $first = CRM_Utils_Array::value(1, $explodedValues);
- $second = CRM_Utils_Array::value(2, $explodedValues);
+ $id = $explodedValues[0] ?? NULL;
+ $first = $explodedValues[1] ?? NULL;
+ $second = $explodedValues[2] ?? NULL;
$saveMappingFields->name = $mapper[$i];
$saveMappingFields->save();
diff --git a/CRM/Event/Import/Parser/Participant.php b/CRM/Event/Import/Parser/Participant.php
index 7e362d540a9a..c5c47da4c6d8 100644
--- a/CRM/Event/Import/Parser/Participant.php
+++ b/CRM/Event/Import/Parser/Participant.php
@@ -443,8 +443,8 @@ public function import($onDuplicate, &$values) {
if (is_array($newParticipant) && civicrm_error($newParticipant)) {
if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
- $contactID = CRM_Utils_Array::value('contactID', $newParticipant);
- $participantID = CRM_Utils_Array::value('participantID', $newParticipant);
+ $contactID = $newParticipant['contactID'] ?? NULL;
+ $participantID = $newParticipant['participantID'] ?? NULL;
$url = CRM_Utils_System::url('civicrm/contact/view/participant',
"reset=1&id={$participantID}&cid={$contactID}&action=view", TRUE
);
@@ -463,7 +463,7 @@ public function import($onDuplicate, &$values) {
}
if (!(is_array($newParticipant) && civicrm_error($newParticipant))) {
- $this->_newParticipants[] = CRM_Utils_Array::value('id', $newParticipant);
+ $this->_newParticipants[] = $newParticipant['id'] ?? NULL;
}
return CRM_Import_Parser::VALID;
@@ -535,8 +535,8 @@ protected function formatValues(&$values, $params) {
elseif ($type == 'Select' || $type == 'Radio') {
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
foreach ($customOption as $customFldID => $customValue) {
- $val = CRM_Utils_Array::value('value', $customValue);
- $label = CRM_Utils_Array::value('label', $customValue);
+ $val = $customValue['value'] ?? NULL;
+ $label = $customValue['label'] ?? NULL;
$label = strtolower($label);
$value = strtolower(trim($value));
if (($value == $label) || ($value == strtolower($val))) {
diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php
index e78686c32510..c07681da8bbc 100644
--- a/CRM/Event/Page/EventInfo.php
+++ b/CRM/Event/Page/EventInfo.php
@@ -117,7 +117,7 @@ public function run() {
$values['feeBlock']['value'][$fieldCnt] = '';
$values['feeBlock']['label'][$fieldCnt] = $fieldValues['label'];
$values['feeBlock']['lClass'][$fieldCnt] = 'price_set_option_group-label';
- $values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
+ $values['feeBlock']['isDisplayAmount'][$fieldCnt] = $fieldValues['is_display_amounts'] ?? NULL;
$fieldCnt++;
$labelClass = 'price_set_option-label';
}
@@ -126,9 +126,9 @@ public function run() {
}
// show tax rate with amount
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
- $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings);
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $taxTerm = $invoiceSettings['tax_term'] ?? NULL;
+ $displayOpt = $invoiceSettings['tax_display_settings'] ?? NULL;
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
foreach ($fieldValues['options'] as $optionId => $optionVal) {
if (CRM_Utils_Array::value('visibility_id', $optionVal) != array_search('public', $visibility) &&
$adminFieldVisible == FALSE
@@ -136,7 +136,7 @@ public function run() {
continue;
}
- $values['feeBlock']['isDisplayAmount'][$fieldCnt] = CRM_Utils_Array::value('is_display_amounts', $fieldValues);
+ $values['feeBlock']['isDisplayAmount'][$fieldCnt] = $fieldValues['is_display_amounts'] ?? NULL;
if ($invoicing && isset($optionVal['tax_amount'])) {
$values['feeBlock']['value'][$fieldCnt] = CRM_Price_BAO_PriceField::getTaxLabel($optionVal, 'amount', $displayOpt, $taxTerm);
$values['feeBlock']['tax_amount'][$fieldCnt] = $optionVal['tax_amount'];
@@ -238,7 +238,7 @@ public function run() {
$this->assign('findParticipants', $findParticipants);
}
- $participantListingID = CRM_Utils_Array::value('participant_listing_id', $values['event']);
+ $participantListingID = $values['event']['participant_listing_id'] ?? NULL;
if ($participantListingID) {
$participantListingURL = CRM_Utils_System::url('civicrm/event/participant',
"reset=1&id={$this->_id}",
@@ -247,7 +247,7 @@ public function run() {
$this->assign('participantListingURL', $participantListingURL);
}
- $hasWaitingList = CRM_Utils_Array::value('has_waitlist', $values['event']);
+ $hasWaitingList = $values['event']['has_waitlist'] ?? NULL;
$eventFullMessage = CRM_Event_BAO_Participant::eventFull($this->_id,
FALSE,
$hasWaitingList
@@ -317,7 +317,7 @@ public function run() {
}
}
elseif ($hasWaitingList) {
- $statusMessage = CRM_Utils_Array::value('waitlist_text', $values['event']);
+ $statusMessage = $values['event']['waitlist_text'] ?? NULL;
if (!$statusMessage) {
$statusMessage = ts('Event is currently full, but you can register and be a part of waiting list.');
}
diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php
index a0b7c3b2836c..20b4ed5e86e0 100644
--- a/CRM/Event/Page/ManageEvent.php
+++ b/CRM/Event/Page/ManageEvent.php
@@ -416,10 +416,10 @@ public function browse() {
}
//show campaigns on selector.
- $manageEvent[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
+ $manageEvent[$dao->id]['campaign'] = $allCampaigns[$dao->campaign_id] ?? NULL;
$manageEvent[$dao->id]['reminder'] = CRM_Core_BAO_ActionSchedule::isConfigured($dao->id, $mapping->getId());
- $manageEvent[$dao->id]['is_pcp_enabled'] = CRM_Utils_Array::value($dao->id, $eventPCPS);
- $manageEvent[$dao->id]['event_type'] = CRM_Utils_Array::value($manageEvent[$dao->id]['event_type_id'], $eventType);
+ $manageEvent[$dao->id]['is_pcp_enabled'] = $eventPCPS[$dao->id] ?? NULL;
+ $manageEvent[$dao->id]['event_type'] = $eventType[$manageEvent[$dao->id]['event_type_id']] ?? NULL;
$manageEvent[$dao->id]['is_repeating_event'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_RecurringEntity', $dao->id, 'parent_id', 'entity_id');
// allow hooks to set 'field' value which allows configuration pop-up to show a tab as enabled/disabled
CRM_Utils_Hook::tabset('civicrm/event/manage/rows', $manageEvent, ['event_id' => $dao->id]);
diff --git a/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php b/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php
index fef5ae7b12e1..8277180b5243 100644
--- a/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php
+++ b/CRM/Event/Page/ParticipantListing/NameStatusAndDate.php
@@ -86,7 +86,7 @@ public function run() {
$object = CRM_Core_DAO::executeQuery($query, $params);
$statusLookup = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
while ($object->fetch()) {
- $status = CRM_Utils_Array::value($object->status_id, $statusLookup);
+ $status = $statusLookup[$object->status_id] ?? NULL;
$row = [
'id' => $object->contact_id,
'participantID' => $object->participant_id,
diff --git a/CRM/Event/Selector/Search.php b/CRM/Event/Selector/Search.php
index 1c5f4b027a65..46dcfeb2e2c8 100644
--- a/CRM/Event/Selector/Search.php
+++ b/CRM/Event/Selector/Search.php
@@ -333,7 +333,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
}
//carry campaign on selectors.
- $row['campaign'] = CRM_Utils_Array::value($result->participant_campaign_id, $allCampaigns);
+ $row['campaign'] = $allCampaigns[$result->participant_campaign_id] ?? NULL;
$row['campaign_id'] = $result->participant_campaign_id;
// gross hack to show extra information for pending status
diff --git a/CRM/Event/StateMachine/Search.php b/CRM/Event/StateMachine/Search.php
index 0c76eb6cdef3..f98de49db6e3 100644
--- a/CRM/Event/StateMachine/Search.php
+++ b/CRM/Event/StateMachine/Search.php
@@ -71,7 +71,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) {
*/
public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
- $value = CRM_Utils_Array::value('task', $_POST);
+ $value = $_POST['task'] ?? NULL;
if (!isset($value)) {
$value = $this->_controller->get('task');
}
diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php
index 8453d02475b4..9dded52787a2 100644
--- a/CRM/Export/BAO/ExportProcessor.php
+++ b/CRM/Export/BAO/ExportProcessor.php
@@ -1006,7 +1006,7 @@ public function buildRow($query, $iterationDAO, $outputColumns, $metadata, $paym
$fieldValue = $phoneTypes[$fieldValue];
}
elseif ($field == 'provider_id' || $field == 'im_provider') {
- $fieldValue = CRM_Utils_Array::value($fieldValue, $imProviders);
+ $fieldValue = $imProviders[$fieldValue] ?? NULL;
}
elseif (strstr($field, 'master_id')) {
// @todo - why not just $field === 'master_id' - what else would it be?
@@ -1031,7 +1031,7 @@ public function buildRow($query, $iterationDAO, $outputColumns, $metadata, $paym
if (!$this->isExportSpecifiedPaymentFields()) {
$nullContributionDetails = array_fill_keys(array_keys($this->getPaymentHeaders()), NULL);
if ($this->isExportPaymentFields()) {
- $paymentData = CRM_Utils_Array::value($row[$paymentTableId], $paymentDetails);
+ $paymentData = $paymentDetails[$row[$paymentTableId]] ?? NULL;
if (!is_array($paymentData) || empty($paymentData)) {
$paymentData = $nullContributionDetails;
}
@@ -1170,7 +1170,7 @@ public function getTransformedFieldValue($field, $iterationDAO, $fieldValue, $me
}
elseif ($this->isExportSpecifiedPaymentFields() && array_key_exists($field, $this->getcomponentPaymentFields())) {
$paymentTableId = $this->getPaymentTableID();
- $paymentData = CRM_Utils_Array::value($iterationDAO->$paymentTableId, $paymentDetails);
+ $paymentData = $paymentDetails[$iterationDAO->$paymentTableId] ?? NULL;
$payFieldMapper = [
'componentPaymentField_total_amount' => 'total_amount',
'componentPaymentField_contribution_status' => 'contribution_status',
@@ -1357,7 +1357,7 @@ public function getDefaultReturnProperties() {
public function setRelationshipReturnProperties($value, $relationshipKey) {
$relationField = $value['name'];
$relIMProviderId = NULL;
- $relLocTypeId = CRM_Utils_Array::value('location_type_id', $value);
+ $relLocTypeId = $value['location_type_id'] ?? NULL;
$locationName = CRM_Core_PseudoConstant::getName('CRM_Core_BAO_Address', 'location_type_id', $relLocTypeId);
$relPhoneTypeId = CRM_Utils_Array::value('phone_type_id', $value, ($locationName ? 'Primary' : NULL));
$relIMProviderId = CRM_Utils_Array::value('im_provider_id', $value, ($locationName ? 'Primary' : NULL));
@@ -2104,7 +2104,7 @@ protected function setGreetingStringsForSameAddressMerge($formValues) {
if (!empty($greetingOptions)) {
// Greeting options is keyed by 'postal_greeting' or 'addressee'.
foreach ($greetingOptions as $key => $value) {
- $option = CRM_Utils_Array::value($key, $formValues);
+ $option = $formValues[$key] ?? NULL;
if ($option) {
if ($greetingOptions[$key][$option] == ts('Other')) {
$formValues[$key] = $formValues["{$key}_other"];
@@ -2185,7 +2185,7 @@ public function fetchRelationshipDetails($relDAO, $value, $field, &$row) {
$fieldValue = $phoneTypes[$relationValue];
}
elseif ($relationField == 'provider_id') {
- $fieldValue = CRM_Utils_Array::value($relationValue, $imProviders);
+ $fieldValue = $imProviders[$relationValue] ?? NULL;
}
// CRM-13995
elseif (is_object($relDAO) && in_array($relationField, [
diff --git a/CRM/Export/Form/Select.php b/CRM/Export/Form/Select.php
index 043c277154ae..af4b2bba7f5e 100644
--- a/CRM/Export/Form/Select.php
+++ b/CRM/Export/Form/Select.php
@@ -340,7 +340,7 @@ public static function formRule($params, $files, $self) {
];
foreach ($greetings as $key => $value) {
- $otherOption = CRM_Utils_Array::value($key, $params);
+ $otherOption = $params[$key] ?? NULL;
if ((CRM_Utils_Array::value($otherOption, $self->_greetingOptions[$key]) == ts('Other')) && empty($params[$value])) {
@@ -372,7 +372,7 @@ public function postProcess() {
// all submitted options or any other argument
$exportParams = $params;
- $mappingId = CRM_Utils_Array::value('mapping', $params);
+ $mappingId = $params['mapping'] ?? NULL;
if ($mappingId) {
$this->set('mappingId', $mappingId);
}
diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php
index 0b235a72ef69..9048d99028a8 100644
--- a/CRM/Financial/BAO/FinancialAccount.php
+++ b/CRM/Financial/BAO/FinancialAccount.php
@@ -379,7 +379,7 @@ public static function checkFinancialTypeHasDeferred($params, $contributionID =
if (!Civi::settings()->get('deferred_revenue_enabled')) {
return FALSE;
}
- $recognitionDate = CRM_Utils_Array::value('revenue_recognition_date', $params);
+ $recognitionDate = $params['revenue_recognition_date'] ?? NULL;
if (!(!CRM_Utils_System::isNull($recognitionDate)
|| ($contributionID && isset($params['prevContribution'])
&& !CRM_Utils_System::isNull($params['prevContribution']->revenue_recognition_date)))
@@ -387,8 +387,8 @@ public static function checkFinancialTypeHasDeferred($params, $contributionID =
return FALSE;
}
- $lineItems = CRM_Utils_Array::value('line_item', $params);
- $financialTypeID = CRM_Utils_Array::value('financial_type_id', $params);
+ $lineItems = $params['line_item'] ?? NULL;
+ $financialTypeID = $params['financial_type_id'] ?? NULL;
if (!$financialTypeID) {
$financialTypeID = $params['prevContribution']->financial_type_id;
}
diff --git a/CRM/Financial/BAO/FinancialItem.php b/CRM/Financial/BAO/FinancialItem.php
index 378f98eff628..60c6332f6c32 100644
--- a/CRM/Financial/BAO/FinancialItem.php
+++ b/CRM/Financial/BAO/FinancialItem.php
@@ -86,7 +86,7 @@ public static function add($lineItem, $contribution, $taxTrxnID = FALSE, $trxnId
if ($taxTrxnID) {
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
+ $taxTerm = $invoiceSettings['tax_term'] ?? NULL;
$params['amount'] = $lineItem->tax_amount;
$params['description'] = $taxTerm;
$accountRelName = 'Sales Tax Account is';
@@ -142,7 +142,7 @@ public static function create(&$params, $ids = NULL, $trxnIds = NULL) {
}
$financialItem->save();
- $financialtrxnIDS = CRM_Utils_Array::value('id', $trxnIds);
+ $financialtrxnIDS = $trxnIds['id'] ?? NULL;
if (!empty($financialtrxnIDS)) {
if (!is_array($financialtrxnIDS)) {
$financialtrxnIDS = [$financialtrxnIDS];
diff --git a/CRM/Financial/BAO/FinancialType.php b/CRM/Financial/BAO/FinancialType.php
index c551d6752987..65c20c022105 100644
--- a/CRM/Financial/BAO/FinancialType.php
+++ b/CRM/Financial/BAO/FinancialType.php
@@ -90,7 +90,7 @@ public static function add(&$params, &$ids = []) {
$financialType = new CRM_Financial_DAO_FinancialType();
$financialType->copyValues($params);
if (!empty($ids['financialType'])) {
- $financialType->id = CRM_Utils_Array::value('financialType', $ids);
+ $financialType->id = $ids['financialType'] ?? NULL;
if (self::isACLFinancialTypeStatus()) {
$prevName = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $financialType->id, 'name');
if ($prevName != $params['name']) {
diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php
index 9f5e0ad55032..8a06f7f26cc3 100644
--- a/CRM/Financial/BAO/Payment.php
+++ b/CRM/Financial/BAO/Payment.php
@@ -450,7 +450,7 @@ protected static function getPayableLineItems($params): array {
$lineItems[$lineItemID]['balance'] = $lineItem['subTotal'] - $lineItems[$lineItemID]['paid'];
if (!empty($lineItemOverrides)) {
- $lineItems[$lineItemID]['allocation'] = CRM_Utils_Array::value($lineItemID, $lineItemOverrides);
+ $lineItems[$lineItemID]['allocation'] = $lineItemOverrides[$lineItemID] ?? NULL;
}
else {
$lineItems[$lineItemID]['allocation'] = $lineItems[$lineItemID]['balance'] * $ratio;
diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php
index b577a7fca64a..ef1f7ec3a421 100644
--- a/CRM/Financial/BAO/PaymentProcessor.php
+++ b/CRM/Financial/BAO/PaymentProcessor.php
@@ -262,8 +262,8 @@ public static function getTestProcessorId($id) {
* @return int
*/
public static function defaultComparison($processor1, $processor2) {
- $p1 = CRM_Utils_Array::value('is_default', $processor1);
- $p2 = CRM_Utils_Array::value('is_default', $processor2);
+ $p1 = $processor1['is_default'] ?? NULL;
+ $p2 = $processor2['is_default'] ?? NULL;
if ($p1 == $p2) {
return 0;
}
diff --git a/CRM/Financial/Form/BatchTransaction.php b/CRM/Financial/Form/BatchTransaction.php
index 408a84e72911..7b2cf8abbf62 100644
--- a/CRM/Financial/Form/BatchTransaction.php
+++ b/CRM/Financial/Form/BatchTransaction.php
@@ -38,7 +38,7 @@ public function preProcess() {
// This reuses some styles from search forms
CRM_Core_Resources::singleton()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
- self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : CRM_Utils_Array::value('batch_id', $_POST);
+ self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : $_POST['batch_id'] ?? NULL;
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php
index 4058a29efe6e..9f406563d71a 100644
--- a/CRM/Financial/Form/FinancialTypeAccount.php
+++ b/CRM/Financial/Form/FinancialTypeAccount.php
@@ -143,7 +143,7 @@ public function buildQuickForm() {
if ($this->_action == CRM_Core_Action::ADD) {
if (!empty($this->_submitValues['account_relationship']) || !empty($this->_submitValues['financial_account_id'])) {
$financialAccountType = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations();
- $financialAccountType = CRM_Utils_Array::value($this->_submitValues['account_relationship'], $financialAccountType);
+ $financialAccountType = $financialAccountType[$this->_submitValues['account_relationship']] ?? NULL;
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
$financialAccountSelect = ['' => ts('- select -')] + $result;
diff --git a/CRM/Financial/Form/PaymentEdit.php b/CRM/Financial/Form/PaymentEdit.php
index 06acbd9521b9..f131ef76776b 100644
--- a/CRM/Financial/Form/PaymentEdit.php
+++ b/CRM/Financial/Form/PaymentEdit.php
@@ -156,11 +156,11 @@ public function postProcess() {
$paymentInstrumentName = CRM_Core_PseudoConstant::getName('CRM_Financial_DAO_FinancialTrxn', 'payment_instrument_id', $params['payment_instrument_id']);
if ($paymentInstrumentName == 'Credit Card') {
- $params['card_type_id'] = CRM_Utils_Array::value('card_type_id', $this->_submitValues);
- $params['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $this->_submitValues);
+ $params['card_type_id'] = $this->_submitValues['card_type_id'] ?? NULL;
+ $params['pan_truncation'] = $this->_submitValues['pan_truncation'] ?? NULL;
}
elseif ($paymentInstrumentName == 'Check') {
- $params['check_number'] = CRM_Utils_Array::value('check_number', $this->_submitValues);
+ $params['check_number'] = $this->_submitValues['check_number'] ?? NULL;
}
$this->submit($params);
diff --git a/CRM/Financial/Form/SalesTaxTrait.php b/CRM/Financial/Form/SalesTaxTrait.php
index 888ac75f9760..45710bd06499 100644
--- a/CRM/Financial/Form/SalesTaxTrait.php
+++ b/CRM/Financial/Form/SalesTaxTrait.php
@@ -37,7 +37,7 @@ public function assignSalesTaxRates() {
*/
public function getSalesTaxTerm() {
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
if (!$invoicing) {
return '';
}
diff --git a/CRM/Financial/Page/AJAX.php b/CRM/Financial/Page/AJAX.php
index 25d1b262bf63..5eaae27c1cbf 100644
--- a/CRM/Financial/Page/AJAX.php
+++ b/CRM/Financial/Page/AJAX.php
@@ -38,7 +38,7 @@ public static function jqFinancial($config) {
}
else {
$financialAccountType = CRM_Financial_BAO_FinancialAccount::getfinancialAccountRelations();
- $financialAccountType = CRM_Utils_Array::value($_GET['_value'], $financialAccountType);
+ $financialAccountType = $financialAccountType[$_GET['_value']] ?? NULL;
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
if ($financialAccountType) {
$defaultId = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = $financialAccountType");
@@ -303,7 +303,7 @@ public static function getFinancialTransactionsList() {
$params['context'] = $context;
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['sort'] = $params['sortBy'] ?? NULL;
$params['total'] = 0;
// get batch list
diff --git a/CRM/Financial/Page/FinancialType.php b/CRM/Financial/Page/FinancialType.php
index 7a1480d52472..38bde7596431 100644
--- a/CRM/Financial/Page/FinancialType.php
+++ b/CRM/Financial/Page/FinancialType.php
@@ -110,8 +110,8 @@ public function browse() {
foreach ($financialAccountIds as $key => $values) {
if (!empty($financialAccounts[$values['financial_account_id']])) {
- $financialAccountId[$values['financial_account_id']] = CRM_Utils_Array::value(
- $values['financial_account_id'], $financialAccounts);
+ $financialAccountId[$values['financial_account_id']] = $financialAccounts[
+ $values['financial_account_id']] ?? NULL;
}
}
diff --git a/CRM/Financial/Page/FinancialTypeAccount.php b/CRM/Financial/Page/FinancialTypeAccount.php
index b01b944b72d5..9a3552cc61d7 100644
--- a/CRM/Financial/Page/FinancialTypeAccount.php
+++ b/CRM/Financial/Page/FinancialTypeAccount.php
@@ -133,12 +133,12 @@ public function browse() {
}
if (!empty($financialAccount->financial_account_type_id)) {
$optionGroupName = 'financial_account_type';
- $financialType[$dao->id]['financial_account_type'] = CRM_Utils_Array::value($financialAccount->financial_account_type_id, $financialAccountType);
+ $financialType[$dao->id]['financial_account_type'] = $financialAccountType[$financialAccount->financial_account_type_id] ?? NULL;
}
if (!empty($dao->account_relationship)) {
$optionGroupName = 'account_relationship';
- $financialType[$dao->id]['account_relationship'] = CRM_Utils_Array::value($dao->account_relationship, $accountRelationship);
+ $financialType[$dao->id]['account_relationship'] = $accountRelationship[$dao->account_relationship] ?? NULL;
}
}
// form all action links
diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php
index 2d140e782656..49cb7b9d8827 100644
--- a/CRM/Friend/BAO/Friend.php
+++ b/CRM/Friend/BAO/Friend.php
@@ -157,9 +157,9 @@ public static function create(&$params) {
$transaction->commit();
// Process sending of mails
- $mailParams['title'] = CRM_Utils_Array::value('title', $params);
- $mailParams['general_link'] = CRM_Utils_Array::value('general_link', $friendParams);
- $mailParams['message'] = CRM_Utils_Array::value('suggested_message', $params);
+ $mailParams['title'] = $params['title'] ?? NULL;
+ $mailParams['general_link'] = $friendParams['general_link'] ?? NULL;
+ $mailParams['message'] = $params['suggested_message'] ?? NULL;
// Default "from email address" is default domain address.
list($_, $mailParams['email_from']) = CRM_Core_BAO_Domain::getNameAndEmail();
diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php
index e1e03c3576b4..2af78a571a9a 100644
--- a/CRM/Friend/Form.php
+++ b/CRM/Friend/Form.php
@@ -73,8 +73,8 @@ public function preProcess() {
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage',
$params, $values, ['title', 'campaign_id', 'is_share']
);
- $this->_title = CRM_Utils_Array::value('title', $values);
- $this->_campaignId = CRM_Utils_Array::value('campaign_id', $values);
+ $this->_title = $values['title'] ?? NULL;
+ $this->_campaignId = $values['campaign_id'] ?? NULL;
$this->_entityTable = 'civicrm_contribution_page';
if ($pcomponent == 'event') {
$this->_entityTable = 'civicrm_event';
@@ -82,7 +82,7 @@ public function preProcess() {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_entityId, 'title');
}
else {
- $isShare = CRM_Utils_Array::value('is_share', $values);
+ $isShare = $values['is_share'] ?? NULL;
}
// Tell Form.tpl whether to include SocialNetwork.tpl for social media sharing
$this->assign('isShare', $isShare);
diff --git a/CRM/Friend/Form/Contribute.php b/CRM/Friend/Form/Contribute.php
index 67e35a989de1..56dac3ce18c2 100644
--- a/CRM/Friend/Form/Contribute.php
+++ b/CRM/Friend/Form/Contribute.php
@@ -48,11 +48,11 @@ public function setDefaultValues() {
$defaults['entity_table'] = 'civicrm_contribution_page';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
- $this->_friendId = CRM_Utils_Array::value('id', $defaults);
- $defaults['tf_title'] = CRM_Utils_Array::value('title', $defaults);
- $defaults['tf_is_active'] = CRM_Utils_Array::value('is_active', $defaults);
- $defaults['tf_thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults);
- $defaults['tf_thankyou_text'] = CRM_Utils_Array::value('thankyou_text', $defaults);
+ $this->_friendId = $defaults['id'] ?? NULL;
+ $defaults['tf_title'] = $defaults['title'] ?? NULL;
+ $defaults['tf_is_active'] = $defaults['is_active'] ?? NULL;
+ $defaults['tf_thankyou_title'] = $defaults['thankyou_title'] ?? NULL;
+ $defaults['tf_thankyou_text'] = $defaults['thankyou_text'] ?? NULL;
}
if (!$this->_friendId) {
@@ -76,7 +76,7 @@ public function buildQuickForm() {
$defaults['entity_table'] = 'civicrm_contribution_page';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
- $this->_friendId = CRM_Utils_Array::value('id', $defaults);
+ $this->_friendId = $defaults['id'] ?? NULL;
}
CRM_Friend_BAO_Friend::buildFriendForm($this);
@@ -97,8 +97,8 @@ public function postProcess() {
$formValues['entity_id'] = $this->_id;
$formValues['title'] = $formValues['tf_title'];
$formValues['is_active'] = CRM_Utils_Array::value('tf_is_active', $formValues, FALSE);
- $formValues['thankyou_title'] = CRM_Utils_Array::value('tf_thankyou_title', $formValues);
- $formValues['thankyou_text'] = CRM_Utils_Array::value('tf_thankyou_text', $formValues);
+ $formValues['thankyou_title'] = $formValues['tf_thankyou_title'] ?? NULL;
+ $formValues['thankyou_text'] = $formValues['tf_thankyou_text'] ?? NULL;
if (($this->_action & CRM_Core_Action::UPDATE) && $this->_friendId) {
$formValues['id'] = $this->_friendId;
diff --git a/CRM/Friend/Form/Event.php b/CRM/Friend/Form/Event.php
index 871ed9df58a5..a40c68e87440 100644
--- a/CRM/Friend/Form/Event.php
+++ b/CRM/Friend/Form/Event.php
@@ -49,16 +49,16 @@ public function setDefaultValues() {
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
if (!empty($defaults['id'])) {
- $defaults['tf_id'] = CRM_Utils_Array::value('id', $defaults);
+ $defaults['tf_id'] = $defaults['id'] ?? NULL;
$this->_friendId = $defaults['tf_id'];
// lets unset the 'id' since it conflicts with eventID (or contribID)
// CRM-12667
unset($defaults['id']);
}
- $defaults['tf_title'] = CRM_Utils_Array::value('title', $defaults);
- $defaults['tf_is_active'] = CRM_Utils_Array::value('is_active', $defaults);
- $defaults['tf_thankyou_title'] = CRM_Utils_Array::value('thankyou_title', $defaults);
- $defaults['tf_thankyou_text'] = CRM_Utils_Array::value('thankyou_text', $defaults);
+ $defaults['tf_title'] = $defaults['title'] ?? NULL;
+ $defaults['tf_is_active'] = $defaults['is_active'] ?? NULL;
+ $defaults['tf_thankyou_title'] = $defaults['thankyou_title'] ?? NULL;
+ $defaults['tf_thankyou_text'] = $defaults['thankyou_text'] ?? NULL;
}
if (!$this->_friendId) {
@@ -82,7 +82,7 @@ public function buildQuickForm() {
$defaults['entity_table'] = 'civicrm_event';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
- $this->_friendId = CRM_Utils_Array::value('id', $defaults);
+ $this->_friendId = $defaults['id'] ?? NULL;
}
CRM_Friend_BAO_Friend::buildFriendForm($this);
@@ -106,8 +106,8 @@ public function postProcess() {
$formValues['entity_id'] = $this->_id;
$formValues['title'] = $formValues['tf_title'];
$formValues['is_active'] = CRM_Utils_Array::value('tf_is_active', $formValues, FALSE);
- $formValues['thankyou_title'] = CRM_Utils_Array::value('tf_thankyou_title', $formValues);
- $formValues['thankyou_text'] = CRM_Utils_Array::value('tf_thankyou_text', $formValues);
+ $formValues['thankyou_title'] = $formValues['tf_thankyou_title'] ?? NULL;
+ $formValues['thankyou_text'] = $formValues['tf_thankyou_text'] ?? NULL;
if (($this->_action & CRM_Core_Action::UPDATE) && $this->_friendId) {
$formValues['id'] = $this->_friendId;
diff --git a/CRM/Grant/BAO/Grant.php b/CRM/Grant/BAO/Grant.php
index 58f035100de9..3d5fa8e1aca8 100644
--- a/CRM/Grant/BAO/Grant.php
+++ b/CRM/Grant/BAO/Grant.php
@@ -154,7 +154,7 @@ public static function add(&$params, &$ids) {
}
}
$grant = new CRM_Grant_DAO_Grant();
- $grant->id = CRM_Utils_Array::value('grant_id', $ids);
+ $grant->id = $ids['grant_id'] ?? NULL;
$grant->copyValues($params);
@@ -233,7 +233,7 @@ public static function create(&$params, &$ids) {
$session = CRM_Core_Session::singleton();
$id = $session->get('userID');
if (!$id) {
- $id = CRM_Utils_Array::value('contact_id', $params);
+ $id = $params['contact_id'] ?? NULL;
}
if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note', $ids))) {
$noteParams = [
diff --git a/CRM/Grant/StateMachine/Search.php b/CRM/Grant/StateMachine/Search.php
index 88f6c267c6cb..eade9bb5b4f5 100644
--- a/CRM/Grant/StateMachine/Search.php
+++ b/CRM/Grant/StateMachine/Search.php
@@ -71,7 +71,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) {
*/
public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
- $value = CRM_Utils_Array::value('task', $_POST);
+ $value = $_POST['task'] ?? NULL;
if (!isset($value)) {
$value = $this->_controller->get('task');
}
diff --git a/CRM/Group/Page/AJAX.php b/CRM/Group/Page/AJAX.php
index 493994720d73..55428b5ef665 100644
--- a/CRM/Group/Page/AJAX.php
+++ b/CRM/Group/Page/AJAX.php
@@ -55,7 +55,7 @@ public static function getGroupList() {
// go ahead with flat hierarchy, CRM-12225
if (empty($groups)) {
$groupsAccessible = CRM_Core_PseudoConstant::group();
- $parentsOnly = CRM_Utils_Array::value('parentsOnly', $params);
+ $parentsOnly = $params['parentsOnly'] ?? NULL;
if (!empty($groupsAccessible) && $parentsOnly) {
// recompute group list with flat hierarchy
$params['parentsOnly'] = 0;
diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php
index 6767b8f3ccc3..2e05cf1d709a 100644
--- a/CRM/Logging/Differ.php
+++ b/CRM/Logging/Differ.php
@@ -231,7 +231,7 @@ private function diffsInTableForId($table, $id) {
if (!empty(${$var[$diff]})) {
$holder =& $$var;
$val = explode(CRM_Case_BAO_Case::VALUE_SEPARATOR, $holder[$diff]);
- $holder[$diff] = CRM_Utils_Array::value(1, $val);
+ $holder[$diff] = $val[1] ?? NULL;
}
}
}
@@ -306,7 +306,7 @@ public function titlesAndValuesForTable($table, $referenceDate) {
$dao = new $tableDAO();
foreach ($dao->fields() as $field) {
- $titles[$table][$field['name']] = CRM_Utils_Array::value('title', $field);
+ $titles[$table][$field['name']] = $field['title'] ?? NULL;
if ($field['type'] == CRM_Utils_Type::T_BOOLEAN) {
$values[$table][$field['name']] = ['0' => ts('false'), '1' => ts('true')];
diff --git a/CRM/Logging/ReportDetail.php b/CRM/Logging/ReportDetail.php
index d239a602da27..d5822b183d51 100644
--- a/CRM/Logging/ReportDetail.php
+++ b/CRM/Logging/ReportDetail.php
@@ -203,10 +203,10 @@ protected function convertDiffsToRows() {
) {
$froms = $tos = [];
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($from, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) {
- $froms[] = CRM_Utils_Array::value($val, $values[$field]);
+ $froms[] = $values[$field][$val] ?? NULL;
}
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($to, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) {
- $tos[] = CRM_Utils_Array::value($val, $values[$field]);
+ $tos[] = $values[$field][$val] ?? NULL;
}
$from = implode(', ', array_filter($froms));
$to = implode(', ', array_filter($tos));
diff --git a/CRM/Logging/ReportSummary.php b/CRM/Logging/ReportSummary.php
index 364474b199da..f7e93eeb24b3 100644
--- a/CRM/Logging/ReportSummary.php
+++ b/CRM/Logging/ReportSummary.php
@@ -342,7 +342,7 @@ protected function buildTemporaryTables() {
$this->addToDeveloperTab($this->temporaryTable->getCreateSql());
$this->temporaryTableName = $this->temporaryTable->getName();
- $logTypes = CRM_Utils_Array::value('log_type_value', $this->_params);
+ $logTypes = $this->_params['log_type_value'] ?? NULL;
unset($this->_params['log_type_value']);
if (empty($logTypes)) {
foreach (array_keys($this->_logTables) as $table) {
diff --git a/CRM/Logging/Schema.php b/CRM/Logging/Schema.php
index cd8ee48acb9a..3b09e9bbf321 100644
--- a/CRM/Logging/Schema.php
+++ b/CRM/Logging/Schema.php
@@ -321,7 +321,7 @@ public function updateLogTableSchema($params) {
$engineChanged = isset($tableSpec['engine']) && (strtoupper($tableSpec['engine']) != $currentEngine);
$engineConfigChanged = isset($tableSpec['engine_config']) && (strtoupper($tableSpec['engine_config']) != $this->getEngineConfigForLogTable($logTable));
if ($engineChanged || ($engineConfigChanged && $params['updateChangedEngineConfig'])) {
- $alterSql[] = "ENGINE=" . $tableSpec['engine'] . " " . CRM_Utils_Array::value('engine_config', $tableSpec);
+ $alterSql[] = "ENGINE=" . $tableSpec['engine'] . " " . $tableSpec['engine_config'] ?? NULL;
}
if (!empty($tableSpec['indexes'])) {
$indexes = $this->getIndexesForTable($logTable);
@@ -805,7 +805,7 @@ private function createLogTableFor($table) {
$query = preg_replace("/ AUTO_INCREMENT/i", '', $query);
$query = preg_replace("/^ [^`].*$/m", '', $query);
$engine = strtoupper(CRM_Utils_Array::value('engine', $this->logTableSpec[$table], self::ENGINE));
- $engine .= " " . CRM_Utils_Array::value('engine_config', $this->logTableSpec[$table]);
+ $engine .= " " . $this->logTableSpec[$table]['engine_config'] ?? NULL;
$query = preg_replace("/^\) ENGINE=[^ ]+ /im", ') ENGINE=' . $engine . ' ', $query);
// log_civicrm_contact.modified_date for example would always be copied from civicrm_contact.modified_date,
diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php
index 57fca1a971a3..98e2741e3be7 100644
--- a/CRM/Mailing/BAO/Mailing.php
+++ b/CRM/Mailing/BAO/Mailing.php
@@ -1191,7 +1191,7 @@ public function compose(
$mailParams['attachments'] = $attachments;
- $mailParams['Subject'] = CRM_Utils_Array::value('subject', $pEmails);
+ $mailParams['Subject'] = $pEmails['subject'] ?? NULL;
if (is_array($mailParams['Subject'])) {
$mailParams['Subject'] = implode('', $mailParams['Subject']);
}
@@ -1396,7 +1396,7 @@ private function getTokenData(&$token_a, $html = FALSE, &$contact, &$verp, &$url
}
}
else {
- $data = CRM_Utils_Array::value("{$type}.{$token}", $contact);
+ $data = $contact["{$type}.{$token}"] ?? NULL;
}
return $data;
}
@@ -2858,7 +2858,7 @@ public static function getContactMailingSelector(&$params) {
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['sort'] = $params['sortBy'] ?? NULL;
$params['caseId'] = NULL;
// get contact mailings
@@ -2951,7 +2951,7 @@ public static function getContactMailings(&$params) {
$params['version'] = 3;
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['limit'] = $params['rp'];
- $params['sort'] = CRM_Utils_Array::value('sortBy', $params);
+ $params['sort'] = $params['sortBy'] ?? NULL;
$result = civicrm_api('MailingContact', 'get', $params);
return $result['values'];
diff --git a/CRM/Mailing/Form/Task.php b/CRM/Mailing/Form/Task.php
index d0ba253d82e8..4a84746aaaba 100644
--- a/CRM/Mailing/Form/Task.php
+++ b/CRM/Mailing/Form/Task.php
@@ -34,7 +34,7 @@ public function preProcess() {
public static function preProcessCommon(&$form) {
$values = $form->controller->exportValues($form->get('searchFormName'));
- $form->_task = CRM_Utils_Array::value('task', $values);
+ $form->_task = $values['task'] ?? NULL;
$mailingTasks = CRM_Mailing_Task::tasks();
$form->assign('taskName', CRM_Utils_Array::value('task', $values));
diff --git a/CRM/Mailing/Page/Preview.php b/CRM/Mailing/Page/Preview.php
index 85daed2ee3a0..97a15798c4c1 100644
--- a/CRM/Mailing/Page/Preview.php
+++ b/CRM/Mailing/Page/Preview.php
@@ -44,7 +44,7 @@ public function run() {
$mailing = new CRM_Mailing_BAO_Mailing();
if (!empty($options)) {
$mailing->id = $options['mailing_id'];
- $fromEmail = CRM_Utils_Array::value('from_email', $options);
+ $fromEmail = $options['from_email'] ?? NULL;
}
$mailing->find(TRUE);
diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php
index a8265b8a67b6..98f29389f5f0 100644
--- a/CRM/Member/BAO/Membership.php
+++ b/CRM/Member/BAO/Membership.php
@@ -89,7 +89,7 @@ public static function add(&$params) {
//get the log start date.
//it is set during renewal of membership.
- $logStartDate = CRM_Utils_Array::value('log_start_date', $params);
+ $logStartDate = $params['log_start_date'] ?? NULL;
$logStartDate = ($logStartDate) ? CRM_Utils_Date::isoToMysql($logStartDate) : CRM_Utils_Date::isoToMysql($membership->start_date);
$values = self::getStatusANDTypeValues($membership->id);
@@ -131,7 +131,7 @@ public static function add(&$params) {
$targetContactID = $membership->contact_id;
if (!empty($params['is_for_organization'])) {
// @todo - deprecate is_for_organization, require modified_id
- $targetContactID = CRM_Utils_Array::value('modified_id', $params);
+ $targetContactID = $params['modified_id'] ?? NULL;
}
// add custom field values
@@ -293,7 +293,7 @@ public static function create(&$params, &$ids = []) {
if (!array_key_exists('max_related', $params) && !empty($params['membership_type_id'])) {
$membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($params['membership_type_id']);
if (isset($membershipType['relationship_type_id'])) {
- $params['max_related'] = CRM_Utils_Array::value('max_related', $membershipType);
+ $params['max_related'] = $membershipType['max_related'] ?? NULL;
}
}
}
@@ -365,7 +365,7 @@ public static function create(&$params, &$ids = []) {
foreach ($params['line_item'] as $priceSetId => $lineItems) {
foreach ($lineItems as $lineIndex => $lineItem) {
- $lineMembershipType = CRM_Utils_Array::value('membership_type_id', $lineItem);
+ $lineMembershipType = $lineItem['membership_type_id'] ?? NULL;
if (!empty($params['contribution'])) {
$params['line_item'][$priceSetId][$lineIndex]['contribution_id'] = $params['contribution']->id;
}
@@ -520,7 +520,7 @@ public static function retrieve(&$params, &$defaults) {
//get the membership status and type values.
$statusANDType = self::getStatusANDTypeValues($membership->id);
foreach (['status', 'membership_type'] as $fld) {
- $defaults[$fld] = CRM_Utils_Array::value($fld, $statusANDType[$membership->id]);
+ $defaults[$fld] = $statusANDType[$membership->id][$fld] ?? NULL;
}
if (!empty($statusANDType[$membership->id]['is_current_member'])) {
$defaults['active'] = TRUE;
@@ -929,7 +929,7 @@ public static function &importableFields($contactType = 'Individual', $status =
'column_name'
);
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
- $tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
+ $tmpContactField[trim($value)] = $contactFields[trim($value)] ?? NULL;
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . " " . ts('(match to contact)');
}
@@ -1849,9 +1849,9 @@ public static function processMembership($contactID, $membershipTypeID, $is_test
$currentMembership['join_date'] = CRM_Utils_Date::customFormat($currentMembership['join_date'], $format);
foreach (['start_date', 'end_date'] as $dateType) {
- $currentMembership[$dateType] = CRM_Utils_Array::value($dateType, $formDates);
+ $currentMembership[$dateType] = $formDates[$dateType] ?? NULL;
if (empty($currentMembership[$dateType])) {
- $currentMembership[$dateType] = CRM_Utils_Array::value($dateType, $dates);
+ $currentMembership[$dateType] = $dates[$dateType] ?? NULL;
}
}
$currentMembership['is_test'] = $is_test;
@@ -1892,9 +1892,9 @@ public static function processMembership($contactID, $membershipTypeID, $is_test
$memParams = [];
$memParams['join_date'] = CRM_Utils_Date::isoToMysql($membership->join_date);
$memParams['start_date'] = CRM_Utils_Array::value('start_date', $formDates, CRM_Utils_Date::isoToMysql($membership->start_date));
- $memParams['end_date'] = CRM_Utils_Array::value('end_date', $formDates);
+ $memParams['end_date'] = $formDates['end_date'] ?? NULL;
if (empty($memParams['end_date'])) {
- $memParams['end_date'] = CRM_Utils_Array::value('end_date', $dates);
+ $memParams['end_date'] = $dates['end_date'] ?? NULL;
}
$memParams['membership_type_id'] = $membershipTypeID;
@@ -1933,9 +1933,9 @@ public static function processMembership($contactID, $membershipTypeID, $is_test
$dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membershipTypeID, NULL, NULL, NULL, $numRenewTerms);
foreach (['join_date', 'start_date', 'end_date'] as $dateType) {
- $memParams[$dateType] = CRM_Utils_Array::value($dateType, $formDates);
+ $memParams[$dateType] = $formDates[$dateType] ?? NULL;
if (empty($memParams[$dateType])) {
- $memParams[$dateType] = CRM_Utils_Array::value($dateType, $dates);
+ $memParams[$dateType] = $dates[$dateType] ?? NULL;
}
}
@@ -1953,7 +1953,7 @@ public static function processMembership($contactID, $membershipTypeID, $is_test
$membershipTypeID,
$memParams
);
- $updateStatusId = CRM_Utils_Array::value('id', $status);
+ $updateStatusId = $status['id'] ?? NULL;
}
else {
// if IPN/Pay-Later set status to: PENDING
@@ -2268,7 +2268,7 @@ public static function updateAllMembershipStatus() {
'ignore_admin_only' => TRUE,
], TRUE
);
- $statusId = CRM_Utils_Array::value('id', $newStatus);
+ $statusId = $newStatus['id'] ?? NULL;
//process only when status change.
if ($statusId &&
@@ -2405,11 +2405,11 @@ public static function recordMembershipContribution(&$params, $ids = []) {
$config = CRM_Core_Config::singleton();
$contributionParams['currency'] = $config->defaultCurrency;
$contributionParams['receipt_date'] = (CRM_Utils_Array::value('receipt_date', $params)) ? $params['receipt_date'] : 'null';
- $contributionParams['source'] = CRM_Utils_Array::value('contribution_source', $params);
+ $contributionParams['source'] = $params['contribution_source'] ?? NULL;
$contributionParams['non_deductible_amount'] = 'null';
$contributionParams['skipCleanMoney'] = TRUE;
- $contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor_id', $params);
- $contributionSoftParams = CRM_Utils_Array::value('soft_credit', $params);
+ $contributionParams['payment_processor'] = $params['payment_processor_id'] ?? NULL;
+ $contributionSoftParams = $params['soft_credit'] ?? NULL;
$recordContribution = [
'contact_id',
'fee_amount',
@@ -2432,7 +2432,7 @@ public static function recordMembershipContribution(&$params, $ids = []) {
'card_type_id',
];
foreach ($recordContribution as $f) {
- $contributionParams[$f] = CRM_Utils_Array::value($f, $params);
+ $contributionParams[$f] = $params[$f] ?? NULL;
}
if (!empty($params['contribution_id'])) {
@@ -2451,7 +2451,7 @@ public static function recordMembershipContribution(&$params, $ids = []) {
if (!empty($params['processPriceSet']) &&
!empty($params['lineItems'])
) {
- $contributionParams['line_item'] = CRM_Utils_Array::value('lineItems', $params, NULL);
+ $contributionParams['line_item'] = $params['lineItems'] ?? NULL;
}
$contribution = CRM_Contribute_BAO_Contribution::create($contributionParams);
@@ -2685,8 +2685,8 @@ public static function mergeMemberships($mainContactID, $otherContactID, &$sqlQu
*/
public static function updateMembershipStatus($deceasedParams, $contactType) {
$updateMembershipMsg = NULL;
- $contactId = CRM_Utils_Array::value('contact_id', $deceasedParams);
- $deceasedDate = CRM_Utils_Array::value('deceased_date', $deceasedParams);
+ $contactId = $deceasedParams['contact_id'] ?? NULL;
+ $deceasedDate = $deceasedParams['deceased_date'] ?? NULL;
// process to set membership status to deceased for both active/inactive membership
if ($contactId &&
diff --git a/CRM/Member/BAO/MembershipBlock.php b/CRM/Member/BAO/MembershipBlock.php
index f70ef619d3bc..cc11ae37b1d2 100644
--- a/CRM/Member/BAO/MembershipBlock.php
+++ b/CRM/Member/BAO/MembershipBlock.php
@@ -39,7 +39,7 @@ public static function create(&$params) {
CRM_Utils_Hook::pre($hook, 'MembershipBlock', CRM_Utils_Array::value('id', $params), $params);
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->copyValues($params);
- $dao->id = CRM_Utils_Array::value('id', $params);
+ $dao->id = $params['id'] ?? NULL;
$dao->save();
CRM_Utils_Hook::post($hook, 'MembershipBlock', $dao->id, $dao);
return $dao;
diff --git a/CRM/Member/BAO/MembershipType.php b/CRM/Member/BAO/MembershipType.php
index add9aacac30a..e3d1fb89667c 100644
--- a/CRM/Member/BAO/MembershipType.php
+++ b/CRM/Member/BAO/MembershipType.php
@@ -85,13 +85,13 @@ public static function add(&$params, $ids = []) {
if (isset($ids['membershipType'])) {
Civi::log()->warning('Deprecated: Passing membershipType by $ids array in CRM_Member_BAO_MembershipType::add');
}
- $params['id'] = CRM_Utils_Array::value('membershipType', $ids);
+ $params['id'] = $ids['membershipType'] ?? NULL;
}
$hook = empty($params['id']) ? 'create' : 'edit';
CRM_Utils_Hook::pre($hook, 'MembershipType', CRM_Utils_Array::value('id', $params), $params);
- $membershipTypeId = CRM_Utils_Array::value('id', $params);
+ $membershipTypeId = $params['id'] ?? NULL;
if (!$membershipTypeId) {
if (!isset($params['is_active'])) {
@@ -717,15 +717,15 @@ public static function createMembershipPriceField($params, $previousID, $members
$fieldParams['is_display_amounts'] = $fieldParams['is_required'] = 0;
$fieldParams['weight'] = $fieldParams['option_weight'][1] = 1;
$fieldParams['option_label'][1] = $params['name'];
- $fieldParams['option_description'][1] = CRM_Utils_Array::value('description', $params);
+ $fieldParams['option_description'][1] = $params['description'] ?? NULL;
$fieldParams['membership_type_id'][1] = $membershipTypeId;
$fieldParams['option_amount'][1] = empty($params['minimum_fee']) ? 0 : $params['minimum_fee'];
- $fieldParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params);
+ $fieldParams['financial_type_id'] = $params['financial_type_id'] ?? NULL;
if ($previousID) {
CRM_Member_Form_MembershipType::checkPreviousPriceField($previousID, $priceSetId, $membershipTypeId, $optionsIds);
- $fieldParams['option_id'] = CRM_Utils_Array::value('option_id', $optionsIds);
+ $fieldParams['option_id'] = $optionsIds['option_id'] ?? NULL;
}
CRM_Price_BAO_PriceField::create($fieldParams);
}
@@ -759,8 +759,8 @@ public static function createMembershipPriceField($params, $previousID, $members
$optionsIds['id'] = current(CRM_Utils_Array::value('option_id', $optionsIds));
}
}
- $results['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params);
- $results['description'] = CRM_Utils_Array::value('description', $params);
+ $results['financial_type_id'] = $params['financial_type_id'] ?? NULL;
+ $results['description'] = $params['description'] ?? NULL;
CRM_Price_BAO_PriceFieldValue::add($results, $optionsIds);
}
}
@@ -801,7 +801,7 @@ public static function updateAllPriceFieldValue($membershipTypeId, $params) {
$updateParams['visibility_id'] = CRM_Price_BAO_PriceField::getVisibilityOptionID(strtolower($params['visibility']));
}
else {
- $updateParams[$value] = CRM_Utils_Array::value($key, $params);
+ $updateParams[$value] = $params[$key] ?? NULL;
}
}
CRM_Price_BAO_PriceFieldValue::add($updateParams);
diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php
index 1408396dafdd..dc8ca97f16d6 100644
--- a/CRM/Member/Form.php
+++ b/CRM/Member/Form.php
@@ -430,7 +430,7 @@ protected function ensurePriceParamsAreSet(&$formValues) {
* @return array
*/
protected static function getPriceSetDetails($params) {
- $priceSetID = CRM_Utils_Array::value('price_set_id', $params);
+ $priceSetID = $params['price_set_id'] ?? NULL;
if ($priceSetID) {
return CRM_Price_BAO_PriceSet::getSetDetail($priceSetID);
}
@@ -450,7 +450,7 @@ protected static function getPriceSetDetails($params) {
* @return int
*/
protected static function getPriceSetID($params) {
- $priceSetID = CRM_Utils_Array::value('price_set_id', $params);
+ $priceSetID = $params['price_set_id'] ?? NULL;
if (!$priceSetID) {
$priceSetDetails = self::getPriceSetDetails($params);
return key($priceSetDetails);
diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php
index bf26de3d4eef..e77afd4313b3 100644
--- a/CRM/Member/Form/Membership.php
+++ b/CRM/Member/Form/Membership.php
@@ -201,7 +201,7 @@ public function preProcess() {
parent::preProcess();
// get price set id.
- $this->_priceSetId = CRM_Utils_Array::value('priceSetId', $_GET);
+ $this->_priceSetId = $_GET['priceSetId'] ?? NULL;
$this->set('priceSetId', $this->_priceSetId);
$this->assign('priceSetId', $this->_priceSetId);
@@ -227,7 +227,7 @@ public function preProcess() {
$memberorgs = CRM_Member_BAO_MembershipType::getMemberOfContactByMemTypes($cMemTypes);
$mems_by_org = [];
foreach ($contactMemberships as $mem) {
- $mem['member_of_contact_id'] = CRM_Utils_Array::value($mem['membership_type_id'], $memberorgs);
+ $mem['member_of_contact_id'] = $memberorgs[$mem['membership_type_id']] ?? NULL;
if (!empty($mem['membership_end_date'])) {
$mem['membership_end_date'] = CRM_Utils_Date::customFormat($mem['membership_end_date']);
}
@@ -487,7 +487,7 @@ public function buildQuickForm() {
continue;
}
else {
- $memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values);
+ $memberOfContactId = $values['member_of_contact_id'] ?? NULL;
if (empty($selMemTypeOrg[$memberOfContactId])) {
$selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$memberOfContactId,
@@ -498,10 +498,10 @@ public function buildQuickForm() {
$selOrgMemType[$memberOfContactId][0] = ts('- select -');
}
if (empty($selOrgMemType[$memberOfContactId][$key])) {
- $selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values);
+ $selOrgMemType[$memberOfContactId][$key] = $values['name'] ?? NULL;
}
}
- $totalAmount = CRM_Utils_Array::value('minimum_fee', $values);
+ $totalAmount = $values['minimum_fee'] ?? NULL;
//CRM-18827 - override the default value if total_amount is submitted
if (!empty($this->_submitValues['total_amount'])) {
$totalAmount = $this->_submitValues['total_amount'];
@@ -710,7 +710,7 @@ public static function formRule($params, $files, $self) {
if (empty($params['membership_type_id'][1])) {
$errors['membership_type_id'] = ts('Please select a membership type.');
}
- $numterms = CRM_Utils_Array::value('num_terms', $params);
+ $numterms = $params['num_terms'] ?? NULL;
if ($numterms && intval($numterms) != $numterms) {
$errors['num_terms'] = ts('Please enter an integer for the number of terms.');
}
@@ -947,7 +947,7 @@ private function convertIsOverrideValue() {
*/
public static function emailReceipt(&$form, &$formValues, &$membership, $customValues = NULL) {
// retrieve 'from email id' for acknowledgement
- $receiptFrom = CRM_Utils_Array::value('from_email_address', $formValues);
+ $receiptFrom = $formValues['from_email_address'] ?? NULL;
// @todo figure out how much of the stuff below is genuinely shared with the batch form & a logical shared place.
if (!empty($formValues['payment_instrument_id'])) {
@@ -1030,7 +1030,7 @@ public static function emailReceipt(&$form, &$formValues, &$membership, $customV
$taxAmt = $template->get_template_vars('dataArray');
$eventTaxAmt = $template->get_template_vars('totalTaxAmount');
$prefixValue = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
+ $invoicing = $prefixValue['invoicing'] ?? NULL;
if ((!empty($taxAmt) || isset($eventTaxAmt)) && (isset($invoicing) && isset($prefixValue['is_email_pdf']))) {
$isEmailPdf = TRUE;
}
@@ -1149,7 +1149,7 @@ public function submit() {
if (!empty($formValues['tax_amount'])) {
$params['tax_amount'] = $formValues['tax_amount'];
}
- $params['total_amount'] = CRM_Utils_Array::value('amount', $formValues);
+ $params['total_amount'] = $formValues['amount'] ?? NULL;
if (!empty($lineItem[$this->_priceSetId])) {
foreach ($lineItem[$this->_priceSetId] as &$li) {
if (!empty($li['membership_type_id'])) {
@@ -1161,7 +1161,7 @@ public function submit() {
///CRM-11529 for quick config backoffice transactions
//when financial_type_id is passed in form, update the
//lineitems with the financial type selected in form
- $submittedFinancialType = CRM_Utils_Array::value('financial_type_id', $formValues);
+ $submittedFinancialType = $formValues['financial_type_id'] ?? NULL;
if ($isQuickConfig && $submittedFinancialType) {
$li['financial_type_id'] = $submittedFinancialType;
}
@@ -1179,7 +1179,7 @@ public function submit() {
];
foreach ($fields as $f) {
- $params[$f] = CRM_Utils_Array::value($f, $formValues);
+ $params[$f] = $formValues[$f] ?? NULL;
}
// fix for CRM-3724
@@ -1214,9 +1214,9 @@ public function submit() {
foreach ($calcDates as $memType => $calcDate) {
foreach (array_keys($dateTypes) as $d) {
//first give priority to form values then calDates.
- $date = CRM_Utils_Array::value($d, $formValues);
+ $date = $formValues[$d] ?? NULL;
if (!$date) {
- $date = CRM_Utils_Array::value($d, $calcDate);
+ $date = $calcDate[$d] ?? NULL;
}
$membershipTypeValues[$memType][$d] = CRM_Utils_Date::processDate($date);
@@ -1226,7 +1226,7 @@ public function submit() {
foreach ($this->_memTypeSelected as $memType) {
if (array_key_exists('max_related', $formValues)) {
// max related memberships - take from form or inherit from membership type
- $membershipTypeValues[$memType]['max_related'] = CRM_Utils_Array::value('max_related', $formValues);
+ $membershipTypeValues[$memType]['max_related'] = $formValues['max_related'] ?? NULL;
}
$membershipTypeValues[$memType]['custom'] = CRM_Core_BAO_CustomField::postProcess($formValues,
$this->_id,
@@ -1268,7 +1268,7 @@ public function submit() {
];
foreach ($recordContribution as $f) {
- $params[$f] = CRM_Utils_Array::value($f, $formValues);
+ $params[$f] = $formValues[$f] ?? NULL;
}
if (!$this->_onlinePendingContributionId) {
@@ -1294,7 +1294,7 @@ public function submit() {
}
if (!empty($formValues['send_receipt'])) {
- $params['receipt_date'] = CRM_Utils_Array::value('receive_date', $formValues);
+ $params['receipt_date'] = $formValues['receive_date'] ?? NULL;
}
//insert financial type name in receipt.
@@ -1313,8 +1313,8 @@ public function submit() {
$params['total_amount'] = CRM_Utils_Array::value('total_amount', $formValues, 0);
//CRM-20264 : Store CC type and number (last 4 digit) during backoffice or online payment
- $params['card_type_id'] = CRM_Utils_Array::value('card_type_id', $this->_params);
- $params['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $this->_params);
+ $params['card_type_id'] = $this->_params['card_type_id'] ?? NULL;
+ $params['pan_truncation'] = $this->_params['pan_truncation'] ?? NULL;
if (!$isQuickConfig) {
$params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet',
@@ -1323,7 +1323,7 @@ public function submit() {
);
}
else {
- $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $formValues);
+ $params['financial_type_id'] = $formValues['financial_type_id'] ?? NULL;
}
//get the payment processor id as per mode. Try removing in favour of beginPostProcess.
@@ -1455,7 +1455,7 @@ public function submit() {
[1 => $membershipType, 2 => $userName]
);
$params['source'] = $formValues['source'] ? $formValues['source'] : $params['contribution_source'];
- $params['trxn_id'] = CRM_Utils_Array::value('trxn_id', $result);
+ $params['trxn_id'] = $result['trxn_id'] ?? NULL;
$params['is_test'] = ($this->_mode === 'live') ? 0 : 1;
if (!empty($formValues['send_receipt'])) {
$params['receipt_date'] = $now;
@@ -1496,7 +1496,7 @@ public function submit() {
// appropriate as part of our 2-step always create the pending contribution & then finally add the payment
// process -
// @see http://wiki.civicrm.org/confluence/pages/viewpage.action?pageId=261062657#Payments&AccountsRoadmap-Movetowardsalwaysusinga2-steppaymentprocess
- $membershipParams['contribution_status_id'] = CRM_Utils_Array::value('payment_status_id', $result);
+ $membershipParams['contribution_status_id'] = $result['payment_status_id'] ?? NULL;
if (!empty($paymentParams['is_recur'])) {
// The earlier process created the line items (although we want to get rid of the earlier one in favour
// of a single path!
@@ -1505,7 +1505,7 @@ public function submit() {
$membershipParams['payment_instrument_id'] = $paymentInstrumentID;
// @todo stop passing $ids (membership and userId only are set above)
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
- $params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
+ $params['contribution'] = $membershipParams['contribution'] ?? NULL;
unset($params['lineItems']);
$this->_membershipIDs[] = $membership->id;
$createdMemberships[$memType] = $membership;
@@ -1602,7 +1602,7 @@ public function submit() {
}
// @todo stop passing $ids (membership and userId only are set above)
$membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
- $params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
+ $params['contribution'] = $membershipParams['contribution'] ?? NULL;
unset($params['lineItems']);
// skip line item creation for next interation since line item(s) are already created.
$params['skipLineItem'] = TRUE;
@@ -1613,7 +1613,7 @@ public function submit() {
}
}
}
- $isRecur = CRM_Utils_Array::value('is_recur', $params);
+ $isRecur = $params['is_recur'] ?? NULL;
if (($this->_action & CRM_Core_Action::UPDATE)) {
$this->addStatusMessage($this->getStatusMessageForUpdate($membership, $endDate));
}
@@ -1624,7 +1624,7 @@ public function submit() {
if (!empty($lineItem[$this->_priceSetId])) {
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$taxAmount = FALSE;
$totalTaxAmount = 0;
foreach ($lineItem[$this->_priceSetId] as & $priceFieldOp) {
@@ -1645,10 +1645,10 @@ public function submit() {
foreach ($lineItem[$this->_priceSetId] as $key => $value) {
if (isset($value['tax_amount']) && isset($value['tax_rate'])) {
if (isset($dataArray[$value['tax_rate']])) {
- $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value);
+ $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + $value['tax_amount'] ?? NULL;
}
else {
- $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value);
+ $dataArray[$value['tax_rate']] = $value['tax_amount'] ?? NULL;
}
}
}
@@ -1857,7 +1857,7 @@ protected function getStatusMessageForCreate($endDate, $membershipTypes, $create
//get the end date from calculated dates.
if (!$memEndDate && !$isRecur) {
- $memEndDate = CRM_Utils_Array::value('end_date', $calcDates[$memType]);
+ $memEndDate = $calcDates[$memType]['end_date'] ?? NULL;
}
if ($memEndDate && $memEndDate !== 'null') {
diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php
index 90d5a63a2e83..9f6b4ea0119c 100644
--- a/CRM/Member/Form/MembershipBlock.php
+++ b/CRM/Member/Form/MembershipBlock.php
@@ -337,7 +337,7 @@ public function postProcess() {
if (is_array($params['membership_type'])) {
foreach ($params['membership_type'] as $k => $v) {
if ($v) {
- $membershipTypes[$k] = CRM_Utils_Array::value("auto_renew_$k", $params);
+ $membershipTypes[$k] = $params["auto_renew_$k"] ?? NULL;
}
}
}
@@ -347,7 +347,7 @@ public function postProcess() {
}
// check for price set.
- $priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
+ $priceSetID = $params['member_price_set_id'] ?? NULL;
if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) {
$usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 2);
if (empty($params['mem_price_field_id']) && !$usedPriceSetId) {
@@ -365,21 +365,21 @@ public function postProcess() {
}
$setParams['is_quick_config'] = 1;
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
- $setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
+ $setParams['financial_type_id'] = $this->_values['financial_type_id'] ?? NULL;
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
$fieldParams['price_set_id'] = $priceSet->id;
}
elseif ($usedPriceSetId) {
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
- $setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
+ $setParams['financial_type_id'] = $this->_values['financial_type_id'] ?? NULL;
$setParams['id'] = $usedPriceSetId;
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
$fieldParams['price_set_id'] = $priceSet->id;
}
else {
- $fieldParams['id'] = CRM_Utils_Array::value('mem_price_field_id', $params);
+ $fieldParams['id'] = $params['mem_price_field_id'] ?? NULL;
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('mem_price_field_id', $params), 'price_set_id');
}
$editedFieldParams = [
@@ -396,7 +396,7 @@ public function postProcess() {
$fieldParams['weight'] = 1;
}
else {
- $fieldParams['id'] = CRM_Utils_Array::value('id', $editedResults);
+ $fieldParams['id'] = $editedResults['id'] ?? NULL;
}
$fieldParams['label'] = !empty($params['membership_type_label']) ? $params['membership_type_label'] : ts('Membership');
@@ -416,12 +416,12 @@ public function postProcess() {
unset($options[$priceFieldID]);
}
$membetype = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($memType);
- $fieldParams['option_label'][$rowCount] = CRM_Utils_Array::value('name', $membetype);
+ $fieldParams['option_label'][$rowCount] = $membetype['name'] ?? NULL;
$fieldParams['option_amount'][$rowCount] = CRM_Utils_Array::value('minimum_fee', $membetype, 0);
- $fieldParams['option_weight'][$rowCount] = CRM_Utils_Array::value('weight', $membetype);
- $fieldParams['option_description'][$rowCount] = CRM_Utils_Array::value('description', $membetype);
- $fieldParams['default_option'] = CRM_Utils_Array::value('membership_type_default', $params);
- $fieldParams['option_financial_type_id'][$rowCount] = CRM_Utils_Array::value('financial_type_id', $membetype);
+ $fieldParams['option_weight'][$rowCount] = $membetype['weight'] ?? NULL;
+ $fieldParams['option_description'][$rowCount] = $membetype['description'] ?? NULL;
+ $fieldParams['default_option'] = $params['membership_type_default'] ?? NULL;
+ $fieldParams['option_financial_type_id'][$rowCount] = $membetype['financial_type_id'] ?? NULL;
$fieldParams['membership_type_id'][$rowCount] = $memType;
// [$rowCount] = $membetype[''];
diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php
index 9b4f1d749125..667221b05f11 100644
--- a/CRM/Member/Form/MembershipRenewal.php
+++ b/CRM/Member/Form/MembershipRenewal.php
@@ -214,7 +214,7 @@ public function setDefaultValues() {
$scTypes = CRM_Core_OptionGroup::values("soft_credit_type");
$defaults['soft_credit_type_id'] = CRM_Utils_Array::value(ts('Gift'), array_flip($scTypes));
- $renewalDate = CRM_Utils_Array::value('renewal_date', $defaults);
+ $renewalDate = $defaults['renewal_date'] ?? NULL;
$this->assign('renewalDate', $renewalDate);
$this->assign('member_is_test', CRM_Utils_Array::value('member_is_test', $defaults));
@@ -259,7 +259,7 @@ public function buildQuickForm() {
continue;
}
else {
- $memberOfContactId = CRM_Utils_Array::value('member_of_contact_id', $values);
+ $memberOfContactId = $values['member_of_contact_id'] ?? NULL;
if (empty($selMemTypeOrg[$memberOfContactId])) {
$selMemTypeOrg[$memberOfContactId] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
$memberOfContactId,
@@ -270,16 +270,16 @@ public function buildQuickForm() {
$selOrgMemType[$memberOfContactId][0] = ts('- select -');
}
if (empty($selOrgMemType[$memberOfContactId][$key])) {
- $selOrgMemType[$memberOfContactId][$key] = CRM_Utils_Array::value('name', $values);
+ $selOrgMemType[$memberOfContactId][$key] = $values['name'] ?? NULL;
}
}
//CRM-16950
$taxAmount = NULL;
- $totalAmount = CRM_Utils_Array::value('minimum_fee', $values);
+ $totalAmount = $values['minimum_fee'] ?? NULL;
// @todo - feels a bug - we use taxRate from the form default rather than from the specified type?!?
if ($this->getTaxRateForFinancialType($values['financial_type_id'])) {
- $taxAmount = ($taxRate / 100) * CRM_Utils_Array::value('minimum_fee', $values);
+ $taxAmount = ($taxRate / 100) * $values['minimum_fee'] ?? NULL;
$totalAmount = $totalAmount + $taxAmount;
}
diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php
index 152680491f44..096aa786e084 100644
--- a/CRM/Member/Form/MembershipType.php
+++ b/CRM/Member/Form/MembershipType.php
@@ -502,7 +502,7 @@ public static function checkPreviousPriceField($previousID, $priceSetId, $member
];
$editedResults = [];
CRM_Price_BAO_PriceFieldValue::retrieve($editedFieldParams, $editedResults);
- $optionsIds['option_id'][1] = CRM_Utils_Array::value('id', $editedResults);
+ $optionsIds['option_id'][1] = $editedResults['id'] ?? NULL;
}
}
}
diff --git a/CRM/Member/Form/Task/Batch.php b/CRM/Member/Form/Task/Batch.php
index 04c7bbb0c7b9..0d25822fee23 100644
--- a/CRM/Member/Form/Task/Batch.php
+++ b/CRM/Member/Form/Task/Batch.php
@@ -133,7 +133,7 @@ public function buildQuickForm() {
$typeId = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $memberId, 'membership_type_id');
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
- $customValue = CRM_Utils_Array::value($customFieldID, $customFields);
+ $customValue = $customFields[$customFieldID] ?? NULL;
$entityColumnValue = [];
if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
diff --git a/CRM/Member/Form/Task/Label.php b/CRM/Member/Form/Task/Label.php
index 2068aeec0276..df6aa2d3b0aa 100644
--- a/CRM/Member/Form/Task/Label.php
+++ b/CRM/Member/Form/Task/Label.php
@@ -54,7 +54,7 @@ public function buildQuickForm() {
public function setDefaultValues() {
$defaults = [];
$format = CRM_Core_BAO_LabelFormat::getDefaultValues();
- $defaults['label_name'] = CRM_Utils_Array::value('name', $format);
+ $defaults['label_name'] = $format['name'] ?? NULL;
$defaults['merge_same_address'] = 0;
$defaults['merge_same_household'] = 0;
$defaults['do_not_mail'] = 1;
@@ -70,11 +70,11 @@ public function setDefaultValues() {
public function postProcess() {
$formValues = $this->controller->exportValues($this->_name);
$locationTypeID = $formValues['location_type_id'];
- $respectDoNotMail = CRM_Utils_Array::value('do_not_mail', $formValues);
+ $respectDoNotMail = $formValues['do_not_mail'] ?? NULL;
$labelName = $formValues['label_name'];
- $mergeSameAddress = CRM_Utils_Array::value('merge_same_address', $formValues);
- $mergeSameHousehold = CRM_Utils_Array::value('merge_same_household', $formValues);
- $isPerMembership = CRM_Utils_Array::value('per_membership', $formValues);
+ $mergeSameAddress = $formValues['merge_same_address'] ?? NULL;
+ $mergeSameHousehold = $formValues['merge_same_household'] ?? NULL;
+ $isPerMembership = $formValues['per_membership'] ?? NULL;
if ($isPerMembership && ($mergeSameAddress || $mergeSameHousehold)) {
// this shouldn't happen - perhaps is could if JS is disabled
CRM_Core_Session::setStatus(ts('As you are printing one label per membership your merge settings are being ignored'));
diff --git a/CRM/Member/Import/Form/MapField.php b/CRM/Member/Import/Form/MapField.php
index a991c85bcfef..57728384f8af 100644
--- a/CRM/Member/Import/Form/MapField.php
+++ b/CRM/Member/Import/Form/MapField.php
@@ -113,9 +113,9 @@ public function buildQuickForm() {
$mappingName = $mappingName[1];
$mappingContactType = $mappingContactType[1];
- $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
- $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
- $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
+ $mappingLocation = $mappingLocation['1'] ?? NULL;
+ $mappingPhoneType = $mappingPhoneType['1'] ?? NULL;
+ $mappingRelation = $mappingRelation['1'] ?? NULL;
//mapping is to be loaded from database
@@ -361,7 +361,7 @@ public static function formRule($fields, $files, $self) {
}
if (!empty($fields['saveMapping'])) {
- $nameField = CRM_Utils_Array::value('saveMappingName', $fields);
+ $nameField = $fields['saveMappingName'] ?? NULL;
if (empty($nameField)) {
$errors['saveMappingName'] = ts('Name is required to save Import Mapping');
}
diff --git a/CRM/Member/Import/Parser/Membership.php b/CRM/Member/Import/Parser/Membership.php
index fcf45519cda3..0a1bd220ab4e 100644
--- a/CRM/Member/Import/Parser/Membership.php
+++ b/CRM/Member/Import/Parser/Membership.php
@@ -524,7 +524,7 @@ public function import($onDuplicate, &$values) {
$formatted
);
if (empty($formatted['status_id'])) {
- $formatted['status_id'] = CRM_Utils_Array::value('id', $calcStatus);
+ $formatted['status_id'] = $calcStatus['id'] ?? NULL;
}
elseif (empty($formatted['member_is_override'])) {
if (empty($calcStatus)) {
diff --git a/CRM/Member/Page/AJAX.php b/CRM/Member/Page/AJAX.php
index 4f44feaed876..85dd65416675 100644
--- a/CRM/Member/Page/AJAX.php
+++ b/CRM/Member/Page/AJAX.php
@@ -50,7 +50,7 @@ public static function getMemberTypeDefaults() {
// fix the display of the monetary value, CRM-4038
$details['total_amount'] = CRM_Utils_Money::format($details['total_amount'], NULL, '%a');
$options = CRM_Core_SelectValues::memberAutoRenew();
- $details['auto_renew'] = CRM_Utils_Array::value('auto_renew', $options[$details]);
+ $details['auto_renew'] = $options[$details]['auto_renew'] ?? NULL;
CRM_Utils_JSON::output($details);
}
diff --git a/CRM/Member/Page/DashBoard.php b/CRM/Member/Page/DashBoard.php
index d44ce85c25fb..be08a4c5aedd 100644
--- a/CRM/Member/Page/DashBoard.php
+++ b/CRM/Member/Page/DashBoard.php
@@ -51,7 +51,7 @@ public function preProcess() {
$isCurrentMonth = 0;
// You can force the dashboard to display based upon a certain date
- $ym = CRM_Utils_Array::value('date', $_GET);
+ $ym = $_GET['date'] ?? NULL;
if ($ym) {
if (preg_match('/^\d{6}$/', $ym) == 0 ||
diff --git a/CRM/Member/Page/MembershipType.php b/CRM/Member/Page/MembershipType.php
index 6f2810aae014..1012cd28c64b 100644
--- a/CRM/Member/Page/MembershipType.php
+++ b/CRM/Member/Page/MembershipType.php
@@ -125,7 +125,7 @@ public function browse() {
$value, $relationshipName
);
}
- $membershipType[$dao->id]['maxRelated'] = CRM_Utils_Array::value('max_related', $membershipType[$dao->id]);
+ $membershipType[$dao->id]['maxRelated'] = $membershipType[$dao->id]['max_related'] ?? NULL;
}
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($dao->financial_type_id))) {
unset($links[CRM_Core_Action::UPDATE], $links[CRM_Core_Action::ENABLE], $links[CRM_Core_Action::DISABLE]);
diff --git a/CRM/Member/Page/RecurringContributions.php b/CRM/Member/Page/RecurringContributions.php
index 546350457f15..aac582c3892e 100644
--- a/CRM/Member/Page/RecurringContributions.php
+++ b/CRM/Member/Page/RecurringContributions.php
@@ -96,7 +96,7 @@ private function getRecurContributions($membershipID) {
$recurringContributions[$recurringContributionID]['id'] = $recurringContributionID;
$recurringContributions[$recurringContributionID]['contactId'] = $contactID;
- $recurringContributions[$recurringContributionID]['contribution_status'] = CRM_Utils_Array::value($contributionStatusID, $contributionStatuses);
+ $recurringContributions[$recurringContributionID]['contribution_status'] = $contributionStatuses[$contributionStatusID] ?? NULL;
$this->setActionsForRecurringContribution($recurringContributionID, $recurringContributions[$recurringContributionID]);
}
diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php
index fb937edd24dc..8301a964a757 100644
--- a/CRM/Member/Page/Tab.php
+++ b/CRM/Member/Page/Tab.php
@@ -69,12 +69,12 @@ public function browse() {
CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
//carry campaign.
- $membership[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
+ $membership[$dao->id]['campaign'] = $allCampaigns[$dao->campaign_id] ?? NULL;
//get the membership status and type values.
$statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
foreach (['status', 'membership_type'] as $fld) {
- $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
+ $membership[$dao->id][$fld] = $statusANDType[$dao->id][$fld] ?? NULL;
}
if (!empty($statusANDType[$dao->id]['is_current_member'])) {
$membership[$dao->id]['active'] = TRUE;
@@ -162,7 +162,7 @@ public function browse() {
LEFT JOIN civicrm_contact ct ON ct.id = m.contact_id
WHERE m.owner_membership_id = {$dao->id} AND m.is_test = 0 AND ms.is_current_member = 1 AND ct.is_deleted = 0";
$num_related = CRM_Core_DAO::singleValueQuery($query);
- $max_related = CRM_Utils_Array::value('max_related', $membership[$dao->id]);
+ $max_related = $membership[$dao->id]['max_related'] ?? NULL;
$membership[$dao->id]['related_count'] = ($max_related == '' ? ts('%1 created', [1 => $num_related]) : ts('%1 out of %2', [
1 => $num_related,
2 => $max_related,
@@ -181,7 +181,7 @@ public function browse() {
'limit' => 0,
],
]);
- $membershipTypes = CRM_Utils_Array::value('values', $membershipTypesResult, NULL);
+ $membershipTypes = $membershipTypesResult['values'] ?? NULL;
foreach ($membershipTypes as $key => $value) {
$membershipTypes[$key]['action'] = CRM_Core_Action::formLink(self::membershipTypeslinks(),
diff --git a/CRM/Member/Page/UserDashboard.php b/CRM/Member/Page/UserDashboard.php
index 95759377f519..7ac24c15ff92 100644
--- a/CRM/Member/Page/UserDashboard.php
+++ b/CRM/Member/Page/UserDashboard.php
@@ -43,7 +43,7 @@ public function listMemberships() {
'status',
'membership_type',
] as $fld) {
- $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
+ $membership[$dao->id][$fld] = $statusANDType[$dao->id][$fld] ?? NULL;
}
if (!empty($statusANDType[$dao->id]['is_current_member'])) {
$membership[$dao->id]['active'] = TRUE;
diff --git a/CRM/Member/PseudoConstant.php b/CRM/Member/PseudoConstant.php
index dad1efc157aa..455ff98c9e09 100644
--- a/CRM/Member/PseudoConstant.php
+++ b/CRM/Member/PseudoConstant.php
@@ -96,7 +96,7 @@ public static function &membershipStatus($id = NULL, $cond = NULL, $column = 'na
$value = NULL;
if ($id) {
- $value = CRM_Utils_Array::value($id, self::$membershipStatus[$cacheKey]);
+ $value = self::$membershipStatus[$cacheKey][$id] ?? NULL;
}
else {
$value = self::$membershipStatus[$cacheKey];
diff --git a/CRM/Member/Selector/Search.php b/CRM/Member/Selector/Search.php
index eed017706da9..45ccf5099270 100644
--- a/CRM/Member/Selector/Search.php
+++ b/CRM/Member/Selector/Search.php
@@ -357,7 +357,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
}
//carry campaign on selectors.
- $row['campaign'] = CRM_Utils_Array::value($result->member_campaign_id, $allCampaigns);
+ $row['campaign'] = $allCampaigns[$result->member_campaign_id] ?? NULL;
$row['campaign_id'] = $result->member_campaign_id;
if (!empty($row['member_is_test'])) {
diff --git a/CRM/Member/StateMachine/Search.php b/CRM/Member/StateMachine/Search.php
index 9f9a9514935e..8d3ea7a3c3e1 100644
--- a/CRM/Member/StateMachine/Search.php
+++ b/CRM/Member/StateMachine/Search.php
@@ -69,7 +69,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) {
*/
public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
- $value = CRM_Utils_Array::value('task', $_POST);
+ $value = $_POST['task'] ?? NULL;
if (!isset($value)) {
$value = $this->_controller->get('task');
}
diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php
index 6b4660548e3e..3817a3e30d89 100644
--- a/CRM/PCP/BAO/PCP.php
+++ b/CRM/PCP/BAO/PCP.php
@@ -138,7 +138,7 @@ public static function getPcpDashboardInfo($contactId) {
$action = CRM_Core_Action::formLink($pcpLink, $mask, $replace, ts('more'),
FALSE, 'pcp.dashboard.active', 'PCP', $pcpInfoDao->id);
$component = $pcpInfoDao->page_type;
- $pageTitle = CRM_Utils_Array::value($pcpInfoDao->page_id, $$component);
+ $pageTitle = $$component[$pcpInfoDao->page_id] ?? NULL;
$pcpInfo[] = [
'pageTitle' => $pageTitle,
diff --git a/CRM/PCP/Form/Campaign.php b/CRM/PCP/Form/Campaign.php
index 44d7d872f8ce..a3037bcd35c6 100644
--- a/CRM/PCP/Form/Campaign.php
+++ b/CRM/PCP/Form/Campaign.php
@@ -68,8 +68,8 @@ public function setDefaultValues() {
$defaults['goal_amount'] = CRM_Utils_Money::format($defaults['goal_amount'], NULL, '%a');
}
- $defaults['pcp_title'] = CRM_Utils_Array::value('title', $defaults);
- $defaults['pcp_intro_text'] = CRM_Utils_Array::value('intro_text', $defaults);
+ $defaults['pcp_title'] = $defaults['title'] ?? NULL;
+ $defaults['pcp_intro_text'] = $defaults['intro_text'] ?? NULL;
}
if ($this->get('action') & CRM_Core_Action::ADD) {
@@ -79,8 +79,8 @@ public function setDefaultValues() {
$defaults['is_notify'] = 1;
}
- $this->_contactID = CRM_Utils_Array::value('contact_id', $defaults);
- $this->_contriPageId = CRM_Utils_Array::value('page_id', $defaults);
+ $this->_contactID = $defaults['contact_id'] ?? NULL;
+ $this->_contriPageId = $defaults['page_id'] ?? NULL;
return $defaults;
}
diff --git a/CRM/PCP/Form/Contribute.php b/CRM/PCP/Form/Contribute.php
index 124bbcf1fee0..bbe080e1e46b 100644
--- a/CRM/PCP/Form/Contribute.php
+++ b/CRM/PCP/Form/Contribute.php
@@ -47,7 +47,7 @@ public function setDefaultValues() {
if (isset($this->_id)) {
$params = ['entity_id' => $this->_id, 'entity_table' => 'civicrm_contribution_page'];
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $defaults);
- $defaults['pcp_active'] = CRM_Utils_Array::value('is_active', $defaults);
+ $defaults['pcp_active'] = $defaults['is_active'] ?? NULL;
// Assign contribution page ID to pageId for referencing in PCP.hlp - since $id is overwritten there. dgg
$this->assign('pageId', $this->_id);
}
diff --git a/CRM/PCP/Form/Event.php b/CRM/PCP/Form/Event.php
index 5ea57f4686ee..004282d38358 100644
--- a/CRM/PCP/Form/Event.php
+++ b/CRM/PCP/Form/Event.php
@@ -48,7 +48,7 @@ public function setDefaultValues() {
$params = ['entity_id' => $this->_id, 'entity_table' => 'civicrm_event'];
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCPBlock', $params, $defaults);
- $defaults['pcp_active'] = CRM_Utils_Array::value('is_active', $defaults);
+ $defaults['pcp_active'] = $defaults['is_active'] ?? NULL;
// Assign contribution page ID to pageId for referencing in PCP.hlp - since $id is overwritten there. dgg
$this->assign('pageId', $this->_id);
}
diff --git a/CRM/PCP/Form/PCP.php b/CRM/PCP/Form/PCP.php
index cb7482a3ffb3..d9fbcb7c6975 100644
--- a/CRM/PCP/Form/PCP.php
+++ b/CRM/PCP/Form/PCP.php
@@ -43,8 +43,8 @@ public function preProcess() {
}
if (!$this->_action) {
- $this->_action = CRM_Utils_Array::value('action', $_GET);
- $this->_id = CRM_Utils_Array::value('id', $_GET);
+ $this->_action = $_GET['action'] ?? NULL;
+ $this->_id = $_GET['id'] ?? NULL;
}
else {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
diff --git a/CRM/PCP/Page/PCPInfo.php b/CRM/PCP/Page/PCPInfo.php
index 8468710369d7..de831f3b2479 100644
--- a/CRM/PCP/Page/PCPInfo.php
+++ b/CRM/PCP/Page/PCPInfo.php
@@ -139,7 +139,7 @@ public function run() {
if ($pcpInfo['contact_id'] == $session->get('userID')) {
$owner = $pageInfo;
- $owner['status'] = CRM_Utils_Array::value($pcpInfo['status_id'], $pcpStatus);
+ $owner['status'] = $pcpStatus[$pcpInfo['status_id']] ?? NULL;
$this->assign('owner', $owner);
diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php
index fbe7a757d0fb..4fdc3ec5f656 100644
--- a/CRM/Pledge/BAO/Pledge.php
+++ b/CRM/Pledge/BAO/Pledge.php
@@ -157,7 +157,7 @@ public static function create(&$params) {
}
}
}
- $paymentParams['status_id'] = CRM_Utils_Array::value('status_id', $params);
+ $paymentParams['status_id'] = $params['status_id'] ?? NULL;
$pledge = self::add($params);
if (is_a($pledge, 'CRM_Core_Error')) {
@@ -195,7 +195,7 @@ public static function create(&$params) {
'actual_amount',
);
foreach ($paymentKeys as $key) {
- $paymentParams[$key] = CRM_Utils_Array::value($key, $params, NULL);
+ $paymentParams[$key] = $params[$key] ?? NULL;
}
CRM_Pledge_BAO_PledgePayment::create($paymentParams);
}
@@ -626,8 +626,8 @@ public static function sendAcknowledgment(&$form, $params) {
// check for online pledge.
if (!empty($params['receipt_from_email'])) {
- $userName = CRM_Utils_Array::value('receipt_from_name', $params);
- $userEmail = CRM_Utils_Array::value('receipt_from_email', $params);
+ $userName = $params['receipt_from_name'] ?? NULL;
+ $userEmail = $params['receipt_from_email'] ?? NULL;
}
elseif (!empty($params['from_email_id'])) {
$receiptFrom = $params['from_email_id'];
@@ -638,8 +638,8 @@ public static function sendAcknowledgment(&$form, $params) {
}
else {
// set the domain values.
- $userName = CRM_Utils_Array::value('name', $domainValues);
- $userEmail = CRM_Utils_Array::value('email', $domainValues);
+ $userName = $domainValues['name'] ?? NULL;
+ $userEmail = $domainValues['email'] ?? NULL;
}
if (!isset($receiptFrom)) {
diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php
index 1ac0016cda07..8d363e06f9ac 100644
--- a/CRM/Pledge/BAO/PledgeBlock.php
+++ b/CRM/Pledge/BAO/PledgeBlock.php
@@ -90,7 +90,7 @@ public static function add(&$params) {
$pledgeBlock = new CRM_Pledge_DAO_PledgeBlock();
// fix for pledge_frequency_unit
- $freqUnits = CRM_Utils_Array::value('pledge_frequency_unit', $params);
+ $freqUnits = $params['pledge_frequency_unit'] ?? NULL;
if ($freqUnits && is_array($freqUnits)) {
unset($params['pledge_frequency_unit']);
@@ -231,7 +231,7 @@ public static function buildPledgeBlock($form) {
1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)),
2 => $payment['scheduled_date'] ?? NULL,
));
- $paymentID = CRM_Utils_Array::value('id', $payment);
+ $paymentID = $payment['id'] ?? NULL;
$payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $payment)));
}
}
@@ -241,7 +241,7 @@ public static function buildPledgeBlock($form) {
1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)),
2 => $nextPayment['scheduled_date'] ?? NULL,
));
- $paymentID = CRM_Utils_Array::value('id', $nextPayment);
+ $paymentID = $nextPayment['id'] ?? NULL;
$payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $nextPayment)));
}
// give error if empty or build form for payment.
diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php
index 010335cddd14..a4418c1813ba 100644
--- a/CRM/Pledge/Form/Pledge.php
+++ b/CRM/Pledge/Form/Pledge.php
@@ -205,7 +205,7 @@ public function buildQuickForm() {
}
$showAdditionalInfo = FALSE;
- $this->_formType = CRM_Utils_Array::value('formType', $_GET);
+ $this->_formType = $_GET['formType'] ?? NULL;
$defaults = [];
@@ -446,12 +446,12 @@ public function postProcess() {
'campaign_id',
];
foreach ($fields as $f) {
- $params[$f] = CRM_Utils_Array::value($f, $formValues);
+ $params[$f] = $formValues[$f] ?? NULL;
}
// format amount
$params['amount'] = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('amount', $formValues));
- $params['currency'] = CRM_Utils_Array::value('currency', $formValues);
+ $params['currency'] = $formValues['currency'] ?? NULL;
$params['original_installment_amount'] = ($params['amount'] / $params['installments']);
$dates = ['create_date', 'start_date', 'acknowledge_date', 'cancel_date'];
diff --git a/CRM/Pledge/Selector/Search.php b/CRM/Pledge/Selector/Search.php
index fa142004dcf2..aef07fbcfa99 100644
--- a/CRM/Pledge/Selector/Search.php
+++ b/CRM/Pledge/Selector/Search.php
@@ -167,8 +167,8 @@ public function __construct(
*/
public static function &links() {
$args = func_get_args();
- $hideOption = CRM_Utils_Array::value(0, $args);
- $key = CRM_Utils_Array::value(1, $args);
+ $hideOption = $args[0] ?? NULL;
+ $key = $args[1] ?? NULL;
$extraParams = ($key) ? "&key={$key}" : NULL;
@@ -299,7 +299,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
}
// carry campaign on selectors.
- $row['campaign'] = CRM_Utils_Array::value($result->pledge_campaign_id, $allCampaigns);
+ $row['campaign'] = $allCampaigns[$result->pledge_campaign_id] ?? NULL;
$row['campaign_id'] = $result->pledge_campaign_id;
// add pledge status name
diff --git a/CRM/Pledge/StateMachine/Search.php b/CRM/Pledge/StateMachine/Search.php
index 9b8eb4a85a70..b47ba015f97c 100644
--- a/CRM/Pledge/StateMachine/Search.php
+++ b/CRM/Pledge/StateMachine/Search.php
@@ -69,7 +69,7 @@ public function __construct($controller, $action = CRM_Core_Action::NONE) {
*/
public function taskName($controller, $formName = 'Search') {
// total hack, check POST vars and then session to determine stuff
- $value = CRM_Utils_Array::value('task', $_POST);
+ $value = $_POST['task'] ?? NULL;
if (!isset($value)) {
$value = $this->_controller->get('task');
}
diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php
index 9c5b9bd58c0c..516b2c84ec23 100644
--- a/CRM/Price/BAO/LineItem.php
+++ b/CRM/Price/BAO/LineItem.php
@@ -32,7 +32,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
* @throws \Exception
*/
public static function create(&$params) {
- $id = CRM_Utils_Array::value('id', $params);
+ $id = $params['id'] ?? NULL;
if ($id) {
CRM_Utils_Hook::pre('edit', 'LineItem', $id, $params);
$op = CRM_Core_Action::UPDATE;
@@ -45,8 +45,8 @@ public static function create(&$params) {
// unset entity table and entity id in $params
// we never update the entity table and entity id during update mode
if ($id) {
- $entity_id = CRM_Utils_Array::value('entity_id', $params);
- $entity_table = CRM_Utils_Array::value('entity_table', $params);
+ $entity_id = $params['entity_id'] ?? NULL;
+ $entity_table = $params['entity_table'] ?? NULL;
unset($params['entity_id'], $params['entity_table']);
}
else {
@@ -242,7 +242,7 @@ public static function getLineItems($entityId, $entity = 'participant', $isQuick
$getTaxDetails = FALSE;
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause $orderByClause", $params);
while ($dao->fetch()) {
@@ -286,7 +286,7 @@ public static function getLineItems($entityId, $entity = 'participant', $isQuick
}
if ($invoicing) {
// @todo - this is an inappropriate place to be doing form level assignments.
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
+ $taxTerm = $invoiceSettings['tax_term'] ?? NULL;
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('taxTerm', $taxTerm);
$smarty->assign('getTaxDetails', $getTaxDetails);
@@ -329,7 +329,7 @@ public static function format($fid, $params, $fields, &$values, $amount_override
else {
CRM_Price_BAO_PriceFieldValue::getValues($fid, $options, 'weight', TRUE);
}
- $fieldTitle = CRM_Utils_Array::value('label', $fields);
+ $fieldTitle = $fields['label'] ?? NULL;
if (!$fieldTitle) {
$fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $fid, 'label');
}
@@ -533,7 +533,7 @@ public static function getLineItemArray(&$params, $entityId = NULL, $entityTable
if (!$entityId) {
$priceSetDetails = CRM_Price_BAO_PriceSet::getDefaultPriceSet($entityTable);
$totalAmount = CRM_Utils_Array::value('partial_payment_total', $params, CRM_Utils_Array::value('total_amount', $params));
- $financialType = CRM_Utils_Array::value('financial_type_id', $params);
+ $financialType = $params['financial_type_id'] ?? NULL;
foreach ($priceSetDetails as $values) {
if ($entityTable == 'membership') {
if ($isRelatedID != $values['membership_type_id']) {
diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php
index a65ec27c09af..411d11ede55b 100644
--- a/CRM/Price/BAO/PriceField.php
+++ b/CRM/Price/BAO/PriceField.php
@@ -294,7 +294,7 @@ public static function addQuickFormElement(
$is_pay_later = 1;
}
elseif (isset($qf->_values)) {
- $is_pay_later = CRM_Utils_Array::value('is_pay_later', $qf->_values);
+ $is_pay_later = $qf->_values['is_pay_later'] ?? NULL;
}
$otherAmount = $qf->get('values');
@@ -325,15 +325,15 @@ public static function addQuickFormElement(
$valueFieldName = 'amount';
$seperator = '|';
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
- $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings);
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $taxTerm = $invoiceSettings['tax_term'] ?? NULL;
+ $displayOpt = $invoiceSettings['tax_display_settings'] ?? NULL;
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
switch ($field->html_type) {
case 'Text':
$optionKey = key($customOption);
$count = CRM_Utils_Array::value('count', $customOption[$optionKey], '');
$max_value = CRM_Utils_Array::value('max_value', $customOption[$optionKey], '');
- $taxAmount = CRM_Utils_Array::value('tax_amount', $customOption[$optionKey]);
+ $taxAmount = $customOption[$optionKey]['tax_amount'] ?? NULL;
if (isset($taxAmount) && $displayOpt && $invoicing) {
$qf->assign('displayOpt', $displayOpt);
$qf->assign('taxTerm', $taxTerm);
@@ -400,7 +400,7 @@ public static function addQuickFormElement(
}
foreach ($customOption as $opId => $opt) {
- $taxAmount = CRM_Utils_Array::value('tax_amount', $opt);
+ $taxAmount = $opt['tax_amount'] ?? NULL;
if ($field->is_display_amounts) {
$opt['label'] = !empty($opt['label']) ? $opt['label'] . ' - ' : '';
$preHelpText = $postHelpText = '';
@@ -512,7 +512,7 @@ public static function addQuickFormElement(
$selectOption = $allowedOptions = $priceVal = [];
foreach ($customOption as $opt) {
- $taxAmount = CRM_Utils_Array::value('tax_amount', $opt);
+ $taxAmount = $opt['tax_amount'] ?? NULL;
$count = CRM_Utils_Array::value('count', $opt, '');
$max_value = CRM_Utils_Array::value('max_value', $opt, '');
@@ -568,7 +568,7 @@ public static function addQuickFormElement(
$check = [];
foreach ($customOption as $opId => $opt) {
- $taxAmount = CRM_Utils_Array::value('tax_amount', $opt);
+ $taxAmount = $opt['tax_amount'] ?? NULL;
$count = CRM_Utils_Array::value('count', $opt, '');
$max_value = CRM_Utils_Array::value('max_value', $opt, '');
diff --git a/CRM/Price/BAO/PriceFieldValue.php b/CRM/Price/BAO/PriceFieldValue.php
index a8cfdb9eff06..34d431210a9b 100644
--- a/CRM/Price/BAO/PriceFieldValue.php
+++ b/CRM/Price/BAO/PriceFieldValue.php
@@ -39,7 +39,7 @@ public static function add(&$params, $ids = []) {
$fieldValueBAO->copyValues($params);
// CRM-16189
- $priceFieldID = CRM_Utils_Array::value('price_field_id', $params);
+ $priceFieldID = $params['price_field_id'] ?? NULL;
$id = CRM_Utils_Array::value('id', $ids, CRM_Utils_Array::value('id', $params));
@@ -102,7 +102,7 @@ public static function create(&$params, $ids = []) {
}
}
- $financialType = CRM_Utils_Array::value('financial_type_id', $params, NULL);
+ $financialType = $params['financial_type_id'] ?? NULL;
if (!$financialType && $id) {
$financialType = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $id, 'financial_type_id', 'id');
}
diff --git a/CRM/Price/BAO/PriceSet.php b/CRM/Price/BAO/PriceSet.php
index f9e24c14d942..c2878d80db38 100644
--- a/CRM/Price/BAO/PriceSet.php
+++ b/CRM/Price/BAO/PriceSet.php
@@ -61,7 +61,7 @@ public static function create(&$params) {
$params['extends'] = CRM_Utils_Array::implodePadded($params['extends']);
}
else {
- $priceSetID = CRM_Utils_Array::value('id', $params);
+ $priceSetID = $params['id'] ?? NULL;
}
$priceSetBAO = new CRM_Price_BAO_PriceSet();
$priceSetBAO->copyValues($params);
@@ -340,7 +340,7 @@ public static function getSetId(&$params) {
}
}
else {
- $fid = CRM_Utils_Array::value('fid', $params);
+ $fid = $params['fid'] ?? NULL;
}
if (isset($fid)) {
@@ -603,8 +603,8 @@ public static function initSet(&$form, $entityTable = 'civicrm_event', $validOnl
$form->_priceSetId = $priceSetId;
$priceSet = self::getSetDetail($priceSetId, $required, $validOnly);
- $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
- $form->_values['fee'] = CRM_Utils_Array::value('fields', $form->_priceSet);
+ $form->_priceSet = $priceSet[$priceSetId] ?? NULL;
+ $form->_values['fee'] = $form->_priceSet['fields'] ?? NULL;
//get the price set fields participant count.
if ($entityTable == 'civicrm_event') {
@@ -829,7 +829,7 @@ public static function buildPriceSet(&$form) {
}
$priceSet = self::getSetDetail($priceSetId, TRUE, $validFieldsOnly);
- $form->_priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
+ $form->_priceSet = $priceSet[$priceSetId] ?? NULL;
$validPriceFieldIds = array_keys($form->_priceSet['fields']);
$form->_quickConfig = $quickConfig = 0;
if (CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config')) {
@@ -900,7 +900,7 @@ public static function buildPriceSet(&$form) {
(CRM_Utils_Array::value('visibility', $field) == 'admin' && $adminFieldVisible == TRUE) ||
!$validFieldsOnly
) {
- $options = CRM_Utils_Array::value('options', $field);
+ $options = $field['options'] ?? NULL;
if ($className == 'CRM_Contribute_Form_Contribution_Main' && $component = 'membership') {
$userid = $form->getVar('_membershipContactID');
$checklifetime = self::checkCurrentMembership($options, $userid);
@@ -1743,7 +1743,7 @@ protected static function getLine(&$params, &$lineItem, $priceSetID, $field, $id
$lineItem[$optionValueId]['line_total'] = $lineItem[$optionValueId]['unit_price'] = CRM_Utils_Rule::cleanMoney($lineItem[$optionValueId]['line_total'] - $lineItem[$optionValueId]['tax_amount']);
}
}
- $totalPrice += $lineItem[$optionValueId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionValueId]);
+ $totalPrice += $lineItem[$optionValueId]['line_total'] + $lineItem[$optionValueId]['tax_amount'] ?? NULL;
break;
case 'Select':
@@ -1754,7 +1754,7 @@ protected static function getLine(&$params, &$lineItem, $priceSetID, $field, $id
if (!empty($field['options'][$optionValueId]['tax_rate'])) {
$lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax);
}
- $totalPrice += $lineItem[$optionValueId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionValueId]);
+ $totalPrice += $lineItem[$optionValueId]['line_total'] + $lineItem[$optionValueId]['tax_amount'] ?? NULL;
break;
case 'CheckBox':
@@ -1764,7 +1764,7 @@ protected static function getLine(&$params, &$lineItem, $priceSetID, $field, $id
if (!empty($field['options'][$optionId]['tax_rate'])) {
$lineItem = self::setLineItem($field, $lineItem, $optionId, $totalTax);
}
- $totalPrice += $lineItem[$optionId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionId]);
+ $totalPrice += $lineItem[$optionId]['line_total'] + $lineItem[$optionId]['tax_amount'] ?? NULL;
}
break;
}
diff --git a/CRM/Price/Form/Field.php b/CRM/Price/Form/Field.php
index 5e4a5c4e8d25..c8e0f2a7b7da 100644
--- a/CRM/Price/Form/Field.php
+++ b/CRM/Price/Form/Field.php
@@ -574,7 +574,7 @@ public static function formRule($fields, $files, $form) {
for ($index = 1; $index <= self::NUM_OPTION; $index++) {
$isOptionSet = !empty($fields['option_label'][$index]) || !empty($fields['option_amount'][$index]);
- $currentOptionVisibility = CRM_Utils_Array::value($fields['option_visibility_id'][$index], $visibilityOptions);
+ $currentOptionVisibility = $visibilityOptions[$fields['option_visibility_id'][$index]] ?? NULL;
if ($isOptionSet && $currentOptionVisibility == 'public') {
$errors["option_visibility_id[{$index}]"] = ts('\'Admin\' field should only have \'Admin\' visibility options.');
diff --git a/CRM/Price/Form/Set.php b/CRM/Price/Form/Set.php
index 47f45516f22c..96a5b53cb349 100644
--- a/CRM/Price/Form/Set.php
+++ b/CRM/Price/Form/Set.php
@@ -269,7 +269,7 @@ public function postProcess() {
$params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $params, FALSE);
$compIds = [];
- $extends = CRM_Utils_Array::value('extends', $params);
+ $extends = $params['extends'] ?? NULL;
if (is_array($extends)) {
foreach ($extends as $compId => $selected) {
if ($selected) {
diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php
index 8279fc310a7b..141670e4d10b 100644
--- a/CRM/Price/Page/Field.php
+++ b/CRM/Price/Page/Field.php
@@ -111,8 +111,8 @@ public function browse() {
// display taxTerm for priceFields
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $taxTerm = $invoiceSettings['tax_term'] ?? NULL;
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$getTaxDetails = FALSE;
$taxRate = CRM_Core_PseudoConstant::getTaxRates();
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes);
@@ -126,7 +126,7 @@ public function browse() {
$params = ['price_field_id' => $priceFieldBAO->id];
CRM_Price_BAO_PriceFieldValue::retrieve($params, $optionValues);
- $priceField[$priceFieldBAO->id]['price'] = CRM_Utils_Array::value('amount', $optionValues);
+ $priceField[$priceFieldBAO->id]['price'] = $optionValues['amount'] ?? NULL;
$financialTypeId = $optionValues['financial_type_id'];
if ($invoicing && isset($taxRate[$financialTypeId])) {
$priceField[$priceFieldBAO->id]['tax_rate'] = $taxRate[$financialTypeId];
diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php
index f7b46ab6893b..df3b6a3fc99a 100644
--- a/CRM/Price/Page/Option.php
+++ b/CRM/Price/Page/Option.php
@@ -130,8 +130,8 @@ public function browse() {
$taxRate = CRM_Core_PseudoConstant::getTaxRates();
// display taxTerm for priceFields
$invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
- $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
- $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
+ $taxTerm = $invoiceSettings['tax_term'] ?? NULL;
+ $invoicing = $invoiceSettings['invoicing'] ?? NULL;
$getTaxDetails = FALSE;
foreach ($customOption as $id => $values) {
$action = array_sum(array_keys(self::actionLinks()));
diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php
index f8f7f01b9b48..39fae8b8f6ca 100644
--- a/CRM/Profile/Form.php
+++ b/CRM/Profile/Form.php
@@ -994,7 +994,7 @@ public static function formRule($fields, $files, $form) {
if (!$register && empty($fields['_qf_Edit_upload_duplicate'])) {
// fix for CRM-3240
if (!empty($fields['email-Primary'])) {
- $fields['email'] = CRM_Utils_Array::value('email-Primary', $fields);
+ $fields['email'] = $fields['email-Primary'] ?? NULL;
}
// fix for CRM-6141
@@ -1187,7 +1187,7 @@ public function postProcess() {
}
}
- $addToGroupId = CRM_Utils_Array::value('add_to_group_id', $this->_ufGroup);
+ $addToGroupId = $this->_ufGroup['add_to_group_id'] ?? NULL;
if (!empty($addToGroupId)) {
//run same check whether group is a mailing list
$groupTypes = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group',
diff --git a/CRM/Profile/Form/Edit.php b/CRM/Profile/Form/Edit.php
index 29c350841ada..57f51cc3c22b 100644
--- a/CRM/Profile/Form/Edit.php
+++ b/CRM/Profile/Form/Edit.php
@@ -188,7 +188,7 @@ public function buildQuickForm() {
$this->_cancelURL = str_replace('&', '&', $this->_cancelURL);
// also retain error URL if set
- $this->_errorURL = CRM_Utils_Array::value('errorURL', $_POST);
+ $this->_errorURL = $_POST['errorURL'] ?? NULL;
if ($this->_errorURL) {
// we do this gross hack since qf also does entity replacement
$this->_errorURL = str_replace('&', '&', $this->_errorURL);
@@ -252,7 +252,7 @@ public function postProcess() {
]);
foreach (explode(',', $this->returnExtra) as $field) {
$field = trim($field);
- $this->ajaxResponse['extra'][$field] = CRM_Utils_Array::value($field, $contact);
+ $this->ajaxResponse['extra'][$field] = $contact[$field] ?? NULL;
}
}
diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php
index 0b84b8753e91..46807507ce54 100644
--- a/CRM/Profile/Page/Listings.php
+++ b/CRM/Profile/Page/Listings.php
@@ -205,7 +205,7 @@ public function preProcess() {
}
}
- $customField = CRM_Utils_Array::value($name, $this->_customFields);
+ $customField = $this->_customFields[$name] ?? NULL;
if (!empty($_POST) && empty($_POST[$name])) {
if ($customField) {
@@ -410,7 +410,7 @@ public static function getProfileContact($gid) {
CRM_Core_Error::statusBounce(ts('This profile does not have the map feature turned on.'));
}
- $groupId = CRM_Utils_Array::value('limit_listings_group_id', $details);
+ $groupId = $details['limit_listings_group_id'] ?? NULL;
// add group id to params if a uf group belong to a any group
if ($groupId) {
diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php
index 0593c82c3d04..8fecd4ae05aa 100644
--- a/CRM/Profile/Page/MultipleRecordFieldsListing.php
+++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php
@@ -219,8 +219,8 @@ public function browse() {
if ($returnValues['data_type'] == 'Date') {
$dateFields[$fieldIDs[$key]] = 1;
$actualPHPFormats = CRM_Utils_Date::datePluginToPHPFormats();
- $dateFormat = (array) CRM_Utils_Array::value($returnValues['date_format'], $actualPHPFormats);
- $timeFormat = CRM_Utils_Array::value('time_format', $returnValues);
+ $dateFormat = (array) $actualPHPFormats[$returnValues['date_format']] ?? NULL;
+ $timeFormat = $returnValues['time_format'] ?? NULL;
}
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
@@ -233,12 +233,12 @@ public function browse() {
$options[$fieldIDs[$key]]['attributes']['html_type'] = $returnValues['html_type'];
$options[$fieldIDs[$key]]['attributes']['data_type'] = $returnValues['data_type'];
$options[$fieldIDs[$key]]['attributes']['is_required'] = !empty($returnValues['is_required']);
- $options[$fieldIDs[$key]]['attributes']['default_value'] = CRM_Utils_Array::value('default_value', $returnValues);
- $options[$fieldIDs[$key]]['attributes']['is_view'] = CRM_Utils_Array::value('is_view', $returnValues);
+ $options[$fieldIDs[$key]]['attributes']['default_value'] = $returnValues['default_value'] ?? NULL;
+ $options[$fieldIDs[$key]]['attributes']['is_view'] = $returnValues['is_view'] ?? NULL;
$options[$fieldIDs[$key]]['attributes']['format']
- = $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
- $options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
+ = $options[$fieldIDs[$key]]['attributes']['date_format'] = $returnValues['date_format'] ?? NULL;
+ $options[$fieldIDs[$key]]['attributes']['time_format'] = $returnValues['time_format'] ?? NULL;
}
$linkAction = array_sum(array_keys($this->links()));
}
diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php
index 09eb0a6e98e9..8c7cd1995991 100644
--- a/CRM/Profile/Selector/Listings.php
+++ b/CRM/Profile/Selector/Listings.php
@@ -307,9 +307,9 @@ public function &getColumnHeaders($action = NULL, $output = NULL) {
if (strpos($name, '-') !== FALSE) {
$value = explode('-', $name);
- $fieldName = CRM_Utils_Array::value(0, $value);
- $lType = CRM_Utils_Array::value(1, $value);
- $type = CRM_Utils_Array::value(2, $value);
+ $fieldName = $value[0] ?? NULL;
+ $lType = $value[1] ?? NULL;
+ $type = $value[2] ?? NULL;
if (!in_array($fieldName, $multipleFields)) {
if ($lType == 'Primary') {
@@ -380,7 +380,7 @@ public function getTotalCount($action) {
if ($this->_multiRecordTableName &&
!array_key_exists($this->_multiRecordTableName, $this->_query->_whereTables)
) {
- $additionalFromClause = CRM_Utils_Array::value($this->_multiRecordTableName, $this->_query->_tables);
+ $additionalFromClause = $this->_query->_tables[$this->_multiRecordTableName] ?? NULL;
$returnQuery = TRUE;
}
@@ -436,7 +436,7 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $ex
foreach ($vars as $key => $field) {
$field = $vars[$key];
$fieldArray = explode('-', $field['name']);
- $fieldType = CRM_Utils_Array::value('2', $fieldArray);
+ $fieldType = $fieldArray['2'] ?? NULL;
if (is_numeric(CRM_Utils_Array::value('1', $fieldArray))) {
if (!in_array($fieldType, $multipleFields)) {
$locationType = new CRM_Core_DAO_LocationType();
@@ -513,14 +513,14 @@ public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $ex
) {
if (strpos($key, '-') !== FALSE) {
$value = explode('-', $key);
- $fieldName = CRM_Utils_Array::value(0, $value);
- $id = CRM_Utils_Array::value(1, $value);
- $type = CRM_Utils_Array::value(2, $value);
+ $fieldName = $value[0] ?? NULL;
+ $id = $value[1] ?? NULL;
+ $type = $value[2] ?? NULL;
if (!in_array($fieldName, $multipleFields)) {
$locationTypeName = NULL;
if (is_numeric($id)) {
- $locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
+ $locationTypeName = $locationTypes[$id] ?? NULL;
}
else {
if ($id == 'Primary') {
diff --git a/CRM/Queue/Runner.php b/CRM/Queue/Runner.php
index d44a073b5232..36588d5aeb9a 100644
--- a/CRM/Queue/Runner.php
+++ b/CRM/Queue/Runner.php
@@ -97,8 +97,8 @@ public function __construct($runnerSpec) {
$this->queue = $runnerSpec['queue'];
$this->errorMode = CRM_Utils_Array::value('errorMode', $runnerSpec, self::ERROR_ABORT);
$this->isMinimal = CRM_Utils_Array::value('isMinimal', $runnerSpec, FALSE);
- $this->onEnd = CRM_Utils_Array::value('onEnd', $runnerSpec, NULL);
- $this->onEndUrl = CRM_Utils_Array::value('onEndUrl', $runnerSpec, NULL);
+ $this->onEnd = $runnerSpec['onEnd'] ?? NULL;
+ $this->onEndUrl = $runnerSpec['onEndUrl'] ?? NULL;
$this->pathPrefix = CRM_Utils_Array::value('pathPrefix', $runnerSpec, 'civicrm/queue');
$this->buttons = CRM_Utils_Array::value('buttons', $runnerSpec, ['retry' => TRUE, 'skip' => TRUE]);
// perhaps this value should be randomized?
diff --git a/CRM/Report/BAO/ReportInstance.php b/CRM/Report/BAO/ReportInstance.php
index 2c7f1034288d..c396235d405f 100644
--- a/CRM/Report/BAO/ReportInstance.php
+++ b/CRM/Report/BAO/ReportInstance.php
@@ -114,10 +114,10 @@ public static function add(&$params) {
*/
public static function &create(&$params) {
if (isset($params['report_header'])) {
- $params['header'] = CRM_Utils_Array::value('report_header', $params);
+ $params['header'] = $params['report_header'] ?? NULL;
}
if (isset($params['report_footer'])) {
- $params['footer'] = CRM_Utils_Array::value('report_footer', $params);
+ $params['footer'] = $params['report_footer'] ?? NULL;
}
// build navigation parameters
@@ -131,8 +131,8 @@ public static function &create(&$params) {
$navigationParams['label'] = $params['title'];
$navigationParams['name'] = $params['title'];
- $navigationParams['current_parent_id'] = CRM_Utils_Array::value('parent_id', $navigationParams);
- $navigationParams['parent_id'] = CRM_Utils_Array::value('parent_id', $params);
+ $navigationParams['current_parent_id'] = $navigationParams['parent_id'] ?? NULL;
+ $navigationParams['parent_id'] = $params['parent_id'] ?? NULL;
$navigationParams['is_active'] = 1;
if ($permission = CRM_Utils_Array::value('permission', $params)) {
diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php
index cf099a3debbe..8a20be0abd06 100644
--- a/CRM/Report/Form.php
+++ b/CRM/Report/Form.php
@@ -614,7 +614,7 @@ public function preProcessCommon() {
CRM_Utils_System::civiExit();
}
- $formValues = CRM_Utils_Array::value('form_values', $this->_instanceValues);
+ $formValues = $this->_instanceValues['form_values'] ?? NULL;
if ($formValues) {
$this->_formValues = CRM_Utils_String::unserialize($formValues);
}
@@ -947,8 +947,8 @@ public function setDefaultValues($freeze = TRUE) {
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
) {
if (is_array($field['default'])) {
- $this->_defaults["{$fieldName}_from"] = CRM_Utils_Array::value('from', $field['default']);
- $this->_defaults["{$fieldName}_to"] = CRM_Utils_Array::value('to', $field['default']);
+ $this->_defaults["{$fieldName}_from"] = $field['default']['from'] ?? NULL;
+ $this->_defaults["{$fieldName}_to"] = $field['default']['to'] ?? NULL;
$this->_defaults["{$fieldName}_relative"] = 0;
}
else {
@@ -957,8 +957,8 @@ public function setDefaultValues($freeze = TRUE) {
}
else {
if ((CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_INT) && is_array($field['default'])) {
- $this->_defaults["{$fieldName}_min"] = CRM_Utils_Array::value('min', $field['default']);
- $this->_defaults["{$fieldName}_max"] = CRM_Utils_Array::value('max', $field['default']);
+ $this->_defaults["{$fieldName}_min"] = $field['default']['min'] ?? NULL;
+ $this->_defaults["{$fieldName}_max"] = $field['default']['max'] ?? NULL;
}
$this->_defaults["{$fieldName}_value"] = $field['default'];
}
@@ -1216,11 +1216,11 @@ public function addColumns() {
$colGroups[$tableName]['use_accordian_for_field_selection'] = TRUE;
}
- $colGroups[$tableName]['fields'][$fieldName] = CRM_Utils_Array::value('title', $field);
+ $colGroups[$tableName]['fields'][$fieldName] = $field['title'] ?? NULL;
if ($groupTitle && empty($colGroups[$tableName]['group_title'])) {
$colGroups[$tableName]['group_title'] = $groupTitle;
}
- $options[$fieldName] = CRM_Utils_Array::value('title', $field);
+ $options[$fieldName] = $field['title'] ?? NULL;
}
}
}
@@ -2741,9 +2741,9 @@ public function select() {
public function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
if (!empty($field['pseudofield'])) {
$alias = "{$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['dbAlias'] = CRM_Utils_Array::value('dbAlias', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['dbAlias'] = $field['dbAlias'] ?? NULL;
$this->_selectAliases[] = $alias;
return ' 1 as ' . $alias;
}
@@ -3031,7 +3031,7 @@ public function storeOrderByArray() {
// Record any section headers for assignment to the template
if (!empty($orderBy['section'])) {
- $orderByField['pageBreak'] = CRM_Utils_Array::value('pageBreak', $orderBy);
+ $orderByField['pageBreak'] = $orderBy['pageBreak'] ?? NULL;
$this->_sections[$orderByField['tplField']] = $orderByField;
}
}
@@ -3326,16 +3326,16 @@ public function filterStat(&$statistics) {
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
$value = NULL;
if ($op) {
$pair = $this->getOperationPair(
CRM_Utils_Array::value('operatorType', $field),
$fieldName
);
- $min = CRM_Utils_Array::value("{$fieldName}_min", $this->_params);
- $max = CRM_Utils_Array::value("{$fieldName}_max", $this->_params);
- $val = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
+ $min = $this->_params["{$fieldName}_min"] ?? NULL;
+ $max = $this->_params["{$fieldName}_max"] ?? NULL;
+ $val = $this->_params["{$fieldName}_value"] ?? NULL;
if (in_array($op, ['bw', 'nbw']) && ($min || $max)) {
$value = "{$pair[$op]} $min " . ts('and') . " $max";
}
@@ -3361,7 +3361,7 @@ public function filterStat(&$statistics) {
}
}
$pair[$op] = (count($val) == 1) ? (($op == 'notin' || $op ==
- 'mnot') ? ts('Is Not') : ts('Is')) : CRM_Utils_Array::value($op, $pair);
+ 'mnot') ? ts('Is Not') : ts('Is')) : $pair[$op] ?? NULL;
$val = implode(', ', $val);
$value = "{$pair[$op]} " . $val;
}
@@ -3545,7 +3545,7 @@ public function compileContent() {
$templateFile = $this->getHookedTemplateFileName();
return CRM_Utils_Array::value('report_header', $this->_formValues) .
CRM_Core_Form::$_template->fetch($templateFile) .
- CRM_Utils_Array::value('report_footer', $this->_formValues);
+ $this->_formValues['report_footer'] ?? NULL;
}
/**
@@ -5317,8 +5317,8 @@ protected function addStatisticsToSelect($field, $tableName, $fieldName, $select
protected function addBasicFieldToSelect($tableName, $fieldName, $field, $select) {
$alias = "{$tableName}_{$fieldName}";
$select[] = "{$field['dbAlias']} as $alias";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_selectAliases[] = $alias;
return $select;
}
@@ -5955,7 +5955,7 @@ protected function getDefaultsFromOptions($options) {
protected function getSelectClauseWithGroupConcatIfNotGroupedBy($tableName, &$fieldName, &$field) {
if ($this->groupConcatTested && (!empty($this->_groupByArray) || $this->isForceGroupBy)) {
if ((empty($field['statistics']) || in_array('GROUP_CONCAT', $field['statistics']))) {
- $label = CRM_Utils_Array::value('title', $field);
+ $label = $field['title'] ?? NULL;
$alias = $field['tplField'] ?? "{$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $label;
$this->_selectAliases[] = $alias;
@@ -5983,24 +5983,24 @@ protected function generateFilterClause($field, $fieldName) {
if (CRM_Utils_Array::value('operatorType', $field) ==
CRM_Report_Form::OP_MONTH
) {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
- $value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
+ $value = $this->_params["{$fieldName}_value"] ?? NULL;
if (is_array($value) && !empty($value)) {
return "(month({$field['dbAlias']}) $op (" . implode(', ', $value) .
'))';
}
}
else {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
- $fromTime = CRM_Utils_Array::value("{$fieldName}_from_time", $this->_params);
- $toTime = CRM_Utils_Array::value("{$fieldName}_to_time", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
+ $fromTime = $this->_params["{$fieldName}_from_time"] ?? NULL;
+ $toTime = $this->_params["{$fieldName}_to_time"] ?? NULL;
return $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type'], $fromTime, $toTime);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
return $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php
index fa98ce2afda7..6bd904d4d73b 100644
--- a/CRM/Report/Form/Activity.php
+++ b/CRM/Report/Form/Activity.php
@@ -536,14 +536,14 @@ public function where($recordType = NULL) {
continue;
}
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op && !($fieldName == "contact_{$recordType}" && ($op != 'nnll' || $op != 'nll'))) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/ActivitySummary.php b/CRM/Report/Form/ActivitySummary.php
index e607a8b70fb7..0e7e780f9159 100644
--- a/CRM/Report/Form/ActivitySummary.php
+++ b/CRM/Report/Form/ActivitySummary.php
@@ -260,15 +260,15 @@ public function select() {
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
}
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
}
}
}
@@ -364,14 +364,14 @@ public function where($durationMode = FALSE) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Campaign/SurveyDetails.php b/CRM/Report/Form/Campaign/SurveyDetails.php
index 8b524e07b3a1..3ab6dd59964e 100644
--- a/CRM/Report/Form/Campaign/SurveyDetails.php
+++ b/CRM/Report/Form/Campaign/SurveyDetails.php
@@ -250,7 +250,7 @@ public function select() {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
// Set default title
- $title = CRM_Utils_Array::value('title', $field);
+ $title = $field['title'] ?? NULL;
// Check for an override.
if (!empty($this->_columnTitleOverrides["{$tableName}_{$fieldName}"])) {
$title = $this->_columnTitleOverrides["{$tableName}_{$fieldName}"];
@@ -309,14 +309,14 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
@@ -363,7 +363,7 @@ public function compileContent() {
$templateFile = $this->getHookedTemplateFileName();
return $coverSheet .
CRM_Core_Form::$_template->fetch($templateFile) .
- CRM_Utils_Array::value('report_footer', $this->_formValues);
+ $this->_formValues['report_footer'] ?? NULL;
}
/**
@@ -371,7 +371,7 @@ public function compileContent() {
*/
private function _surveyCoverSheet() {
$coverSheet = NULL;
- $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
+ $surveyIds = $this->_params['survey_id_value'] ?? NULL;
if (CRM_Utils_System::isNull($surveyIds)) {
return $coverSheet;
}
@@ -498,7 +498,7 @@ public function alterDisplay(&$rows) {
* @param $rows
*/
private function _formatSurveyResult(&$rows) {
- $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
+ $surveyIds = $this->_params['survey_id_value'] ?? NULL;
if (CRM_Utils_System::isNull($surveyIds) ||
empty($this->_params['fields']['result']) ||
!in_array($this->_outputMode, array('print', 'pdf'))
@@ -523,16 +523,16 @@ private function _formatSurveyResult(&$rows) {
$resultSet[$result->id][$result->value] = $result->label;
}
- $statusId = CRM_Utils_Array::value('status_id_value', $this->_params);
- $respondentStatus = CRM_Utils_Array::value($statusId, self::$_surveyRespondentStatus);
+ $statusId = $this->_params['status_id_value'] ?? NULL;
+ $respondentStatus = self::$_surveyRespondentStatus[$statusId] ?? NULL;
- $surveyId = CRM_Utils_Array::value(0, $surveyIds);
+ $surveyId = $surveyIds[0] ?? NULL;
foreach ($rows as & $row) {
if (!empty($row['civicrm_activity_survey_id'])) {
$surveyId = $row['civicrm_activity_survey_id'];
}
$result = CRM_Utils_Array::value($surveyId, $resultSet, array());
- $resultLabel = CRM_Utils_Array::value('civicrm_activity_result', $row);
+ $resultLabel = $row['civicrm_activity_result'] ?? NULL;
if ($respondentStatus == 'Reserved') {
$row['civicrm_activity_result'] = implode(' | ', array_keys($result));
}
@@ -549,7 +549,7 @@ private function _formatSurveyResult(&$rows) {
* @param $rows
*/
private function _formatSurveyResponseData(&$rows) {
- $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
+ $surveyIds = $this->_params['survey_id_value'] ?? NULL;
if (CRM_Utils_System::isNull($surveyIds) ||
empty($this->_params['fields']['survey_response'])
) {
@@ -586,8 +586,8 @@ private function _formatSurveyResponseData(&$rows) {
}
//do check respondent status.
- $statusId = CRM_Utils_Array::value('status_id_value', $this->_params);
- $respondentStatus = CRM_Utils_Array::value($statusId, self::$_surveyRespondentStatus);
+ $statusId = $this->_params['status_id_value'] ?? NULL;
+ $respondentStatus = self::$_surveyRespondentStatus[$statusId] ?? NULL;
if (!$hasResponseData &&
($respondentStatus != 'Reserved')
@@ -655,7 +655,7 @@ private function _formatSurveyResponseData(&$rows) {
if ($respondentStatus == 'Reserved' &&
in_array($this->_outputMode, array('print', 'pdf'))
) {
- $optGrpId = CRM_Utils_Array::value('option_group_id', $responseFields[$name]);
+ $optGrpId = $responseFields[$name]['option_group_id'] ?? NULL;
$options = CRM_Utils_Array::value($optGrpId, $fieldValueMap, array());
$value = implode(' | ', array_keys($options));
}
@@ -671,7 +671,7 @@ private function _formatSurveyResponseData(&$rows) {
}
private function _addSurveyResponseColumns() {
- $surveyIds = CRM_Utils_Array::value('survey_id_value', $this->_params);
+ $surveyIds = $this->_params['survey_id_value'] ?? NULL;
if (CRM_Utils_System::isNull($surveyIds) ||
empty($this->_params['fields']['survey_response'])
) {
diff --git a/CRM/Report/Form/Case/Demographics.php b/CRM/Report/Form/Case/Demographics.php
index 8115604f0209..6c9f105f8596 100644
--- a/CRM/Report/Form/Case/Demographics.php
+++ b/CRM/Report/Form/Case/Demographics.php
@@ -250,7 +250,7 @@ public function select() {
}
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -308,18 +308,18 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if ($field['operatorType'] & CRM_Report_Form::OP_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, CRM_Utils_Type::T_DATE);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
// handle special case
if ($fieldName == 'case_id_filter') {
- $choice = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
+ $choice = $this->_params["{$fieldName}_value"] ?? NULL;
if ($choice == 1) {
$clause = "({$this->_aliases['civicrm_case']}.id Is Not Null)";
}
diff --git a/CRM/Report/Form/Case/Detail.php b/CRM/Report/Form/Case/Detail.php
index 64d8952e714a..95a91ff9b313 100644
--- a/CRM/Report/Form/Case/Detail.php
+++ b/CRM/Report/Form/Case/Detail.php
@@ -350,7 +350,7 @@ public function select() {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
}
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -417,15 +417,15 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($fieldName == 'case_type_id' &&
!empty($this->_params['case_type_id_value'])
) {
diff --git a/CRM/Report/Form/Case/Summary.php b/CRM/Report/Form/Case/Summary.php
index ab089194bb27..52fb291cc17d 100644
--- a/CRM/Report/Form/Case/Summary.php
+++ b/CRM/Report/Form/Case/Summary.php
@@ -209,7 +209,7 @@ public function select() {
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
}
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
diff --git a/CRM/Report/Form/Case/TimeSpent.php b/CRM/Report/Form/Case/TimeSpent.php
index 5e3d04bca839..117b342aa458 100644
--- a/CRM/Report/Form/Case/TimeSpent.php
+++ b/CRM/Report/Form/Case/TimeSpent.php
@@ -183,9 +183,9 @@ public function select() {
)
) {
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
if ($fieldName == 'activity_type_id') {
$this->has_activity_type = TRUE;
@@ -240,18 +240,18 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
// handle special case
if ($fieldName == 'case_id_filter') {
- $choice = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
+ $choice = $this->_params["{$fieldName}_value"] ?? NULL;
if ($choice == 1) {
$clause = "({$this->_aliases['civicrm_case_activity']}.id Is Not Null)";
}
diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php
index 80e033a0704c..5a2479b14b64 100644
--- a/CRM/Report/Form/Contact/CurrentEmployer.php
+++ b/CRM/Report/Form/Contact/CurrentEmployer.php
@@ -196,8 +196,8 @@ public function select() {
) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
@@ -239,14 +239,14 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE
) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php
index 56acf7e33478..c44891b94ca0 100644
--- a/CRM/Report/Form/Contact/Detail.php
+++ b/CRM/Report/Form/Contact/Detail.php
@@ -389,8 +389,8 @@ public function select() {
//isolate the select clause compoenent wise
if (in_array($table['alias'], $this->_component)) {
$select[$table['alias']][] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeadersComponent[$table['alias']]["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeadersComponent[$table['alias']]["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeadersComponent[$table['alias']]["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeadersComponent[$table['alias']]["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
elseif ($table['alias'] ==
$this->_aliases['civicrm_activity_target'] ||
@@ -413,12 +413,12 @@ public function select() {
$tableName = $table['alias'];
$select['activity_civireport'][] = "$tableName.display_name as {$tableName}_{$fieldName}, $addContactId ";
- $this->_columnHeadersComponent['activity_civireport']["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeadersComponent['activity_civireport']["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeadersComponent['activity_civireport']["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeadersComponent['activity_civireport']["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -606,14 +606,14 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE
) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
$clause = $this->whereClause($field,
$op,
CRM_Utils_Array::value("{$fieldName}_value", $this->_params),
diff --git a/CRM/Report/Form/Contact/Log.php b/CRM/Report/Form/Contact/Log.php
index e846ca577550..3fbec1121264 100644
--- a/CRM/Report/Form/Contact/Log.php
+++ b/CRM/Report/Form/Contact/Log.php
@@ -136,7 +136,7 @@ public function select() {
) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -181,14 +181,14 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('operatorType', $field) & CRM_Report_Form::OP_DATE
) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Contact/LoggingSummary.php b/CRM/Report/Form/Contact/LoggingSummary.php
index 751a00eb913a..c3ed3f542922 100644
--- a/CRM/Report/Form/Contact/LoggingSummary.php
+++ b/CRM/Report/Form/Contact/LoggingSummary.php
@@ -294,7 +294,7 @@ public function from() {
$detail = $this->_logTables[$entity];
$tableName = CRM_Utils_Array::value('table_name', $detail, $entity);
- $clause = CRM_Utils_Array::value('entity_table', $detail);
+ $clause = $detail['entity_table'] ?? NULL;
$clause = $clause ? "AND entity_log_civireport.entity_table = 'civicrm_contact'" : NULL;
$joinClause = "
@@ -302,7 +302,7 @@ public function from() {
ON (entity_log_civireport.{$detail['fk']} = modified_contact_civireport.id {$clause})";
if (!empty($detail['joins'])) {
- $clause = CRM_Utils_Array::value('entity_table', $detail);
+ $clause = $detail['entity_table'] ?? NULL;
$clause = $clause ? "AND fk_table.entity_table = 'civicrm_contact'" : NULL;
$joinClause = "
INNER JOIN `{$this->loggingDB}`.{$detail['joins']['table']} fk_table ON {$detail['joins']['join']}
diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php
index 4807844732a6..1b122fe7e2e6 100644
--- a/CRM/Report/Form/Contact/Relationship.php
+++ b/CRM/Report/Form/Contact/Relationship.php
@@ -372,8 +372,8 @@ public function select() {
$this->_phoneField_b = TRUE;
}
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
@@ -454,9 +454,9 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($fieldName == 'active_period_date') {
$clause = $this->activeClause($field['name'], $relative, $from, $to, $field['type']);
@@ -466,14 +466,14 @@ public function where() {
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
if (($tableName == 'civicrm_contact' ||
$tableName == 'civicrm_contact_b') &&
($fieldName == 'contact_type_a' ||
$fieldName == 'contact_type_b')
) {
- $cTypes = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
+ $cTypes = $this->_params["{$fieldName}_value"] ?? NULL;
$contactTypes = $contactSubTypes = [];
if (!empty($cTypes)) {
foreach ($cTypes as $ctype) {
@@ -630,7 +630,7 @@ public function groupBy() {
}
public function beginPostProcessCommon() {
- $originalRelationshipTypeIdValue = CRM_Utils_Array::value('relationship_type_id_value', $this->_params);
+ $originalRelationshipTypeIdValue = $this->_params['relationship_type_id_value'] ?? NULL;
if ($originalRelationshipTypeIdValue) {
$relationshipTypes = [];
$direction = [];
diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php
index 24dc5ba2b067..1da37dac5680 100644
--- a/CRM/Report/Form/Contribute/Bookkeeping.php
+++ b/CRM/Report/Form/Contribute/Bookkeeping.php
@@ -450,7 +450,7 @@ public function select() {
break;
}
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
}
}
@@ -533,14 +533,14 @@ public function where() {
END";
}
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
@@ -674,7 +674,7 @@ public function alterDisplay(&$rows) {
}
if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
- $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = CRM_Utils_Array::value($row['civicrm_financial_trxn_card_type_id'], $creditCardTypes);
+ $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $creditCardTypes[$row['civicrm_financial_trxn_card_type_id']] ?? NULL;
$entryFound = TRUE;
}
diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php
index 294c40ecdd50..2fb0325d9846 100644
--- a/CRM/Report/Form/Contribute/Detail.php
+++ b/CRM/Report/Form/Contribute/Detail.php
@@ -697,7 +697,7 @@ public function alterDisplay(&$rows) {
$entryFound = TRUE;
}
if (!empty($row['civicrm_batch_batch_id'])) {
- $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Utils_Array::value($row['civicrm_batch_batch_id'], $batches);
+ $rows[$rowNum]['civicrm_batch_batch_id'] = $batches[$row['civicrm_batch_batch_id']] ?? NULL;
$entryFound = TRUE;
}
if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php
index 99983fcf3f07..ecb52f68ece8 100644
--- a/CRM/Report/Form/Contribute/History.php
+++ b/CRM/Report/Form/Contribute/History.php
@@ -326,7 +326,7 @@ public function select() {
) {
if ($tableName == 'civicrm_relationship') {
$this->_relationshipColumns["{$tableName}_{$fieldName}"] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
continue;
}
@@ -355,7 +355,7 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
if (!empty($field['no_display'])) {
@@ -403,14 +403,14 @@ public function where() {
}
elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Contribute/HouseholdSummary.php b/CRM/Report/Form/Contribute/HouseholdSummary.php
index 1789bcd33a12..8e0c9a242206 100644
--- a/CRM/Report/Form/Contribute/HouseholdSummary.php
+++ b/CRM/Report/Form/Contribute/HouseholdSummary.php
@@ -214,8 +214,8 @@ public function select() {
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
}
}
@@ -250,13 +250,13 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
if ($fieldName == 'relationship_type_id') {
$clause = "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" . $this->relationshipId;
diff --git a/CRM/Report/Form/Contribute/OrganizationSummary.php b/CRM/Report/Form/Contribute/OrganizationSummary.php
index 80880b15d710..78d7d6282327 100644
--- a/CRM/Report/Form/Contribute/OrganizationSummary.php
+++ b/CRM/Report/Form/Contribute/OrganizationSummary.php
@@ -219,8 +219,8 @@ public function select() {
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
}
}
@@ -257,14 +257,14 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
if ($fieldName == 'relationship_type_id') {
$clause = "{$this->_aliases['civicrm_relationship']}.relationship_type_id=" . $this->relationshipId;
diff --git a/CRM/Report/Form/Contribute/PCP.php b/CRM/Report/Form/Contribute/PCP.php
index 8b0ec5f5e59a..3b640a8d6dc8 100644
--- a/CRM/Report/Form/Contribute/PCP.php
+++ b/CRM/Report/Form/Contribute/PCP.php
@@ -250,13 +250,13 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
diff --git a/CRM/Report/Form/Contribute/Recur.php b/CRM/Report/Form/Contribute/Recur.php
index bf79da024452..4dac3ad8f942 100644
--- a/CRM/Report/Form/Contribute/Recur.php
+++ b/CRM/Report/Form/Contribute/Recur.php
@@ -293,9 +293,9 @@ public function where() {
if (!empty($this->_params['calculated_end_date_' . $suffix])) {
// The calculated date field is in use - spring into action
// Gather values
- $relative = CRM_Utils_Array::value("calculated_end_date_relative", $this->_params);
- $from = CRM_Utils_Array::value("calculated_end_date_from", $this->_params);
- $to = CRM_Utils_Array::value("calculated_end_date_to", $this->_params);
+ $relative = $this->_params["calculated_end_date_relative"] ?? NULL;
+ $from = $this->_params["calculated_end_date_from"] ?? NULL;
+ $to = $this->_params["calculated_end_date_to"] ?? NULL;
$end_date_db_alias = $this->_columns['civicrm_contribution_recur']['filters']['end_date']['dbAlias'];
$end_date_type = $this->_columns['civicrm_contribution_recur']['filters']['end_date']['type'];
$start_date_type = $this->_columns['civicrm_contribution_recur']['filters']['start_date']['type'];
diff --git a/CRM/Report/Form/Contribute/RecurSummary.php b/CRM/Report/Form/Contribute/RecurSummary.php
index 677890e14439..9599ddb5d143 100644
--- a/CRM/Report/Form/Contribute/RecurSummary.php
+++ b/CRM/Report/Form/Contribute/RecurSummary.php
@@ -166,8 +166,8 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
@@ -222,9 +222,9 @@ public function alterDisplay(&$rows) {
$entryFound = FALSE;
- $startDateFrom = CRM_Utils_Array::value("start_date_to", $this->_params);
- $startDateTo = CRM_Utils_Array::value("start_date_from", $this->_params);
- $startDateRelative = CRM_Utils_Array::value("start_date_relative", $this->_params);
+ $startDateFrom = $this->_params["start_date_to"] ?? NULL;
+ $startDateTo = $this->_params["start_date_from"] ?? NULL;
+ $startDateRelative = $this->_params["start_date_relative"] ?? NULL;
$startedDateSql = $this->dateClause('start_date', $startDateRelative, $startDateFrom, $startDateTo);
$startedDateSql = $startedDateSql ? $startedDateSql : " ( 1 ) ";
@@ -236,7 +236,7 @@ public function alterDisplay(&$rows) {
foreach ($rows as $rowNum => $row) {
- $paymentInstrumentId = CRM_Utils_Array::value('civicrm_contribution_recur_payment_instrument_id', $row);
+ $paymentInstrumentId = $row['civicrm_contribution_recur_payment_instrument_id'] ?? NULL;
$rows[$rowNum]['civicrm_contribution_recur_start_date'] = 0;
$rows[$rowNum]['civicrm_contribution_recur_cancel_date'] = 0;
diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php
index 4062c0090e9c..7b66f28d6d32 100644
--- a/CRM/Report/Form/Contribute/Repeat.php
+++ b/CRM/Report/Form/Contribute/Repeat.php
@@ -263,17 +263,17 @@ public function select() {
$select[] = $field['clause'];
// FIXME: dirty hack for setting columnHeaders
- $this->_columnHeaders["{$field['alias']}_{$field['name']}_sum"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$field['alias']}_{$field['name']}_sum"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$field['alias']}_{$field['name']}_sum"]['title'] = $field['title'];
- $this->_columnHeaders["{$field['alias']}_{$field['name']}_count"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$field['alias']}_{$field['name']}_count"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$field['alias']}_{$field['name']}_count"]['title'] = $field['title'];
continue;
}
// only include statistics columns if set
$select[] = "{$field['dbAlias']} as {$field['alias']}_{$field['name']}";
- $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$field['alias']}_{$field['name']}"]['title'] = $field['title'] ?? NULL;
if (!empty($field['no_display'])) {
$this->_columnHeaders["{$field['alias']}_{$field['name']}"]['no_display'] = TRUE;
}
@@ -386,14 +386,14 @@ public function whereContribution($replaceAliasWith = 'contribution1') {
foreach ($this->_columns['civicrm_contribution']['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['dbAlias'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
@@ -450,7 +450,7 @@ public function where() {
) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php
index b50437689089..c4c2d371486d 100644
--- a/CRM/Report/Form/Contribute/SoftCredit.php
+++ b/CRM/Report/Form/Contribute/SoftCredit.php
@@ -369,7 +369,7 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php
index 5a4de704343b..35df8417748e 100644
--- a/CRM/Report/Form/Contribute/Summary.php
+++ b/CRM/Report/Form/Contribute/Summary.php
@@ -423,8 +423,8 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
@@ -580,7 +580,7 @@ public function storeWhereHavingClauseArray() {
public function statistics(&$rows) {
$statistics = parent::statistics($rows);
- $softCredit = CRM_Utils_Array::value('soft_amount', $this->_params['fields']);
+ $softCredit = $this->_params['fields']['soft_amount'] ?? NULL;
$onlySoftCredit = $softCredit && !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
if (!isset($this->_groupByArray['civicrm_contribution_currency'])) {
$this->_groupByArray['civicrm_contribution_currency'] = 'currency';
diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php
index 37c1385be4dd..83b6f673f822 100644
--- a/CRM/Report/Form/Contribute/Sybunt.php
+++ b/CRM/Report/Form/Contribute/Sybunt.php
@@ -294,7 +294,7 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
if (!empty($field['no_display'])) {
@@ -341,16 +341,16 @@ public function where() {
}
elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE
) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
@@ -510,13 +510,13 @@ public function buildChart(&$rows) {
foreach ($rows as $key => $row) {
$display["upto_{$upto}"]
- = CRM_Utils_Array::value("upto_{$upto}", $display) + CRM_Utils_Array::value("civicrm_upto_{$upto}", $row);
+ = CRM_Utils_Array::value("upto_{$upto}", $display) + $row["civicrm_upto_{$upto}"] ?? NULL;
$display[$previous_year]
- = CRM_Utils_Array::value($previous_year, $display) + CRM_Utils_Array::value($previous_year, $row);
+ = CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year] ?? NULL;
$display[$previous_two_year]
- = CRM_Utils_Array::value($previous_two_year, $display) + CRM_Utils_Array::value($previous_two_year, $row);
+ = CRM_Utils_Array::value($previous_two_year, $display) + $row[$previous_two_year] ?? NULL;
$display[$previous_three_year]
- = CRM_Utils_Array::value($previous_three_year, $display) + CRM_Utils_Array::value($previous_three_year, $row);
+ = CRM_Utils_Array::value($previous_three_year, $display) + $row[$previous_three_year] ?? NULL;
}
$graphRows['value'] = $display;
diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php
index a73a3e42e88b..a3329a928f00 100644
--- a/CRM/Report/Form/Contribute/TopDonor.php
+++ b/CRM/Report/Form/Contribute/TopDonor.php
@@ -204,8 +204,8 @@ public function __construct() {
public static function formRule($fields, $files, $self) {
$errors = [];
- $op = CRM_Utils_Array::value('total_range_op', $fields);
- $val = CRM_Utils_Array::value('total_range_value', $fields);
+ $op = $fields['total_range_op'] ?? NULL;
+ $val = $fields['total_range_value'] ?? NULL;
if (!in_array($op, [
'eq',
@@ -244,16 +244,16 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
@@ -266,7 +266,7 @@ public function where() {
if (!empty($clause)) {
if ($fieldName == 'total_range') {
- $value = CRM_Utils_Array::value("total_range_value", $this->_params);
+ $value = $this->_params["total_range_value"] ?? NULL;
$this->_outerCluase = " WHERE (( @rows := @rows + 1) <= {$value}) ";
$this->_groupLimit = " LIMIT {$value}";
}
diff --git a/CRM/Report/Form/Event/IncomeCountSummary.php b/CRM/Report/Form/Event/IncomeCountSummary.php
index a6b154d5cbb8..fea8a0de4b16 100644
--- a/CRM/Report/Form/Event/IncomeCountSummary.php
+++ b/CRM/Report/Form/Event/IncomeCountSummary.php
@@ -179,7 +179,7 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -210,16 +210,16 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Event/ParticipantListCount.php b/CRM/Report/Form/Event/ParticipantListCount.php
index f1ea17adec16..31a0f70ab16e 100644
--- a/CRM/Report/Form/Event/ParticipantListCount.php
+++ b/CRM/Report/Form/Event/ParticipantListCount.php
@@ -406,7 +406,7 @@ public function select() {
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php
index 9b4c6f719dab..50175c9aaf5b 100644
--- a/CRM/Report/Form/Event/ParticipantListing.php
+++ b/CRM/Report/Form/Event/ParticipantListing.php
@@ -446,16 +446,16 @@ public function select() {
}
$alias = "{$tableName}_{$fieldName}";
$select[] = "{$field['dbAlias']} as $alias";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
$this->_selectAliases[] = $alias;
}
}
}
}
//add blank column at the end
- $blankcols = CRM_Utils_Array::value('blank_column_end', $this->_params);
+ $blankcols = $this->_params['blank_column_end'] ?? NULL;
if ($blankcols) {
for ($i = 1; $i <= $blankcols; $i++) {
$select[] = " '' as blankColumnEnd_{$i}";
@@ -537,19 +537,19 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($fieldName == 'rid') {
- $value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
+ $value = $this->_params["{$fieldName}_value"] ?? NULL;
if (!empty($value)) {
$operator = '';
if ($op == 'notin') {
@@ -704,9 +704,9 @@ public function alterDisplay(&$rows) {
}
// Convert display name to link
- $displayName = CRM_Utils_Array::value('civicrm_contact_sort_name_linked', $row);
- $cid = CRM_Utils_Array::value('civicrm_contact_id', $row);
- $id = CRM_Utils_Array::value('civicrm_participant_participant_record', $row);
+ $displayName = $row['civicrm_contact_sort_name_linked'] ?? NULL;
+ $cid = $row['civicrm_contact_id'] ?? NULL;
+ $id = $row['civicrm_participant_participant_record'] ?? NULL;
if ($displayName && $cid && $id) {
$url = CRM_Report_Utils_Report::getNextUrl('contact/detail',
diff --git a/CRM/Report/Form/Event/Summary.php b/CRM/Report/Form/Event/Summary.php
index f2dd872e5180..11af2ed73a54 100644
--- a/CRM/Report/Form/Event/Summary.php
+++ b/CRM/Report/Form/Event/Summary.php
@@ -125,16 +125,16 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
@@ -239,8 +239,8 @@ public function buildColumnHeaders() {
!empty($this->_params['fields'][$fieldName])
) {
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
@@ -328,7 +328,7 @@ public function buildChart(&$rows) {
$countEvent = NULL;
if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $value) {
- $graphRows['totalAmount'][] = $graphRows['value'][] = CRM_Utils_Array::value('totalAmount', $rows[$key]);
+ $graphRows['totalAmount'][] = $graphRows['value'][] = $rows[$key]['totalAmount'] ?? NULL;
$graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
$rows[$key]['civicrm_event_id'] . ") ";
}
diff --git a/CRM/Report/Form/Grant/Statistics.php b/CRM/Report/Form/Grant/Statistics.php
index da70f8df1f15..c78048f9f60b 100644
--- a/CRM/Report/Form/Grant/Statistics.php
+++ b/CRM/Report/Form/Grant/Statistics.php
@@ -200,8 +200,8 @@ public function select() {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
}
}
@@ -239,16 +239,16 @@ public function where() {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if (($fieldName == 'grant_report_received') &&
(CRM_Utils_Array::value("{$fieldName}_value", $this->_params) ===
0)
@@ -380,7 +380,7 @@ public function alterDisplay(&$rows) {
}
if (!empty($values['civicrm_grant_grant_type_id'])) {
- $grantType = CRM_Utils_Array::value($values['civicrm_grant_grant_type_id'], $grantTypes);
+ $grantType = $grantTypes[$values['civicrm_grant_grant_type_id']] ?? NULL;
$grantStatistics['civicrm_grant_grant_type_id']['title'] = ts('By Grant Type');
self::getStatistics($grantStatistics['civicrm_grant_grant_type_id'], $grantType, $values,
$awardedGrants, $awardedGrantsAmount
@@ -388,7 +388,7 @@ public function alterDisplay(&$rows) {
}
if (array_key_exists('civicrm_worldregion_name', $values)) {
- $region = CRM_Utils_Array::value('civicrm_worldregion_name', $values);
+ $region = $values['civicrm_worldregion_name'] ?? NULL;
$region = ($region) ? $region : 'Unassigned';
$grantStatistics['civicrm_worldregion_name']['title'] = ts('By Region');
self::getStatistics($grantStatistics['civicrm_worldregion_name'], $region, $values,
@@ -397,7 +397,7 @@ public function alterDisplay(&$rows) {
}
if (array_key_exists('civicrm_address_country_id', $values)) {
- $country = CRM_Utils_Array::value($values['civicrm_address_country_id'], $countries);
+ $country = $countries[$values['civicrm_address_country_id']] ?? NULL;
$country = ($country) ? $country : 'Unassigned';
$grantStatistics['civicrm_address_country_id']['title'] = ts('By Country');
self::getStatistics($grantStatistics['civicrm_address_country_id'], $country, $values,
@@ -414,7 +414,7 @@ public function alterDisplay(&$rows) {
}
if (array_key_exists('civicrm_contact_gender_id', $values)) {
- $genderLabel = CRM_Utils_Array::value($values['civicrm_contact_gender_id'], $gender);
+ $genderLabel = $gender[$values['civicrm_contact_gender_id']] ?? NULL;
$genderLabel = ($genderLabel) ? $genderLabel : 'Unassigned';
$grantStatistics['civicrm_contact_gender_id']['title'] = ts('By Gender');
self::getStatistics($grantStatistics['civicrm_contact_gender_id'], $genderLabel, $values,
@@ -424,7 +424,7 @@ public function alterDisplay(&$rows) {
foreach ($values as $customField => $customValue) {
if (strstr($customField, 'civicrm_value_')) {
- $customFieldTitle = CRM_Utils_Array::value('title', $this->_columnHeaders[$customField]);
+ $customFieldTitle = $this->_columnHeaders[$customField]['title'] ?? NULL;
$customGroupTitle = explode('_custom', strstr($customField, 'civicrm_value_'));
$customGroupTitle = $this->_columns[$customGroupTitle[0]]['group_title'];
$grantStatistics[$customGroupTitle]['title'] = ts('By %1', [1 => $customGroupTitle]);
diff --git a/CRM/Report/Form/Instance.php b/CRM/Report/Form/Instance.php
index 4ca1b81ad2e1..8aa9d4674ca3 100644
--- a/CRM/Report/Form/Instance.php
+++ b/CRM/Report/Form/Instance.php
@@ -239,7 +239,7 @@ public static function setDefaultValues(&$form, &$defaults) {
if ($instanceID) {
// this is already retrieved via Form.php
- $defaults['description'] = CRM_Utils_Array::value('description', $defaults);
+ $defaults['description'] = $defaults['description'] ?? NULL;
if (!empty($defaults['header'])) {
$defaults['report_header'] = $defaults['header'];
}
@@ -258,7 +258,7 @@ public static function setDefaultValues(&$form, &$defaults) {
$params = ['id' => $defaults['navigation_id']];
CRM_Core_BAO_Navigation::retrieve($params, $navigationDefaults);
$defaults['is_navigation'] = 1;
- $defaults['parent_id'] = CRM_Utils_Array::value('parent_id', $navigationDefaults);
+ $defaults['parent_id'] = $navigationDefaults['parent_id'] ?? NULL;
if (!empty($navigationDefaults['is_active'])) {
$form->assign('is_navigation', TRUE);
}
diff --git a/CRM/Report/Form/Mailing/Bounce.php b/CRM/Report/Form/Mailing/Bounce.php
index 5a16a9d90f16..cfb798c179f9 100644
--- a/CRM/Report/Form/Mailing/Bounce.php
+++ b/CRM/Report/Form/Mailing/Bounce.php
@@ -271,9 +271,9 @@ public function select() {
}
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
@@ -337,14 +337,14 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($this->_aliases[$tableName] . '.' . $field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
diff --git a/CRM/Report/Form/Mailing/Clicks.php b/CRM/Report/Form/Mailing/Clicks.php
index e8cf3258f583..bc96f7f9e35a 100644
--- a/CRM/Report/Form/Mailing/Clicks.php
+++ b/CRM/Report/Form/Mailing/Clicks.php
@@ -229,9 +229,9 @@ public function select() {
}
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
diff --git a/CRM/Report/Form/Mailing/Detail.php b/CRM/Report/Form/Mailing/Detail.php
index 55b97ffef4d8..5eab237061e2 100644
--- a/CRM/Report/Form/Mailing/Detail.php
+++ b/CRM/Report/Form/Mailing/Detail.php
@@ -279,17 +279,17 @@ public function select() {
'reply_id',
])) {
$select[] = "IF({$field['dbAlias']} IS NULL, 'No', 'Yes') as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
unset($this->_columns[$tableName]['fields'][$fieldName]);
$columns[$tableName][$fieldName] = $field;
}
elseif ($fieldName == 'delivery_id') {
$select[] = "IF(mailing_event_bounce_civireport.id IS NOT NULL, 'Bounced', IF(mailing_event_delivered_civireport.id IS NOT NULL, 'Successful', 'Unknown')) as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
unset($this->_columns[$tableName]['fields'][$fieldName]);
$columns[$tableName][$fieldName] = $field;
}
diff --git a/CRM/Report/Form/Mailing/Opened.php b/CRM/Report/Form/Mailing/Opened.php
index 3bbba7bcd846..5db163b7eb4c 100644
--- a/CRM/Report/Form/Mailing/Opened.php
+++ b/CRM/Report/Form/Mailing/Opened.php
@@ -218,9 +218,9 @@ public function select() {
}
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = CRM_Utils_Array::value('no_display', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['no_display'] = $field['no_display'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
diff --git a/CRM/Report/Form/Mailing/Summary.php b/CRM/Report/Form/Mailing/Summary.php
index 7d9fdc621511..4289f9020bea 100644
--- a/CRM/Report/Form/Mailing/Summary.php
+++ b/CRM/Report/Form/Mailing/Summary.php
@@ -356,7 +356,7 @@ public function select() {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
}
}
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -410,14 +410,14 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($this->_aliases[$tableName] . '.' . $field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
if ($fieldName == 'relationship_type_id') {
diff --git a/CRM/Report/Form/Member/ContributionDetail.php b/CRM/Report/Form/Member/ContributionDetail.php
index 6b4ae72b4f0b..ff38b8cdf61f 100644
--- a/CRM/Report/Form/Member/ContributionDetail.php
+++ b/CRM/Report/Form/Member/ContributionDetail.php
@@ -406,15 +406,15 @@ public function select() {
elseif ($fieldName == 'first_donation_date' ||
$fieldName == 'first_donation_amount'
) {
- $baseField = CRM_Utils_Array::value('base_field', $field);
+ $baseField = $field['base_field'] ?? NULL;
$select[] = "{$this->_aliases['civicrm_contribution']}.{$baseField} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
}
}
@@ -640,8 +640,8 @@ public function alterDisplay(&$rows) {
if (array_key_exists('fields', $table)) {
foreach ($table['fields'] as $fieldName => $field) {
if (!empty($field['csv_display']) && !empty($field['no_display'])) {
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
}
}
}
@@ -716,7 +716,7 @@ public function alterDisplay(&$rows) {
}
if (!empty($row['civicrm_batch_batch_id'])) {
- $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Utils_Array::value($row['civicrm_batch_batch_id'], $batches);
+ $rows[$rowNum]['civicrm_batch_batch_id'] = $batches[$row['civicrm_batch_batch_id']] ?? NULL;
$entryFound = TRUE;
}
diff --git a/CRM/Report/Form/Member/Lapse.php b/CRM/Report/Form/Member/Lapse.php
index 5f1c54e5c6ef..acdb9a16b0a9 100644
--- a/CRM/Report/Form/Member/Lapse.php
+++ b/CRM/Report/Form/Member/Lapse.php
@@ -173,7 +173,7 @@ public function select() {
!empty($this->_params['fields'][$fieldName])
) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
}
}
@@ -223,16 +223,16 @@ public function where() {
$clause = NULL;
if ($field['operatorType'] & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Member/Summary.php b/CRM/Report/Form/Member/Summary.php
index 936b68493c70..1bd21077b7ca 100644
--- a/CRM/Report/Form/Member/Summary.php
+++ b/CRM/Report/Form/Member/Summary.php
@@ -272,12 +272,12 @@ public function select() {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
}
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['operatorType'] = CRM_Utils_Array::value('operatorType', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['operatorType'] = $field['operatorType'] ?? NULL;
}
else {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
$this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['operatorType'] = CRM_Utils_Array::value('operatorType', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['operatorType'] = $field['operatorType'] ?? NULL;
}
}
}
@@ -446,8 +446,8 @@ public function buildChart(&$rows) {
$graphRows = [];
$count = 0;
$membershipTypeValues = CRM_Member_PseudoConstant::membershipType();
- $isMembershipType = CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']);
- $isJoiningDate = CRM_Utils_Array::value('join_date', $this->_params['group_bys']);
+ $isMembershipType = $this->_params['group_bys']['membership_type_id'] ?? NULL;
+ $isJoiningDate = $this->_params['group_bys']['join_date'] ?? NULL;
if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $row) {
if (!($row['civicrm_membership_join_date_subtotal'] &&
@@ -457,8 +457,8 @@ public function buildChart(&$rows) {
continue;
}
if ($isMembershipType) {
- $join_date = CRM_Utils_Array::value('civicrm_membership_join_date_start', $row);
- $displayInterval = CRM_Utils_Array::value('civicrm_membership_join_date_interval', $row);
+ $join_date = $row['civicrm_membership_join_date_start'] ?? NULL;
+ $displayInterval = $row['civicrm_membership_join_date_interval'] ?? NULL;
if ($join_date) {
list($year, $month) = explode('-', $join_date);
}
@@ -493,8 +493,8 @@ public function buildChart(&$rows) {
$display[$membershipType] = $row['civicrm_contribution_total_amount_sum'];
}
else {
- $graphRows['receive_date'][] = CRM_Utils_Array::value('civicrm_membership_join_date_start', $row);
- $graphRows[$this->_interval][] = CRM_Utils_Array::value('civicrm_membership_join_date_interval', $row);
+ $graphRows['receive_date'][] = $row['civicrm_membership_join_date_start'] ?? NULL;
+ $graphRows[$this->_interval][] = $row['civicrm_membership_join_date_interval'] ?? NULL;
$graphRows['value'][] = $row['civicrm_contribution_total_amount_sum'];
$count++;
}
diff --git a/CRM/Report/Form/Membership/Summary.php b/CRM/Report/Form/Membership/Summary.php
index 25a5417448af..ddceca33870d 100644
--- a/CRM/Report/Form/Membership/Summary.php
+++ b/CRM/Report/Form/Membership/Summary.php
@@ -182,16 +182,16 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if ($field['type'] & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Pledge/Detail.php b/CRM/Report/Form/Pledge/Detail.php
index cb015c8123fc..d8e66c78e5ea 100644
--- a/CRM/Report/Form/Pledge/Detail.php
+++ b/CRM/Report/Form/Pledge/Detail.php
@@ -331,16 +331,16 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Pledge/Pbnp.php b/CRM/Report/Form/Pledge/Pbnp.php
index 66eb610655a5..e9b97fbf07be 100644
--- a/CRM/Report/Form/Pledge/Pbnp.php
+++ b/CRM/Report/Form/Pledge/Pbnp.php
@@ -181,8 +181,8 @@ public function select() {
!empty($this->_params['fields'][$fieldName])
) {
$select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
- $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type'] ?? NULL;
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'] ?? NULL;
}
}
}
diff --git a/CRM/Report/Form/Pledge/Summary.php b/CRM/Report/Form/Pledge/Summary.php
index 10ae20e55011..0adf1b860cd3 100644
--- a/CRM/Report/Form/Pledge/Summary.php
+++ b/CRM/Report/Form/Pledge/Summary.php
@@ -309,16 +309,16 @@ public function where() {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
if ($relative || $from || $to) {
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Form/Walklist/Walklist.php b/CRM/Report/Form/Walklist/Walklist.php
index 152799859e6a..14b40773b37a 100644
--- a/CRM/Report/Form/Walklist/Walklist.php
+++ b/CRM/Report/Form/Walklist/Walklist.php
@@ -119,14 +119,14 @@ public function where() {
$clause = NULL;
if ($field['type'] & CRM_Utils_Type::T_DATE) {
- $relative = CRM_Utils_Array::value("{$fieldName}_relative", $this->_params);
- $from = CRM_Utils_Array::value("{$fieldName}_from", $this->_params);
- $to = CRM_Utils_Array::value("{$fieldName}_to", $this->_params);
+ $relative = $this->_params["{$fieldName}_relative"] ?? NULL;
+ $from = $this->_params["{$fieldName}_from"] ?? NULL;
+ $to = $this->_params["{$fieldName}_to"] ?? NULL;
$clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
}
else {
- $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
+ $op = $this->_params["{$fieldName}_op"] ?? NULL;
if ($op) {
$clause = $this->whereClause($field,
$op,
diff --git a/CRM/Report/Utils/Get.php b/CRM/Report/Utils/Get.php
index e0498dbab766..59cfbf7c4e95 100644
--- a/CRM/Report/Utils/Get.php
+++ b/CRM/Report/Utils/Get.php
@@ -25,7 +25,7 @@ class CRM_Report_Utils_Get {
* @return mixed|null
*/
public static function getTypedValue($name, $type) {
- $value = CRM_Utils_Array::value($name, $_GET);
+ $value = $_GET[$name] ?? NULL;
if ($value === NULL) {
return NULL;
}
@@ -188,7 +188,7 @@ public static function intParam($fieldName, &$field, &$defaults) {
* @param $defaults
*/
public static function processChart(&$defaults) {
- $chartType = CRM_Utils_Array::value("charts", $_GET);
+ $chartType = $_GET["charts"] ?? NULL;
if (in_array($chartType, [
'barChart',
'pieChart',
diff --git a/CRM/Report/Utils/Report.php b/CRM/Report/Utils/Report.php
index 329bf0f83575..1cc6cc7d1879 100644
--- a/CRM/Report/Utils/Report.php
+++ b/CRM/Report/Utils/Report.php
@@ -188,9 +188,9 @@ public static function mailReport($fileContent, $instanceID = NULL, $outputMode
$params['from'] = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>';
//$domainEmailName;
$params['toName'] = "";
- $params['toEmail'] = CRM_Utils_Array::value('email_to', $instanceInfo);
- $params['cc'] = CRM_Utils_Array::value('email_cc', $instanceInfo);
- $params['subject'] = CRM_Utils_Array::value('email_subject', $instanceInfo);
+ $params['toEmail'] = $instanceInfo['email_to'] ?? NULL;
+ $params['cc'] = $instanceInfo['email_cc'] ?? NULL;
+ $params['subject'] = $instanceInfo['email_subject'] ?? NULL;
if (empty($instanceInfo['attachments'])) {
$instanceInfo['attachments'] = [];
}
@@ -251,7 +251,7 @@ public static function makeCsv(&$form, &$rows) {
$value = NULL;
foreach ($rows as $row) {
foreach ($columnHeaders as $k => $v) {
- $value = CRM_Utils_Array::value($v, $row);
+ $value = $row[$v] ?? NULL;
if (isset($value)) {
// Remove HTML, unencode entities, and escape quotation marks.
$value = str_replace('"', '""', html_entity_decode(strip_tags($value)));
@@ -395,7 +395,7 @@ public static function isInstanceGroupRoleAllowed($instanceId) {
* @return array
*/
public static function processReport($params) {
- $instanceId = CRM_Utils_Array::value('instanceId', $params);
+ $instanceId = $params['instanceId'] ?? NULL;
// hack for now, CRM-8358
$_REQUEST['instanceId'] = $instanceId;
@@ -502,7 +502,7 @@ public static function getPreviewCriteriaQueryParams($defaults = [], $params = [
// (e.g., values for 'nll' and 'nnll' ops are blank),
// so store them temporarily and examine below.
$string_values[$basename] = $field_value;
- $op_values[$basename] = CRM_Utils_Array::value("{$basename}_op", $params);
+ $op_values[$basename] = $params["{$basename}_op"] ?? NULL;
}
elseif ($suffix == '_op') {
// These filters can have an effect even without a value
diff --git a/CRM/SMS/BAO/Provider.php b/CRM/SMS/BAO/Provider.php
index 4e046f743390..b2c2e45e2267 100644
--- a/CRM/SMS/BAO/Provider.php
+++ b/CRM/SMS/BAO/Provider.php
@@ -78,7 +78,7 @@ public static function getProviders($selectArr = NULL, $filter = NULL, $getActiv
* @return array saved values
*/
public static function create(&$params) {
- $id = CRM_Utils_Array::value('id', $params);
+ $id = $params['id'] ?? NULL;
if ($id) {
CRM_Utils_Hook::pre('edit', 'SmsProvider', $id, $params);
diff --git a/CRM/SMS/Form/Group.php b/CRM/SMS/Form/Group.php
index 7aae52fb1b97..4a53b78852a8 100644
--- a/CRM/SMS/Form/Group.php
+++ b/CRM/SMS/Form/Group.php
@@ -71,7 +71,7 @@ public function setDefaultValues() {
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
- $defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
+ $defaults['excludeGroups'] = $mailingGroups['civicrm_group']['Exclude'] ?? NULL;
$defaults['includeMailings'] = CRM_Utils_Array::value('Include', CRM_Utils_Array::value('civicrm_mailing', $mailingGroups));
$defaults['excludeMailings'] = CRM_Utils_Array::value('Exclude', CRM_Utils_Array::value('civicrm_mailing', $mailingGroups));
diff --git a/CRM/SMS/Form/Upload.php b/CRM/SMS/Form/Upload.php
index 922b2812257e..e9d2efb31143 100644
--- a/CRM/SMS/Form/Upload.php
+++ b/CRM/SMS/Form/Upload.php
@@ -227,7 +227,7 @@ public function postProcess() {
$params['msg_template_id'] = $msgTemplate->id;
}
else {
- $params['msg_template_id'] = CRM_Utils_Array::value('SMStemplate', $formValues);
+ $params['msg_template_id'] = $formValues['SMStemplate'] ?? NULL;
}
$this->set('template', $params['msg_template_id']);
}
@@ -299,7 +299,7 @@ public static function formRule($params, $files, $self) {
}
else {
if (!empty($params['text_message'])) {
- $messageCheck = CRM_Utils_Array::value('text_message', $params);
+ $messageCheck = $params['text_message'] ?? NULL;
if ($messageCheck && (strlen($messageCheck) > CRM_SMS_Provider::MAX_SMS_CHAR)) {
$errors['text_message'] = ts("You can configure the SMS message body up to %1 characters", [1 => CRM_SMS_Provider::MAX_SMS_CHAR]);
}
diff --git a/CRM/SMS/Provider.php b/CRM/SMS/Provider.php
index 18976e184865..387092876d51 100644
--- a/CRM/SMS/Provider.php
+++ b/CRM/SMS/Provider.php
@@ -35,9 +35,9 @@ abstract class CRM_SMS_Provider {
* @throws CRM_Core_Exception
*/
public static function &singleton($providerParams = array(), $force = FALSE) {
- $mailingID = CRM_Utils_Array::value('mailing_id', $providerParams);
- $providerID = CRM_Utils_Array::value('provider_id', $providerParams);
- $providerName = CRM_Utils_Array::value('provider', $providerParams);
+ $mailingID = $providerParams['mailing_id'] ?? NULL;
+ $providerID = $providerParams['provider_id'] ?? NULL;
+ $providerName = $providerParams['provider'] ?? NULL;
if (!$providerID && $mailingID) {
$providerID = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingID, 'sms_provider_id', 'id');
@@ -141,7 +141,7 @@ public function createActivity($apiMsgID, $message, $headers = array(), $jobID =
}
if (!$sourceContactID) {
- $sourceContactID = CRM_Utils_Array::value('Contact', $headers);
+ $sourceContactID = $headers['Contact'] ?? NULL;
}
if (!$sourceContactID) {
return FALSE;
diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php
index 5e7247049cb1..4476ef73038f 100644
--- a/CRM/UF/Form/Field.php
+++ b/CRM/UF/Form/Field.php
@@ -140,7 +140,7 @@ public function preProcess() {
continue;
}
$this->_selectFields[$name] = $field['title'];
- $this->_hasLocationTypes[$name] = CRM_Utils_Array::value('hasLocationType', $field);
+ $this->_hasLocationTypes[$name] = $field['hasLocationType'] ?? NULL;
}
// lets add group, tag and current_employer to this list
@@ -187,7 +187,7 @@ public function buildQuickForm() {
CRM_Core_BAO_UFField::retrieve($params, $defaults);
// set it to null if so (avoids crappy E_NOTICE errors below
- $defaults['location_type_id'] = CRM_Utils_Array::value('location_type_id', $defaults);
+ $defaults['location_type_id'] = $defaults['location_type_id'] ?? NULL;
//CRM-20861 - Include custom fields defined for address to set its default location type to 0.
$specialFields = array_merge(CRM_Core_BAO_UFGroup::getLocationFields(), $addressCustomFields);
@@ -245,8 +245,8 @@ public function buildQuickForm() {
else {
$this->_mapperFields[$key][$key1] = $value1['title'];
}
- $hasLocationTypes[$key][$key1] = CRM_Utils_Array::value('hasLocationType', $value1);
- $hasWebsiteTypes[$key][$key1] = CRM_Utils_Array::value('hasWebsiteType', $value1);
+ $hasLocationTypes[$key][$key1] = $value1['hasLocationType'] ?? NULL;
+ $hasWebsiteTypes[$key][$key1] = $value1['hasWebsiteType'] ?? NULL;
// hide the 'is searchable' field for 'File' custom data
if (isset($value1['data_type']) &&
isset($value1['html_type']) &&
@@ -700,7 +700,7 @@ public static function formRulePrimaryCheck($fields, $profileFieldName, $groupFi
if (array_key_exists($profileFieldName, $checkPrimary)) {
$whereCheck = $checkPrimary[$profileFieldName];
}
- $potentialLocationType = CRM_Utils_Array::value(2, $fields['field_name']);
+ $potentialLocationType = $fields['field_name'][2] ?? NULL;
if ($whereCheck && $potentialLocationType == 0) {
$primaryOfSameTypeFound = '';
@@ -761,7 +761,7 @@ public static function formRule($fields, $files, $self) {
}
$isCustomField = FALSE;
- $profileFieldName = CRM_Utils_Array::value(1, $fields['field_name']);
+ $profileFieldName = $fields['field_name'][1] ?? NULL;
if ($profileFieldName) {
//get custom field id
$customFieldId = explode('_', $profileFieldName);
diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php
index 90f7528c4973..4aba5aea9745 100644
--- a/CRM/UF/Form/Group.php
+++ b/CRM/UF/Form/Group.php
@@ -264,8 +264,8 @@ public function setDefaultValues() {
$params = ['id' => $this->_id];
CRM_Core_BAO_UFGroup::retrieve($params, $defaults);
- $defaults['group'] = CRM_Utils_Array::value('limit_listings_group_id', $defaults);
- $defaults['add_contact_to_group'] = CRM_Utils_Array::value('add_to_group_id', $defaults);
+ $defaults['group'] = $defaults['limit_listings_group_id'] ?? NULL;
+ $defaults['add_contact_to_group'] = $defaults['add_to_group_id'] ?? NULL;
//get the uf join records for current uf group
$ufJoinRecords = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_id);
foreach ($ufJoinRecords as $key => $value) {
diff --git a/CRM/UF/Page/Group.php b/CRM/UF/Page/Group.php
index 6e74e8d79b65..764e5355e832 100644
--- a/CRM/UF/Page/Group.php
+++ b/CRM/UF/Page/Group.php
@@ -464,7 +464,7 @@ public static function extractGroupTypes($groupType) {
foreach ($valueParts as $val) {
if (CRM_Utils_Rule::integer($val)) {
- $groupTypeValues[$val] = CRM_Utils_Array::value($val, $valueLabels);
+ $groupTypeValues[$val] = $valueLabels[$val] ?? NULL;
}
}
diff --git a/CRM/Upgrade/Incremental/php/FourFive.php b/CRM/Upgrade/Incremental/php/FourFive.php
index 4925552c20ea..d905ea536b06 100644
--- a/CRM/Upgrade/Incremental/php/FourFive.php
+++ b/CRM/Upgrade/Incremental/php/FourFive.php
@@ -331,7 +331,7 @@ public static function updateSavedSearch(CRM_Queue_TaskContext $ctx) {
if (count($data_value) == 0 && $op == 'or') {
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($fieldID);
foreach ($customOption as $option) {
- $data_value[] = CRM_Utils_Array::value('value', $option);
+ $data_value[] = $option['value'] ?? NULL;
}
}
diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php
index 6e1eb1c61bde..90163f011747 100644
--- a/CRM/Utils/Address.php
+++ b/CRM/Utils/Address.php
@@ -59,7 +59,7 @@ public static function format(
$formatted = $format;
- $fullPostalCode = CRM_Utils_Array::value('postal_code', $fields);
+ $fullPostalCode = $fields['postal_code'] ?? NULL;
if (!empty($fields['postal_code_suffix'])) {
$fullPostalCode .= "-$fields[postal_code_suffix]";
}
@@ -194,7 +194,7 @@ public static function format(
// also sub all token fields
if ($tokenFields) {
foreach ($tokenFields as $token) {
- $replacements["{$token}"] = CRM_Utils_Array::value("{$token}", $fields);
+ $replacements["{$token}"] = $fields["{$token}"] ?? NULL;
}
}
@@ -320,7 +320,7 @@ public static function getFormattedBillingAddressFieldsFromParameters($params, $
$addressFields = [];
foreach ($addressParts as $name => $field) {
- $value = CRM_Utils_Array::value($field, $params);
+ $value = $params[$field] ?? NULL;
$alternateName = 'billing_' . $name . '_id-' . $billingLocationTypeID;
$alternate2 = 'billing_' . $name . '-' . $billingLocationTypeID;
if (isset($params[$alternate2]) && !isset($params[$alternateName])) {
diff --git a/CRM/Utils/Array.php b/CRM/Utils/Array.php
index 1a3d8a002072..a35d321a31eb 100644
--- a/CRM/Utils/Array.php
+++ b/CRM/Utils/Array.php
@@ -915,7 +915,7 @@ public static function filterColumns($matrix, $columns) {
foreach ($matrix as $pos => $oldRow) {
$newRow = [];
foreach ($columns as $column) {
- $newRow[$column] = CRM_Utils_Array::value($column, $oldRow);
+ $newRow[$column] = $oldRow[$column] ?? NULL;
}
$newRows[$pos] = $newRow;
}
diff --git a/CRM/Utils/Chart.php b/CRM/Utils/Chart.php
index c8745fa0a5f0..fa20158b9605 100644
--- a/CRM/Utils/Chart.php
+++ b/CRM/Utils/Chart.php
@@ -211,8 +211,8 @@ public static function chart($rows, $chart, $interval) {
}
// legend
- $chartData['xname'] = CRM_Utils_Array::value('xname', $rows);
- $chartData['yname'] = CRM_Utils_Array::value('yname', $rows);
+ $chartData['xname'] = $rows['xname'] ?? NULL;
+ $chartData['yname'] = $rows['yname'] ?? NULL;
// carry some chart params if pass.
foreach ([
diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php
index df20858d5b7e..6f597a4401c4 100644
--- a/CRM/Utils/Date.php
+++ b/CRM/Utils/Date.php
@@ -950,12 +950,12 @@ public static function calculateAge($birthDate) {
*/
public static function intervalAdd($unit, $interval, $date, $dontCareTime = FALSE) {
if (is_array($date)) {
- $hour = CRM_Utils_Array::value('H', $date);
- $minute = CRM_Utils_Array::value('i', $date);
- $second = CRM_Utils_Array::value('s', $date);
- $month = CRM_Utils_Array::value('M', $date);
- $day = CRM_Utils_Array::value('d', $date);
- $year = CRM_Utils_Array::value('Y', $date);
+ $hour = $date['H'] ?? NULL;
+ $minute = $date['i'] ?? NULL;
+ $second = $date['s'] ?? NULL;
+ $month = $date['M'] ?? NULL;
+ $day = $date['d'] ?? NULL;
+ $year = $date['Y'] ?? NULL;
}
else {
extract(date_parse($date));
diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php
index 8e62e1e17b21..b6da19bb686f 100644
--- a/CRM/Utils/DeprecatedUtils.php
+++ b/CRM/Utils/DeprecatedUtils.php
@@ -157,8 +157,8 @@ function _civicrm_api3_deprecated_activity_formatted_param(&$params, &$values, $
elseif ($type == 'Select' || $type == 'Radio') {
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
foreach ($customOption as $customFldID => $customValue) {
- $val = CRM_Utils_Array::value('value', $customValue);
- $label = CRM_Utils_Array::value('label', $customValue);
+ $val = $customValue['value'] ?? NULL;
+ $label = $customValue['label'] ?? NULL;
$label = strtolower($label);
$value = strtolower(trim($value));
if (($value == $label) || ($value == strtolower($val))) {
@@ -434,7 +434,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) {
// mark an entry in fields array since we want the value of custom field to be copied
$fields['Address'][$key] = NULL;
- $htmlType = CRM_Utils_Array::value('html_type', $customFields[$customFieldID]);
+ $htmlType = $customFields[$customFieldID]['html_type'] ?? NULL;
switch ($htmlType) {
case 'CheckBox':
case 'Multi-Select':
@@ -548,8 +548,8 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) {
*