From 6b409353d19be6058cbd47fcc5916c8564aed6ff Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 8 Mar 2020 15:35:34 -0400 Subject: [PATCH] Use ?? operator instead of CRM_Utils_Array::value() in array assignments --- CRM/Activity/BAO/Activity.php | 12 +-- CRM/Activity/BAO/ActivityType.php | 4 +- CRM/Admin/Form/ParticipantStatusType.php | 10 +- CRM/Admin/Page/MessageTemplates.php | 2 +- CRM/Batch/Form/Entry.php | 4 +- CRM/Campaign/Form/Task/Reserve.php | 2 +- CRM/Case/BAO/Case.php | 2 +- CRM/Case/Form/Activity/ChangeCaseStatus.php | 4 +- CRM/Case/Form/Activity/ChangeCaseType.php | 8 +- CRM/Case/Form/Activity/OpenCase.php | 4 +- CRM/Case/Form/CaseView.php | 4 +- CRM/Case/XMLProcessor/Process.php | 10 +- CRM/Contact/BAO/Contact.php | 22 ++--- CRM/Contact/BAO/Group.php | 4 +- CRM/Contact/Form/Contact.php | 2 +- CRM/Contact/Import/Parser.php | 6 +- CRM/Contact/Selector.php | 2 +- CRM/Contribute/BAO/Contribution.php | 10 +- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Contribute/BAO/ContributionPage.php | 20 ++-- CRM/Contribute/BAO/ContributionRecur.php | 2 +- CRM/Contribute/Form/AdditionalInfo.php | 6 +- CRM/Contribute/Form/Contribution.php | 14 +-- CRM/Contribute/Form/Contribution/Confirm.php | 16 ++-- CRM/Contribute/Form/Contribution/ThankYou.php | 4 +- .../Form/ContributionPage/Amount.php | 2 +- CRM/Contribute/Form/Task/Invoice.php | 22 ++--- CRM/Contribute/Form/Task/PDFLetterCommon.php | 4 +- CRM/Contribute/Import/Parser/Contribution.php | 6 +- CRM/Core/BAO/Block.php | 2 +- CRM/Core/BAO/CustomGroup.php | 8 +- CRM/Core/BAO/CustomValueTable.php | 2 +- CRM/Core/BAO/Dashboard.php | 4 +- CRM/Core/BAO/FinancialTrxn.php | 10 +- CRM/Core/BAO/Tag.php | 8 +- CRM/Core/BAO/UFGroup.php | 2 +- CRM/Core/Menu.php | 6 +- CRM/Core/Payment/PayPalImpl.php | 2 +- CRM/Core/PseudoConstant.php | 4 +- CRM/Custom/Import/Parser/Api.php | 10 +- CRM/Event/BAO/Event.php | 10 +- CRM/Event/BAO/Participant.php | 8 +- CRM/Event/Cart/BAO/MerParticipant.php | 2 +- CRM/Event/Cart/Form/Checkout/Payment.php | 8 +- CRM/Event/Form/Participant.php | 22 ++--- CRM/Event/Form/Registration.php | 14 +-- CRM/Event/Form/Registration/Confirm.php | 8 +- CRM/Event/Form/SelfSvcTransfer.php | 4 +- CRM/Event/Page/EventInfo.php | 4 +- CRM/Financial/BAO/Payment.php | 6 +- CRM/Financial/Form/PaymentEdit.php | 2 +- CRM/Friend/BAO/Friend.php | 2 +- CRM/Logging/Differ.php | 4 +- CRM/Member/BAO/Membership.php | 2 +- CRM/Member/Form/Membership.php | 12 +-- CRM/Member/Form/MembershipRenewal.php | 2 +- CRM/Member/Form/MembershipView.php | 2 +- CRM/Pledge/BAO/Pledge.php | 10 +- CRM/Pledge/BAO/PledgeBlock.php | 4 +- CRM/Price/BAO/LineItem.php | 16 ++-- CRM/Price/BAO/PriceField.php | 2 +- CRM/Report/Form.php | 2 +- CRM/Report/Form/Case/Detail.php | 2 +- CRM/Utils/Address.php | 94 +++++++++---------- CRM/Utils/Check/Component/Env.php | 4 +- CRM/Utils/Date.php | 4 +- CRM/Utils/DeprecatedUtils.php | 6 +- CRM/Utils/Pager.php | 8 +- CRM/Utils/Recent.php | 8 +- CRM/Utils/Sort.php | 2 +- api/v3/Activity.php | 6 +- api/v3/Case.php | 20 ++-- api/v3/Contact.php | 6 +- api/v3/Domain.php | 2 +- api/v3/Profile.php | 6 +- api/v3/System.php | 2 +- .../sequentialcreditnotes.civix.php | 2 +- tests/phpunit/CRM/Contact/BAO/ContactTest.php | 74 +++++++-------- tests/phpunit/CRM/Core/BAO/LocationTest.php | 10 +- .../org.civicrm.angularex/angularex.civix.php | 2 +- 80 files changed, 336 insertions(+), 336 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 3687df1b17..de44793550 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -749,11 +749,11 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { foreach ($result as $id => $activity) { $activities[$id] = [ 'activity_id' => $activity['id'], - 'activity_date_time' => CRM_Utils_Array::value('activity_date_time', $activity), - 'subject' => CRM_Utils_Array::value('subject', $activity), + 'activity_date_time' => $activity['activity_date_time'] ?? NULL, + 'subject' => $activity['subject'] ?? NULL, 'assignee_contact_name' => CRM_Utils_Array::value('assignee_contact_sort_name', $activity, []), - 'source_contact_id' => CRM_Utils_Array::value('source_contact_id', $activity), - 'source_contact_name' => CRM_Utils_Array::value('source_contact_sort_name', $activity), + 'source_contact_id' => $activity['source_contact_id'] ?? NULL, + 'source_contact_name' => $activity['source_contact_sort_name'] ?? NULL, ]; $activities[$id]['activity_type_name'] = CRM_Core_PseudoConstant::getName('CRM_Activity_BAO_Activity', 'activity_type_id', $activity['activity_type_id']); $activities[$id]['activity_type'] = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $activity['activity_type_id']); @@ -2458,8 +2458,8 @@ INNER JOIN civicrm_option_group grp ON (grp.id = option_group_id AND grp.name = 'is_deleted' => 0, 'is_current_revision' => 1, 'is_test' => 0, - 'contact_id' => CRM_Utils_Array::value('contact_id', $params), - 'activity_date_time' => CRM_Utils_Array::value('activity_date_time', $params), + 'contact_id' => $params['contact_id'] ?? NULL, + 'activity_date_time' => $params['activity_date_time'] ?? NULL, 'check_permissions' => 1, 'options' => [ 'offset' => CRM_Utils_Array::value('offset', $params, 0), diff --git a/CRM/Activity/BAO/ActivityType.php b/CRM/Activity/BAO/ActivityType.php index c971500511..3a27f8275a 100644 --- a/CRM/Activity/BAO/ActivityType.php +++ b/CRM/Activity/BAO/ActivityType.php @@ -74,8 +74,8 @@ class CRM_Activity_BAO_ActivityType { $displayLabels = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $activity_type_id, 'label'); $this->_activityType = [ - 'machineName' => CRM_Utils_Array::value($activity_type_id, $machineNames), - 'displayLabel' => CRM_Utils_Array::value($activity_type_id, $displayLabels), + 'machineName' => $machineNames[$activity_type_id] ?? NULL, + 'displayLabel' => $displayLabels[$activity_type_id] ?? NULL, 'id' => $activity_type_id, ]; } diff --git a/CRM/Admin/Form/ParticipantStatusType.php b/CRM/Admin/Form/ParticipantStatusType.php index c193d251d8..168aa180c5 100644 --- a/CRM/Admin/Form/ParticipantStatusType.php +++ b/CRM/Admin/Form/ParticipantStatusType.php @@ -86,13 +86,13 @@ class CRM_Admin_Form_ParticipantStatusType extends CRM_Admin_Form { $formValues = $this->controller->exportValues($this->_name); $params = [ - 'name' => CRM_Utils_Array::value('name', $formValues), - 'label' => CRM_Utils_Array::value('label', $formValues), - 'class' => CRM_Utils_Array::value('class', $formValues), + 'name' => $formValues['name'] ?? NULL, + 'label' => $formValues['label'] ?? NULL, + 'class' => $formValues['class'] ?? NULL, 'is_active' => CRM_Utils_Array::value('is_active', $formValues, FALSE), 'is_counted' => CRM_Utils_Array::value('is_counted', $formValues, FALSE), - 'weight' => CRM_Utils_Array::value('weight', $formValues), - 'visibility_id' => CRM_Utils_Array::value('visibility_id', $formValues), + 'weight' => $formValues['weight'] ?? NULL, + 'visibility_id' => $formValues['visibility_id'] ?? NULL, ]; // make sure a malicious POST does not change these on reserved statuses diff --git a/CRM/Admin/Page/MessageTemplates.php b/CRM/Admin/Page/MessageTemplates.php index 03b2a1ed47..4eb05bb687 100644 --- a/CRM/Admin/Page/MessageTemplates.php +++ b/CRM/Admin/Page/MessageTemplates.php @@ -154,7 +154,7 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic { $values['action'] = CRM_Core_Action::formLink($links, $action, [ 'id' => $object->id, - 'orig_id' => CRM_Utils_Array::value($object->id, $this->_revertible), + 'orig_id' => $this->_revertible[$object->id] ?? NULL, ], ts('more'), FALSE, diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 96d10fd4d6..a62c649b32 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -789,8 +789,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } $formDates = [ - 'end_date' => CRM_Utils_Array::value('membership_end_date', $value), - 'start_date' => CRM_Utils_Array::value('membership_start_date', $value), + 'end_date' => $value['membership_end_date'] ?? NULL, + 'start_date' => $value['membership_start_date'] ?? NULL, ]; $membershipSource = CRM_Utils_Array::value('source', $value); list($membership) = CRM_Member_BAO_Membership::processMembership( diff --git a/CRM/Campaign/Form/Task/Reserve.php b/CRM/Campaign/Form/Task/Reserve.php index b6a39ddb78..aebc1692c4 100644 --- a/CRM/Campaign/Form/Task/Reserve.php +++ b/CRM/Campaign/Form/Task/Reserve.php @@ -237,7 +237,7 @@ class CRM_Campaign_Form_Task_Reserve extends CRM_Campaign_Form_Task { 'activity_date_time' => date('YmdHis'), 'status_id' => $statusHeld, 'skipRecentView' => 1, - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $this->_surveyDetails), + 'campaign_id' => $this->_surveyDetails['campaign_id'] ?? NULL, ]; $activity = CRM_Activity_BAO_Activity::create($activityParams); if ($activity->id) { diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index bda424a9ef..1af50d3a03 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1306,7 +1306,7 @@ HERESQL; [ 'groupName' => 'msg_tpl_workflow_case', 'valueName' => 'case_activity', - 'contactId' => CRM_Utils_Array::value('contact_id', $info), + 'contactId' => $info['contact_id'] ?? NULL, 'tplParams' => $tplParams, 'from' => $receiptFrom, 'toName' => $displayName, diff --git a/CRM/Case/Form/Activity/ChangeCaseStatus.php b/CRM/Case/Form/Activity/ChangeCaseStatus.php index 56ad8f362a..9c985a2257 100644 --- a/CRM/Case/Form/Activity/ChangeCaseStatus.php +++ b/CRM/Case/Form/Activity/ChangeCaseStatus.php @@ -194,8 +194,8 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { foreach ($form->_oldCaseStatus as $statuskey => $statusval) { if ($activity->subject == 'null') { $activity->subject = ts('Case status changed from %1 to %2', [ - 1 => CRM_Utils_Array::value($statusval, $form->_caseStatus), - 2 => CRM_Utils_Array::value($params['case_status_id'], $form->_caseStatus), + 1 => $form->_caseStatus[$statusval] ?? NULL, + 2 => $form->_caseStatus[$params['case_status_id']] ?? NULL, ]); $activity->save(); } diff --git a/CRM/Case/Form/Activity/ChangeCaseType.php b/CRM/Case/Form/Activity/ChangeCaseType.php index fe6ba63475..bf85169449 100644 --- a/CRM/Case/Form/Activity/ChangeCaseType.php +++ b/CRM/Case/Form/Activity/ChangeCaseType.php @@ -145,8 +145,8 @@ class CRM_Case_Form_Activity_ChangeCaseType { if ($activity->subject == 'null') { $activity->subject = ts('Case type changed from %1 to %2', [ - 1 => CRM_Utils_Array::value($form->_defaults['case_type_id'], $allCaseTypes), - 2 => CRM_Utils_Array::value($params['case_type_id'], $allCaseTypes), + 1 => $allCaseTypes[$form->_defaults['case_type_id']] ?? NULL, + 2 => $allCaseTypes[$params['case_type_id']] ?? NULL, ] ); $activity->save(); @@ -160,9 +160,9 @@ class CRM_Case_Form_Activity_ChangeCaseType { 'creatorID' => $form->_currentUserId, 'standardTimeline' => 1, 'activityTypeName' => 'Change Case Type', - 'activity_date_time' => CRM_Utils_Array::value('reset_date_time', $params), + 'activity_date_time' => $params['reset_date_time'] ?? NULL, 'caseID' => $caseId, - 'resetTimeline' => CRM_Utils_Array::value('is_reset_timeline', $params), + 'resetTimeline' => $params['is_reset_timeline'] ?? NULL, ]; $xmlProcessor->run($caseType, $xmlProcessorParams); diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index 36157a3aaa..ae9405cc1e 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -303,10 +303,10 @@ class CRM_Case_Form_Activity_OpenCase { 'subject' => $params['activity_subject'], 'location' => $params['location'], 'activity_date_time' => $params['start_date'], - 'duration' => CRM_Utils_Array::value('duration', $params), + 'duration' => $params['duration'] ?? NULL, 'medium_id' => $params['medium_id'], 'details' => $params['activity_details'], - 'relationship_end_date' => CRM_Utils_Array::value('end_date', $params), + 'relationship_end_date' => $params['end_date'] ?? NULL, ]; if (array_key_exists('custom', $params) && is_array($params['custom'])) { diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index d3dae3609d..89283b9913 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -81,8 +81,8 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { $this->_caseDetails = [ 'case_type' => $caseType, - 'case_status' => CRM_Utils_Array::value($values['case_status_id'], $statuses), - 'case_subject' => CRM_Utils_Array::value('subject', $values), + 'case_status' => $statuses[$values['case_status_id']] ?? NULL, + 'case_subject' => $values['subject'] ?? NULL, 'case_start_date' => $values['case_start_date'], ]; $this->_caseType = $caseTypeName; diff --git a/CRM/Case/XMLProcessor/Process.php b/CRM/Case/XMLProcessor/Process.php index ddb717b037..066f01f026 100644 --- a/CRM/Case/XMLProcessor/Process.php +++ b/CRM/Case/XMLProcessor/Process.php @@ -219,7 +219,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { 'is_active' => 1, 'case_id' => $params['caseID'], 'start_date' => date("Ymd"), - 'end_date' => CRM_Utils_Array::value('relationship_end_date', $params), + 'end_date' => $params['relationship_end_date'] ?? NULL, ]; if (substr($relationshipType, -4) == '_b_a') { @@ -451,10 +451,10 @@ AND a.is_deleted = 0 'subject' => !empty($params['subject']) ? $params['subject'] : $activityTypeName, 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', $statusName), 'target_contact_id' => $client, - 'medium_id' => CRM_Utils_Array::value('medium_id', $params), - 'location' => CRM_Utils_Array::value('location', $params), - 'details' => CRM_Utils_Array::value('details', $params), - 'duration' => CRM_Utils_Array::value('duration', $params), + 'medium_id' => $params['medium_id'] ?? NULL, + 'location' => $params['location'] ?? NULL, + 'details' => $params['details'] ?? NULL, + 'duration' => $params['duration'] ?? NULL, 'weight' => $orderVal, ]; } diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index f068d0a033..6bbd3f8521 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -360,7 +360,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { 'entity_id' => $contact->id, 'entity_table' => 'civicrm_contact', 'note' => $note['note'], - 'subject' => CRM_Utils_Array::value('subject', $note), + 'subject' => $note['subject'] ?? NULL, 'contact_id' => $contactId, ]; CRM_Core_BAO_Note::add($noteParams); @@ -377,7 +377,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact { 'entity_id' => $contact->id, 'entity_table' => 'civicrm_contact', 'note' => $params['note'], - 'subject' => CRM_Utils_Array::value('subject', $params), + 'subject' => $params['subject'] ?? NULL, 'contact_id' => $contactId, ]; CRM_Core_BAO_Note::add($noteParams); @@ -754,7 +754,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); //lookup value of email/postal greeting, addressee, CRM-4575 foreach (self::$_greetingTypes as $greeting) { $filterCondition = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $defaults), + 'contact_type' => $defaults['contact_type'] ?? NULL, 'greeting_type' => $greeting, ]; CRM_Utils_Array::lookupValue($defaults, $greeting, @@ -3195,7 +3195,7 @@ AND civicrm_openid.is_primary = 1"; $contextMenu['primaryActions'][$key] = [ 'title' => $values['title'], 'ref' => $values['ref'], - 'class' => CRM_Utils_Array::value('class', $values), + 'class' => $values['class'] ?? NULL, 'key' => $values['key'], ]; continue; @@ -3205,9 +3205,9 @@ AND civicrm_openid.is_primary = 1"; $contextMenu['moreActions'][$values['weight']] = [ 'title' => $values['title'], 'ref' => $values['ref'], - 'href' => CRM_Utils_Array::value('href', $values), - 'tab' => CRM_Utils_Array::value('tab', $values), - 'class' => CRM_Utils_Array::value('class', $values), + 'href' => $values['href'] ?? NULL, + 'tab' => $values['tab'] ?? NULL, + 'class' => $values['class'] ?? NULL, 'key' => $values['key'], ]; } @@ -3222,10 +3222,10 @@ AND civicrm_openid.is_primary = 1"; $contextMenu['otherActions'][$value['weight']] = [ 'title' => $value['title'], 'ref' => $value['ref'], - 'href' => CRM_Utils_Array::value('href', $value), - 'tab' => CRM_Utils_Array::value('tab', $value), - 'class' => CRM_Utils_Array::value('class', $value), - 'icon' => CRM_Utils_Array::value('icon', $value), + 'href' => $value['href'] ?? NULL, + 'tab' => $value['tab'] ?? NULL, + 'class' => $value['class'] ?? NULL, + 'icon' => $value['icon'] ?? NULL, 'key' => $value['key'], ]; } diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 57692ca8df..0dd64ed62e 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -695,8 +695,8 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { 'title' => "Hidden Smart Group {$ssId}", 'is_active' => CRM_Utils_Array::value('is_active', $params, 1), 'is_hidden' => CRM_Utils_Array::value('is_hidden', $params, 1), - 'group_type' => CRM_Utils_Array::value('group_type', $params), - 'visibility' => CRM_Utils_Array::value('visibility', $params), + 'group_type' => $params['group_type'] ?? NULL, + 'visibility' => $params['visibility'] ?? NULL, 'saved_search_id' => $ssId, ]; diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index 314f3ea878..a36de18d67 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -910,7 +910,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { if (isset($params['contact_id'])) { // process membership status for deceased contact $deceasedParams = [ - 'contact_id' => CRM_Utils_Array::value('contact_id', $params), + 'contact_id' => $params['contact_id'] ?? NULL, 'is_deceased' => CRM_Utils_Array::value('is_deceased', $params, FALSE), 'deceased_date' => CRM_Utils_Array::value('deceased_date', $params, NULL), ]; diff --git a/CRM/Contact/Import/Parser.php b/CRM/Contact/Import/Parser.php index a4b11fb439..d3791a5973 100644 --- a/CRM/Contact/Import/Parser.php +++ b/CRM/Contact/Import/Parser.php @@ -1026,7 +1026,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { if (isset($values['email_greeting'])) { if (!empty($params['email_greeting_id'])) { $emailGreetingFilter = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $params), + 'contact_type' => $params['contact_type'] ?? NULL, 'greeting_type' => 'email_greeting', ]; $emailGreetings = CRM_Core_PseudoConstant::greeting($emailGreetingFilter); @@ -1042,7 +1042,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { if (isset($values['postal_greeting'])) { if (!empty($params['postal_greeting_id'])) { $postalGreetingFilter = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $params), + 'contact_type' => $params['contact_type'] ?? NULL, 'greeting_type' => 'postal_greeting', ]; $postalGreetings = CRM_Core_PseudoConstant::greeting($postalGreetingFilter); @@ -1057,7 +1057,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { if (isset($values['addressee'])) { if (!empty($params['addressee_id'])) { $addresseeFilter = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $params), + 'contact_type' => $params['contact_type'] ?? NULL, 'greeting_type' => 'addressee', ]; $addressee = CRM_Core_PseudoConstant::addressee($addresseeFilter); diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index f9ddd8e954..c0faf5b463 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -308,7 +308,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se 'qs' => $qs, 'title' => $value['title'], 'ref' => $value['ref'], - 'class' => CRM_Utils_Array::value('class', $value), + 'class' => $value['class'] ?? NULL, ]; } } diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index dc2e3eb871..6a39286c51 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1235,7 +1235,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { 'contact_id' => $params['prevContribution']->contact_id, 'currency' => $currency, 'amount' => self::getFinancialItemAmountFromParams($inputParams, $context, $lineItemDetails, $isARefund, $previousLineItemTotal), - 'description' => CRM_Utils_Array::value('description', $prevFinancialItem), + 'description' => $prevFinancialItem['description'] ?? NULL, 'status_id' => $prevFinancialItem['status_id'], 'financial_account_id' => $financialAccount, 'entity_table' => 'civicrm_line_item', @@ -3645,7 +3645,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac 'to_financial_account_id' => $params['to_financial_account_id'], 'trxn_date' => !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis'), 'total_amount' => $totalAmount, - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $params), + 'fee_amount' => $params['fee_amount'] ?? NULL, 'net_amount' => CRM_Utils_Array::value('net_amount', $params, $totalAmount), 'currency' => $params['contribution']->currency, 'trxn_id' => $params['contribution']->trxn_id, @@ -3654,9 +3654,9 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac // this should really default to completed (after discussion). 'status_id' => $statusId, 'payment_instrument_id' => CRM_Utils_Array::value('payment_instrument_id', $params, $params['contribution']->payment_instrument_id), - 'check_number' => CRM_Utils_Array::value('check_number', $params), - 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $params), - 'card_type_id' => CRM_Utils_Array::value('card_type_id', $params), + 'check_number' => $params['check_number'] ?? NULL, + 'pan_truncation' => $params['pan_truncation'] ?? NULL, + 'card_type_id' => $params['card_type_id'] ?? NULL, ]; if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback' || $contributionStatus == 'Cancelled') { $trxnParams['trxn_date'] = !empty($params['contribution']->cancel_date) ? $params['contribution']->cancel_date : date('YmdHis'); diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 3be25fe15f..7b3edc1076 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -85,7 +85,7 @@ class CRM_Contribute_BAO_Contribution_Utils { if ($isPaymentTransaction) { $contributionParams = [ - 'id' => CRM_Utils_Array::value('contribution_id', $paymentParams), + 'id' => $paymentParams['contribution_id'] ?? NULL, 'contact_id' => $contactID, 'is_test' => $isTest, 'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)), diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 43cbb90546..8d575ad2d2 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -346,18 +346,18 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio // All of these will be assigned to the template, replacing any that might be assigned elsewhere. $tplParams = [ 'email' => $email, - 'receiptFromEmail' => CRM_Utils_Array::value('receipt_from_email', $values), + 'receiptFromEmail' => $values['receipt_from_email'] ?? NULL, 'contactID' => $contactID, 'displayName' => $displayName, - 'contributionID' => CRM_Utils_Array::value('contribution_id', $values), - 'contributionOtherID' => CRM_Utils_Array::value('contribution_other_id', $values), + 'contributionID' => $values['contribution_id'] ?? NULL, + 'contributionOtherID' => $values['contribution_other_id'] ?? NULL, // CRM-5095 - 'lineItem' => CRM_Utils_Array::value('lineItem', $values), + 'lineItem' => $values['lineItem'] ?? NULL, // CRM-5095 - 'priceSetID' => CRM_Utils_Array::value('priceSetID', $values), + 'priceSetID' => $values['priceSetID'] ?? NULL, 'title' => $title, - 'isShare' => CRM_Utils_Array::value('is_share', $values), - 'thankyou_title' => CRM_Utils_Array::value('thankyou_title', $values), + 'isShare' => $values['is_share'] ?? NULL, + 'thankyou_title' => $values['thankyou_title'] ?? NULL, 'customPre' => $values['customPre'], 'customPre_grouptitle' => $values['customPre_grouptitle'], 'customPost' => $values['customPost'], @@ -367,9 +367,9 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio 'amount' => $values['amount'], 'is_pay_later' => $values['is_pay_later'], 'receipt_date' => !$values['receipt_date'] ? NULL : date('YmdHis', strtotime($values['receipt_date'])), - 'pay_later_receipt' => CRM_Utils_Array::value('pay_later_receipt', $values), - 'honor_block_is_active' => CRM_Utils_Array::value('honor_block_is_active', $values), - 'contributionStatus' => CRM_Utils_Array::value('contribution_status', $values), + 'pay_later_receipt' => $values['pay_later_receipt'] ?? NULL, + 'honor_block_is_active' => $values['honor_block_is_active'] ?? NULL, + 'contributionStatus' => $values['contribution_status'] ?? NULL, ]; if ($contributionTypeId = CRM_Utils_Array::value('financial_type_id', $values)) { diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 2b385a3414..3a9a441c5d 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -250,7 +250,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi } $activityParams = [ 'subject' => !empty($params['membership_id']) ? ts('Auto-renewal membership cancelled') : ts('Recurring contribution cancelled'), - 'details' => CRM_Utils_Array::value('processor_message', $params), + 'details' => $params['processor_message'] ?? NULL, ]; $cancelledId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_ContributionRecur', 'contribution_status_id', 'Cancelled'); diff --git a/CRM/Contribute/Form/AdditionalInfo.php b/CRM/Contribute/Form/AdditionalInfo.php index ad9f2b6ed1..706a3508b4 100644 --- a/CRM/Contribute/Form/AdditionalInfo.php +++ b/CRM/Contribute/Form/AdditionalInfo.php @@ -207,9 +207,9 @@ class CRM_Contribute_Form_AdditionalInfo { //CRM-11106 if ($premiumID == NULL || $isDeleted) { $premiumParams = [ - 'cost' => CRM_Utils_Array::value('cost', $productDetails), - 'currency' => CRM_Utils_Array::value('currency', $productDetails), - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $productDetails), + 'cost' => $productDetails['cost'] ?? NULL, + 'currency' => $productDetails['currency'] ?? NULL, + 'financial_type_id' => $productDetails['financial_type_id'] ?? NULL, 'contributionId' => $contributionID, ]; if ($isDeleted) { diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index a47c573dd1..027c1690cb 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1126,14 +1126,14 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->set('is_deductible', TRUE); } $contributionParams = [ - 'id' => CRM_Utils_Array::value('contribution_id', $this->_params), + 'id' => $this->_params['contribution_id'] ?? NULL, 'contact_id' => $contactID, 'line_item' => $lineItem, 'is_test' => $isTest, - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $this->_params), - 'contribution_page_id' => CRM_Utils_Array::value('contribution_page_id', $this->_params), + 'campaign_id' => $this->_params['campaign_id'] ?? NULL, + 'contribution_page_id' => $this->_params['contribution_page_id'] ?? NULL, 'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)), - 'thankyou_date' => CRM_Utils_Array::value('thankyou_date', $this->_params), + 'thankyou_date' => $this->_params['thankyou_date'] ?? NULL, ]; $contributionParams['payment_instrument_id'] = $this->_paymentProcessor['payment_instrument_id']; @@ -1178,9 +1178,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP 'trxn_id' => $result['trxn_id'], 'payment_processor_id' => $this->_paymentProcessor['id'], 'is_transactional' => FALSE, - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), - 'card_type_id' => CRM_Utils_Array::value('card_type_id', $paymentParams), - 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $paymentParams), + 'fee_amount' => $result['fee_amount'] ?? NULL, + 'card_type_id' => $paymentParams['card_type_id'] ?? NULL, + 'pan_truncation' => $paymentParams['pan_truncation'] ?? NULL, 'is_email_receipt' => FALSE, ]); // This has now been set to 1 in the DB - declare it here also diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 013e1b8b94..1f3737da9c 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -156,8 +156,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $contributionParams = [ 'financial_type_id' => $financialTypeID, 'receive_date' => (CRM_Utils_Array::value('receive_date', $params)) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'), - 'tax_amount' => CRM_Utils_Array::value('tax_amount', $params), - 'amount_level' => CRM_Utils_Array::value('amount_level', $params), + 'tax_amount' => $params['tax_amount'] ?? NULL, + 'amount_level' => $params['amount_level'] ?? NULL, 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), @@ -806,7 +806,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $params = [ 'product_id' => $premiumParams['selectProduct'], 'contribution_id' => $contribution->id, - 'product_option' => CRM_Utils_Array::value('options_' . $premiumParams['selectProduct'], $premiumParams), + 'product_option' => $premiumParams['options_' . $premiumParams['selectProduct']] ?? NULL, 'quantity' => 1, 'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'), 'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'), @@ -2478,13 +2478,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr try { civicrm_api3('contribution', 'completetransaction', [ 'id' => $contributionID, - 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), + 'trxn_id' => $result['trxn_id'] ?? NULL, 'payment_processor_id' => CRM_Utils_Array::value('payment_processor_id', $result, $this->_paymentProcessor['id']), 'is_transactional' => FALSE, - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), - 'receive_date' => CRM_Utils_Array::value('receive_date', $result), - 'card_type_id' => CRM_Utils_Array::value('card_type_id', $result), - 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $result), + 'fee_amount' => $result['fee_amount'] ?? NULL, + 'receive_date' => $result['receive_date'] ?? NULL, + 'card_type_id' => $result['card_type_id'] ?? NULL, + 'pan_truncation' => $result['pan_truncation'] ?? NULL, ]); } catch (CiviCRM_API3_Exception $e) { diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 65d4fb1fa9..deb0d26bce 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -283,10 +283,10 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont try { // A payment notification update could have come in at any time. Check at the last minute. $contributionStatusID = civicrm_api3('Contribution', 'getvalue', [ - 'id' => CRM_Utils_Array::value('contributionID', $params), + 'id' => $params['contributionID'] ?? NULL, 'return' => 'contribution_status_id', 'is_test' => ($this->_mode == 'test') ? 1 : 0, - 'invoice_id' => CRM_Utils_Array::value('invoiceID', $params), + 'invoice_id' => $params['invoiceID'] ?? NULL, ]); if (CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contributionStatusID) === 'Pending' && !empty($params['payment_processor_id']) diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index 499af139b7..7963d33548 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -685,7 +685,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co 'label' => ts('Other Amount'), 'price_set_id' => $priceSetId, 'html_type' => 'Text', - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $this->_values), + 'financial_type_id' => $this->_values['financial_type_id'] ?? NULL, 'is_display_amounts' => 0, 'weight' => 3, ]; diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index d01811b9cd..f2a0298655 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -364,7 +364,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { 'amountPaid' => $amountPaid, 'invoice_date' => $invoiceDate, 'dueDate' => $dueDate, - 'notes' => CRM_Utils_Array::value('notes', $prefixValue), + 'notes' => $prefixValue['notes'] ?? NULL, 'display_name' => $contribution->_relatedObjects['contact']->display_name, 'lineItem' => $lineItem, 'dataArray' => $dataArray, @@ -374,17 +374,17 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { 'contribution_status_id' => $contribution->contribution_status_id, 'contributionStatusName' => CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution->contribution_status_id), 'subTotal' => $subTotal, - 'street_address' => CRM_Utils_Array::value('street_address', $billingAddress), - 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1', $billingAddress), - 'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2', $billingAddress), - 'supplemental_address_3' => CRM_Utils_Array::value('supplemental_address_3', $billingAddress), - 'city' => CRM_Utils_Array::value('city', $billingAddress), - 'postal_code' => CRM_Utils_Array::value('postal_code', $billingAddress), - 'state_province' => CRM_Utils_Array::value('state_province', $billingAddress), - 'state_province_abbreviation' => CRM_Utils_Array::value('state_province_abbreviation', $billingAddress), + 'street_address' => $billingAddress['street_address'] ?? NULL, + 'supplemental_address_1' => $billingAddress['supplemental_address_1'] ?? NULL, + 'supplemental_address_2' => $billingAddress['supplemental_address_2'] ?? NULL, + 'supplemental_address_3' => $billingAddress['supplemental_address_3'] ?? NULL, + 'city' => $billingAddress['city'] ?? NULL, + 'postal_code' => $billingAddress['postal_code'] ?? NULL, + 'state_province' => $billingAddress['state_province'] ?? NULL, + 'state_province_abbreviation' => $billingAddress['state_province_abbreviation'] ?? NULL, // Kept for backwards compatibility - 'stateProvinceAbbreviation' => CRM_Utils_Array::value('state_province_abbreviation', $billingAddress), - 'country' => CRM_Utils_Array::value('country', $billingAddress), + 'stateProvinceAbbreviation' => $billingAddress['state_province_abbreviation'] ?? NULL, + 'country' => $billingAddress['country'] ?? NULL, 'is_pay_later' => $contribution->is_pay_later, 'organization_name' => $contribution->_relatedObjects['contact']->organization_name, 'domain_organization' => $domain->name, diff --git a/CRM/Contribute/Form/Task/PDFLetterCommon.php b/CRM/Contribute/Form/Task/PDFLetterCommon.php index 8650ac02c7..bf30652232 100644 --- a/CRM/Contribute/Form/Task/PDFLetterCommon.php +++ b/CRM/Contribute/Form/Task/PDFLetterCommon.php @@ -36,8 +36,8 @@ class CRM_Contribute_Form_Task_PDFLetterCommon extends CRM_Contact_Form_Task_PDF if (!empty($formValues['email_options'])) { $returnProperties['email'] = $returnProperties['on_hold'] = $returnProperties['is_deceased'] = $returnProperties['do_not_email'] = 1; $emailParams = [ - 'subject' => CRM_Utils_Array::value('subject', $formValues), - 'from' => CRM_Utils_Array::value('from_email_address', $formValues), + 'subject' => $formValues['subject'] ?? NULL, + 'from' => $formValues['from_email_address'] ?? NULL, ]; $emailParams['from'] = CRM_Utils_Mail::formatFromAddress($emailParams['from']); diff --git a/CRM/Contribute/Import/Parser/Contribution.php b/CRM/Contribute/Import/Parser/Contribution.php index 5bc8cf306e..9f2bfe6d0d 100644 --- a/CRM/Contribute/Import/Parser/Contribution.php +++ b/CRM/Contribute/Import/Parser/Contribution.php @@ -266,9 +266,9 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE if (!empty($paramValues['invoice_id']) || !empty($paramValues['trxn_id']) || !empty($paramValues['contribution_id'])) { $dupeIds = [ - 'id' => CRM_Utils_Array::value('contribution_id', $paramValues), - 'trxn_id' => CRM_Utils_Array::value('trxn_id', $paramValues), - 'invoice_id' => CRM_Utils_Array::value('invoice_id', $paramValues), + 'id' => $paramValues['contribution_id'] ?? NULL, + 'trxn_id' => $paramValues['trxn_id'] ?? NULL, + 'invoice_id' => $paramValues['invoice_id'] ?? NULL, ]; $ids['contribution'] = CRM_Contribute_BAO_Contribution::checkDuplicateIds($dupeIds); diff --git a/CRM/Core/BAO/Block.php b/CRM/Core/BAO/Block.php index 001787d2f3..edee3b3d8a 100644 --- a/CRM/Core/BAO/Block.php +++ b/CRM/Core/BAO/Block.php @@ -312,7 +312,7 @@ class CRM_Core_BAO_Block { } $contactFields = [ 'contact_id' => $contactId, - 'location_type_id' => CRM_Utils_Array::value('location_type_id', $value), + 'location_type_id' => $value['location_type_id'] ?? NULL, ]; $contactFields['is_primary'] = 0; diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index 1bfd2a634c..84144bb166 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -1918,11 +1918,11 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1, $details[$groupID][$values['id']]['collapse_adv_display'] = CRM_Utils_Array::value('collapse_adv_display', $group); $details[$groupID][$values['id']]['style'] = CRM_Utils_Array::value('style', $group); $details[$groupID][$values['id']]['fields'][$k] = [ - 'field_title' => CRM_Utils_Array::value('label', $properties), - 'field_type' => CRM_Utils_Array::value('html_type', $properties), - 'field_data_type' => CRM_Utils_Array::value('data_type', $properties), + 'field_title' => $properties['label'] ?? NULL, + 'field_type' => $properties['html_type'] ?? NULL, + 'field_data_type' => $properties['data_type'] ?? NULL, 'field_value' => CRM_Core_BAO_CustomField::displayValue($values['data'], $properties['id'], $entityId), - 'options_per_line' => CRM_Utils_Array::value('options_per_line', $properties), + 'options_per_line' => $properties['options_per_line'] ?? NULL, ]; // editable = whether this set contains any non-read-only fields if (!isset($details[$groupID][$values['id']]['editable'])) { diff --git a/CRM/Core/BAO/CustomValueTable.php b/CRM/Core/BAO/CustomValueTable.php index 0b352b4c09..6eed0a67f7 100644 --- a/CRM/Core/BAO/CustomValueTable.php +++ b/CRM/Core/BAO/CustomValueTable.php @@ -345,7 +345,7 @@ class CRM_Core_BAO_CustomValueTable { 'custom_group_id' => $customValue['custom_group_id'], 'table_name' => $customValue['table_name'], 'column_name' => $customValue['column_name'], - 'is_multiple' => CRM_Utils_Array::value('is_multiple', $customValue), + 'is_multiple' => $customValue['is_multiple'] ?? NULL, 'file_id' => $customValue['file_id'], ]; diff --git a/CRM/Core/BAO/Dashboard.php b/CRM/Core/BAO/Dashboard.php index b45df60c31..a6388e15c2 100644 --- a/CRM/Core/BAO/Dashboard.php +++ b/CRM/Core/BAO/Dashboard.php @@ -120,7 +120,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { 'label' => $item['dashboard_id.label'], 'url' => $item['dashboard_id.url'], 'cache_minutes' => $item['dashboard_id.cache_minutes'], - 'fullscreen_url' => CRM_Utils_Array::value('dashboard_id.fullscreen_url', $item), + 'fullscreen_url' => $item['dashboard_id.fullscreen_url'] ?? NULL, ]; } } @@ -203,7 +203,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard { 'label' => $dashlet['label'], 'cache_minutes' => $dashlet['cache_minutes'], 'url' => $dashlet['url'], - 'fullscreen_url' => CRM_Utils_Array::value('fullscreen_url', $dashlet), + 'fullscreen_url' => $dashlet['fullscreen_url'] ?? NULL, ]; } } diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index 113efbf308..4ab15a1d23 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -348,8 +348,8 @@ WHERE ceft.entity_id = %1"; 'to_financial_account_id' => CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], $toFinancialAccountType), 'from_financial_account_id' => CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['financial_type_id'], $fromFinancialAccountType), 'trxn_date' => date('YmdHis'), - 'total_amount' => !empty($params['cost']) ? $params['cost'] : 0, - 'currency' => CRM_Utils_Array::value('currency', $params), + 'total_amount' => $params['cost'] ?? 0, + 'currency' => $params['currency'] ?? NULL, 'status_id' => array_search('Completed', $contributionStatuses), 'entity_table' => 'civicrm_contribution', 'entity_id' => $params['contributionId'], @@ -364,9 +364,9 @@ WHERE ceft.entity_id = %1"; $productDetails = []; CRM_Contribute_BAO_Product::retrieve($premiumParams, $productDetails); $params = [ - 'cost' => CRM_Utils_Array::value('cost', $productDetails), - 'currency' => CRM_Utils_Array::value('currency', $productDetails), - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $productDetails), + 'cost' => $productDetails['cost'] ?? NULL, + 'currency' => $productDetails['currency'] ?? NULL, + 'financial_type_id' => $productDetails['financial_type_id'] ?? NULL, 'contributionId' => $params['oldPremium']['contribution_id'], 'isDeleted' => TRUE, ]; diff --git a/CRM/Core/BAO/Tag.php b/CRM/Core/BAO/Tag.php index 623dd412de..2ef3afb411 100644 --- a/CRM/Core/BAO/Tag.php +++ b/CRM/Core/BAO/Tag.php @@ -333,10 +333,10 @@ class CRM_Core_BAO_Tag extends CRM_Core_DAO_Tag { $allTags[$id] = [ 'text' => $tag['name'], 'id' => $id, - 'description' => CRM_Utils_Array::value('description', $tag), - 'parent_id' => CRM_Utils_Array::value('parent_id', $tag), - 'used_for' => CRM_Utils_Array::value('used_for', $tag), - 'color' => CRM_Utils_Array::value('color', $tag), + 'description' => $tag['description'] ?? NULL, + 'parent_id' => $tag['parent_id'] ?? NULL, + 'used_for' => $tag['used_for'] ?? NULL, + 'color' => $tag['color'] ?? NULL, ]; if (!$allowSelectingNonSelectable && empty($tag['is_selectable'])) { $allTags[$id]['disabled'] = TRUE; diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 43995fc555..4fad6876a8 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -504,7 +504,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { ), 'skipDisplay' => 0, 'data_type' => CRM_Utils_Type::getDataTypeFromFieldMetadata($fieldMetaData), - 'bao' => CRM_Utils_Array::value('bao', $fieldMetaData), + 'bao' => $fieldMetaData['bao'] ?? NULL, ]; $formattedField = CRM_Utils_Date::addDateMetadataToField($fieldMetaData, $formattedField); diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index f481131cc0..e1bfa5a40f 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -350,7 +350,7 @@ class CRM_Core_Menu { $value = array( 'title' => $item['title'], - 'desc' => CRM_Utils_Array::value('desc', $item), + 'desc' => $item['desc'] ?? NULL, 'id' => strtr($item['title'], array( '(' => '_', ')' => '', @@ -366,8 +366,8 @@ class CRM_Core_Menu { // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend TRUE ), - 'icon' => CRM_Utils_Array::value('icon', $item), - 'extra' => CRM_Utils_Array::value('extra', $item), + 'icon' => $item['icon'] ?? NULL, + 'extra' => $item['extra'] ?? NULL, ); if (!array_key_exists($item['adminGroup'], $values)) { $values[$item['adminGroup']] = array(); diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 6611efbea2..cb71dbd438 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -939,7 +939,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { 't3' => ucfirst(substr($params['frequency_unit'], 0, 1)), 'src' => 1, 'sra' => 1, - 'srt' => CRM_Utils_Array::value('installments', $params), + 'srt' => $params['installments'] ?? NULL, 'no_note' => 1, 'modify' => 0, ]; diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 064cad9797..3078e8f84c 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -233,8 +233,8 @@ class CRM_Core_PseudoConstant { // Merge params with schema defaults $params += [ 'condition' => CRM_Utils_Array::value('condition', $pseudoconstant, []), - 'keyColumn' => CRM_Utils_Array::value('keyColumn', $pseudoconstant), - 'labelColumn' => CRM_Utils_Array::value('labelColumn', $pseudoconstant), + 'keyColumn' => $pseudoconstant['keyColumn'] ?? NULL, + 'labelColumn' => $pseudoconstant['labelColumn'] ?? NULL, ]; // Fetch option group from option_value table diff --git a/CRM/Custom/Import/Parser/Api.php b/CRM/Custom/Import/Parser/Api.php index ab60fa1d33..da2eb78f09 100644 --- a/CRM/Custom/Import/Parser/Api.php +++ b/CRM/Custom/Import/Parser/Api.php @@ -251,14 +251,14 @@ class CRM_Custom_Import_Parser_Api extends CRM_Custom_Import_Parser { $regexp = preg_replace('/[.,;:!?]/', '', CRM_Utils_Array::value(0, $values)); $importableFields[$key] = [ 'name' => $key, - 'title' => CRM_Utils_Array::value('label', $values), + 'title' => $values['label'] ?? NULL, 'headerPattern' => '/' . preg_quote($regexp, '/') . '/', 'import' => 1, 'custom_field_id' => $id, - 'options_per_line' => CRM_Utils_Array::value('options_per_line', $values), - 'data_type' => CRM_Utils_Array::value('data_type', $values), - 'html_type' => CRM_Utils_Array::value('html_type', $values), - 'is_search_range' => CRM_Utils_Array::value('is_search_range', $values), + 'options_per_line' => $values['options_per_line'] ?? NULL, + 'data_type' => $values['data_type'] ?? NULL, + 'html_type' => $values['html_type'] ?? NULL, + '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); diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index ec04f44f1e..29252fc27e 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1147,10 +1147,10 @@ WHERE civicrm_event.is_active = 1 } $tplParams = array_merge($values, $participantParams, [ 'email' => $email, - 'confirm_email_text' => CRM_Utils_Array::value('confirm_email_text', $values['event']), - 'isShowLocation' => CRM_Utils_Array::value('is_show_location', $values['event']), + 'confirm_email_text' => $values['event']['confirm_email_text'] ?? NULL, + 'isShowLocation' => $values['event']['is_show_location'] ?? NULL, // The concept of contributeMode is deprecated. - 'contributeMode' => CRM_Utils_Array::value('contributeMode', $template->_tpl_vars), + 'contributeMode' => $template->_tpl_vars['contributeMode'] ?? NULL, 'customPre' => $profilePre[0], 'customPre_grouptitle' => empty($profilePre[1]) ? NULL : [CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $preProfileID)], 'customPost' => $profilePost[0], @@ -2212,8 +2212,8 @@ WHERE ce.loc_block_id = $locBlockId"; $fromEmailValues['from_email_id'][$eventEmailId] = htmlspecialchars($eventEmailId); $fromEmailId = [ - 'cc' => CRM_Utils_Array::value('cc_confirm', $eventEmail), - 'bcc' => CRM_Utils_Array::value('bcc_confirm', $eventEmail), + 'cc' => $eventEmail['cc_confirm'] ?? NULL, + 'bcc' => $eventEmail['bcc_confirm'] ?? NULL, ]; $fromEmailValues = array_merge($fromEmailValues, $fromEmailId); } diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index d1c100ae3b..ed598bd5ce 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1465,8 +1465,8 @@ UPDATE civicrm_participant 'domain' => $domainValues, 'participant' => $participantValues, 'event' => $eventDetails, - 'paidEvent' => CRM_Utils_Array::value('is_monetary', $eventDetails), - 'isShowLocation' => CRM_Utils_Array::value('is_show_location', $eventDetails), + 'paidEvent' => $eventDetails['is_monetary'] ?? NULL, + 'isShowLocation' => $eventDetails['is_show_location'] ?? NULL, 'isAdditional' => $participantValues['registered_by_id'], 'isExpired' => $mailType == 'Expired', 'isConfirm' => $mailType == 'Confirm', @@ -1475,8 +1475,8 @@ UPDATE civicrm_participant 'from' => $receiptFrom, 'toName' => $participantName, 'toEmail' => $toEmail, - 'cc' => CRM_Utils_Array::value('cc_confirm', $eventDetails), - 'bcc' => CRM_Utils_Array::value('bcc_confirm', $eventDetails), + 'cc' => $eventDetails['cc_confirm'] ?? NULL, + 'bcc' => $eventDetails['bcc_confirm'] ?? NULL, ] ); diff --git a/CRM/Event/Cart/BAO/MerParticipant.php b/CRM/Event/Cart/BAO/MerParticipant.php index 5d307df7be..0b672a1689 100644 --- a/CRM/Event/Cart/BAO/MerParticipant.php +++ b/CRM/Event/Cart/BAO/MerParticipant.php @@ -49,7 +49,7 @@ class CRM_Event_Cart_BAO_MerParticipant extends CRM_Event_BAO_Participant { */ public static function create(&$params) { $participantParams = [ - 'id' => CRM_Utils_Array::value('id', $params), + 'id' => $params['id'] ?? NULL, 'role_id' => self::get_attendee_role_id(), 'status_id' => self::get_pending_in_cart_status_id(), 'contact_id' => $params['contact_id'], diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index 5f79f4ec27..96a64ead56 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -40,7 +40,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { 'source' => CRM_Utils_Array::value('participant_source', $params, $this->description), 'is_pay_later' => $this->is_pay_later, 'fee_amount' => CRM_Utils_Array::value('amount', $params, 0), - 'fee_currency' => CRM_Utils_Array::value('currencyID', $params), + 'fee_currency' => $params['currencyID'] ?? NULL, ]; if ($participant->must_wait) { @@ -559,7 +559,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $trxnDetails = [ 'trxn_id' => $result['trxn_id'], 'trxn_date' => $result['now'], - 'currency' => CRM_Utils_Array::value('currencyID', $result), + 'currency' => $result['currencyID'] ?? NULL, ]; return $trxnDetails; } @@ -594,12 +594,12 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { 'net_amount' => $params['amount'], 'invoice_id' => "{$params['invoiceID']}-{$this->sub_trxn_index}", 'trxn_id' => "{$params['trxn_id']}-{$this->sub_trxn_index}", - 'currency' => CRM_Utils_Array::value('currencyID', $params), + 'currency' => $params['currencyID'] ?? NULL, 'source' => $event->title, 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'contribution_status_id' => $params['contribution_status_id'], 'payment_instrument_id' => $params['payment_instrument_id'], - 'check_number' => CRM_Utils_Array::value('check_number', $params), + 'check_number' => $params['check_number'] ?? NULL, 'skipLineItem' => 1, ]; diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index ed1476c4ae..9a955b3cba 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -2046,9 +2046,9 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment 'currency' => $params['currencyID'], 'source' => !empty($params['participant_source']) ? $params['participant_source'] : $params['description'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), - 'card_type_id' => CRM_Utils_Array::value('card_type_id', $params), - 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $params), + 'campaign_id' => $params['campaign_id'] ?? NULL, + 'card_type_id' => $params['card_type_id'] ?? NULL, + 'pan_truncation' => $params['pan_truncation'] ?? NULL, ]; if ($paymentProcessor) { @@ -2058,7 +2058,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment if (!$pending && $result) { $contribParams += [ - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), + 'fee_amount' => $result['fee_amount'] ?? NULL, 'trxn_id' => $result['trxn_id'], 'receipt_date' => $receiptDate, ]; @@ -2125,7 +2125,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment $participantFields = CRM_Event_DAO_Participant::fields(); $participantParams = [ - 'id' => CRM_Utils_Array::value('participant_id', $params), + 'id' => $params['participant_id'] ?? NULL, 'contact_id' => $contactID, 'event_id' => $form->_eventId ? $form->_eventId : $params['event_id'], 'status_id' => CRM_Utils_Array::value('participant_status', @@ -2137,13 +2137,13 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment isset($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params), $participantFields['participant_source']['maxlength'] ), - 'fee_level' => CRM_Utils_Array::value('amount_level', $params), + 'fee_level' => $params['amount_level'] ?? NULL, 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $params), - 'registered_by_id' => CRM_Utils_Array::value('registered_by_id', $params), - 'discount_id' => CRM_Utils_Array::value('discount_id', $params), - 'fee_currency' => CRM_Utils_Array::value('currencyID', $params), - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), + 'fee_amount' => $params['fee_amount'] ?? NULL, + 'registered_by_id' => $params['registered_by_id'] ?? NULL, + 'discount_id' => $params['discount_id'] ?? NULL, + 'fee_currency' => $params['currencyID'] ?? NULL, + 'campaign_id' => $params['campaign_id'] ?? NULL, ]; if ($form->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') { diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 5e163d768b..007e9b4017 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -800,7 +800,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $participantFields = CRM_Event_DAO_Participant::fields(); $participantParams = array( - 'id' => CRM_Utils_Array::value('participant_id', $params), + 'id' => $params['participant_id'] ?? NULL, 'contact_id' => $contactID, 'event_id' => $form->_eventId ? $form->_eventId : $params['event_id'], 'status_id' => CRM_Utils_Array::value('participant_status', @@ -812,13 +812,13 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { isset($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params), $participantFields['participant_source']['maxlength'] ), - 'fee_level' => CRM_Utils_Array::value('amount_level', $params), + 'fee_level' => $params['amount_level'] ?? NULL, 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $params), - 'registered_by_id' => CRM_Utils_Array::value('registered_by_id', $params), - 'discount_id' => CRM_Utils_Array::value('discount_id', $params), - 'fee_currency' => CRM_Utils_Array::value('currencyID', $params), - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), + 'fee_amount' => $params['fee_amount'] ?? NULL, + 'registered_by_id' => $params['registered_by_id'] ?? NULL, + 'discount_id' => $params['discount_id'] ?? NULL, + 'fee_currency' => $params['currencyID'] ?? NULL, + 'campaign_id' => $params['campaign_id'] ?? NULL, ); if ($form->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') { diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 735679d579..060df998c8 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -939,9 +939,9 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { 'currency' => $params['currencyID'], 'source' => !empty($params['participant_source']) ? $params['participant_source'] : $params['description'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), - 'card_type_id' => CRM_Utils_Array::value('card_type_id', $params), - 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $params), + 'campaign_id' => $params['campaign_id'] ?? NULL, + 'card_type_id' => $params['card_type_id'] ?? NULL, + 'pan_truncation' => $params['pan_truncation'] ?? NULL, ]; if ($paymentProcessor) { @@ -951,7 +951,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if (!$pending && $result) { $contribParams += [ - 'fee_amount' => CRM_Utils_Array::value('fee_amount', $result), + 'fee_amount' => $result['fee_amount'] ?? NULL, 'trxn_id' => $result['trxn_id'], 'receipt_date' => $receiptDate, ]; diff --git a/CRM/Event/Form/SelfSvcTransfer.php b/CRM/Event/Form/SelfSvcTransfer.php index 4569886426..487138ebe2 100644 --- a/CRM/Event/Form/SelfSvcTransfer.php +++ b/CRM/Event/Form/SelfSvcTransfer.php @@ -462,8 +462,8 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { 'from' => $receiptFrom, 'toName' => $participantName, 'toEmail' => $toEmail, - 'cc' => CRM_Utils_Array::value('cc_confirm', $eventDetails), - 'bcc' => CRM_Utils_Array::value('bcc_confirm', $eventDetails), + 'cc' => $eventDetails['cc_confirm'] ?? NULL, + 'bcc' => $eventDetails['bcc_confirm'] ?? NULL, ]; CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams); } diff --git a/CRM/Event/Page/EventInfo.php b/CRM/Event/Page/EventInfo.php index 664105fabe..e78686c325 100644 --- a/CRM/Event/Page/EventInfo.php +++ b/CRM/Event/Page/EventInfo.php @@ -297,8 +297,8 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page { $session = CRM_Core_Session::singleton(); $params = [ 'contact_id' => $session->get('userID'), - 'event_id' => CRM_Utils_Array::value('id', $values['event']), - 'role_id' => CRM_Utils_Array::value('default_role_id', $values['event']), + 'event_id' => $values['event']['id'] ?? NULL, + 'role_id' => $values['event']['default_role_id'] ?? NULL, ]; if ($eventFullMessage && ($noFullMsg == 'false') || CRM_Event_BAO_Event::checkRegistration($params)) { diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index 7cd09259cc..9f5e0ad550 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -303,12 +303,12 @@ class CRM_Financial_BAO_Payment { 'amountOwed' => $entities['payment']['balance'], 'totalPaid' => $entities['payment']['paid'], 'paymentAmount' => $entities['payment']['total_amount'], - 'checkNumber' => CRM_Utils_Array::value('check_number', $entities['payment']), + 'checkNumber' => $entities['payment']['check_number'] ?? NULL, 'receive_date' => $entities['payment']['trxn_date'], 'paidBy' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $entities['payment']['payment_instrument_id']), 'isShowLocation' => (!empty($entities['event']) ? $entities['event']['is_show_location'] : FALSE), - 'location' => CRM_Utils_Array::value('location', $entities), - 'event' => CRM_Utils_Array::value('event', $entities), + 'location' => $entities['location'] ?? NULL, + 'event' => $entities['event'] ?? NULL, 'component' => (!empty($entities['event']) ? 'event' : 'contribution'), 'isRefund' => $entities['payment']['total_amount'] < 0, 'isAmountzero' => $entities['payment']['total_amount'] === 0, diff --git a/CRM/Financial/Form/PaymentEdit.php b/CRM/Financial/Form/PaymentEdit.php index 8aa8539e22..06acbd9521 100644 --- a/CRM/Financial/Form/PaymentEdit.php +++ b/CRM/Financial/Form/PaymentEdit.php @@ -150,7 +150,7 @@ class CRM_Financial_Form_PaymentEdit extends CRM_Core_Form { $params = [ 'id' => $this->_id, 'payment_instrument_id' => $this->_submitValues['payment_instrument_id'], - 'trxn_id' => CRM_Utils_Array::value('trxn_id', $this->_submitValues), + 'trxn_id' => $this->_submitValues['trxn_id'] ?? NULL, 'trxn_date' => CRM_Utils_Array::value('trxn_date', $this->_submitValues, date('YmdHis')), ]; diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index 773009cb28..2d140e7826 100644 --- a/CRM/Friend/BAO/Friend.php +++ b/CRM/Friend/BAO/Friend.php @@ -119,7 +119,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { 'details' => $params['suggested_message'], 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'), 'is_test' => $params['is_test'], - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), + 'campaign_id' => $params['campaign_id'] ?? NULL, ]; // activity creation diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php index 75c01b2bcf..6767b8f3cc 100644 --- a/CRM/Logging/Differ.php +++ b/CRM/Logging/Differ.php @@ -240,8 +240,8 @@ WHERE lt.log_conn_id = %1 'action' => $changed['log_action'], 'id' => $id, 'field' => $diff, - 'from' => CRM_Utils_Array::value($diff, $original), - 'to' => CRM_Utils_Array::value($diff, $changed), + 'from' => $original[$diff] ?? NULL, + 'to' => $changed[$diff] ?? NULL, 'table' => $table, 'log_date' => $changed['log_date'], 'log_conn_id' => $changed['log_conn_id'], diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index cb5b159017..a8265b8a67 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -2052,7 +2052,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND 'price_sets' => $priceSets, 'fields' => $fields, 'price_fields' => [ - 'price_' . $fieldID => CRM_Utils_Array::value('id', $results), + 'price_' . $fieldID => $results['id'] ?? NULL, ], ]; return $returnParams; diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 8129a226b5..bf26de3d4e 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -510,12 +510,12 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { // - set the payment information block // - set the max related block $allMembershipInfo[$key] = [ - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $values), + 'financial_type_id' => $values['financial_type_id'] ?? NULL, 'total_amount' => CRM_Utils_Money::format($totalAmount, NULL, '%a'), 'total_amount_numeric' => $totalAmount, - 'auto_renew' => CRM_Utils_Array::value('auto_renew', $values), + 'auto_renew' => $values['auto_renew'] ?? NULL, 'has_related' => isset($values['relationship_type_id']), - 'max_related' => CRM_Utils_Array::value('max_related', $values), + 'max_related' => $values['max_related'] ?? NULL, ]; } @@ -1374,10 +1374,10 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { 'contact_id' => $this->_contributorContactID, 'line_item' => $lineItem, 'is_test' => $isTest, - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $paymentParams), - 'contribution_page_id' => CRM_Utils_Array::value('contribution_page_id', $formValues), + 'campaign_id' => $paymentParams['campaign_id'] ?? NULL, + 'contribution_page_id' => $formValues['contribution_page_id'] ?? NULL, 'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)), - 'thankyou_date' => CRM_Utils_Array::value('thankyou_date', $paymentParams), + 'thankyou_date' => $paymentParams['thankyou_date'] ?? NULL, 'payment_instrument_id' => $paymentInstrumentID, ], $financialType, diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index f6e50c2d87..9b4f1d7491 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -286,7 +286,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { // build membership info array, which is used to set the payment information block when // membership type is selected. $allMembershipInfo[$key] = [ - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $values), + 'financial_type_id' => $values['financial_type_id'] ?? NULL, 'total_amount' => CRM_Utils_Money::format($totalAmount, NULL, '%a'), 'total_amount_numeric' => $totalAmount, 'tax_message' => $taxAmount ? ts("Includes %1 amount of %2", [1 => $this->getSalesTaxTerm(), 2 => CRM_Utils_Money::format($taxAmount)]) : $taxAmount, diff --git a/CRM/Member/Form/MembershipView.php b/CRM/Member/Form/MembershipView.php index b3f212a4f0..db184562e9 100644 --- a/CRM/Member/Form/MembershipView.php +++ b/CRM/Member/Form/MembershipView.php @@ -114,7 +114,7 @@ class CRM_Member_Form_MembershipView extends CRM_Core_Form { 'end_date' => CRM_Utils_Date::processDate($owner['end_date'], NULL, TRUE, 'Ymd'), 'source' => ts('Manual Assignment of Related Membership'), 'is_test' => $owner['is_test'], - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $owner), + 'campaign_id' => $owner['campaign_id'] ?? NULL, 'status_id' => $owner['status_id'], 'skipStatusCal' => TRUE, 'createActivity' => TRUE, diff --git a/CRM/Pledge/BAO/Pledge.php b/CRM/Pledge/BAO/Pledge.php index ef21f1a79c..fbe7a757d0 100644 --- a/CRM/Pledge/BAO/Pledge.php +++ b/CRM/Pledge/BAO/Pledge.php @@ -524,14 +524,14 @@ GROUP BY currency $contributionParams, $contributionStatus, $returnProperties ); $contributionValue = array( - 'status' => CRM_Utils_Array::value('contribution_status_id', $contributionStatus), - 'receive_date' => CRM_Utils_Array::value('receive_date', $contributionStatus), + 'status' => $contributionStatus['contribution_status_id'] ?? NULL, + 'receive_date' => $contributionStatus['receive_date'] ?? NULL, ); } $payments[$payID] = array_merge($contributionValue, array( - 'amount' => CRM_Utils_Array::value('scheduled_amount', $values), - 'due_date' => CRM_Utils_Array::value('scheduled_date', $values), + 'amount' => $values['scheduled_amount'] ?? NULL, + 'due_date' => $values['scheduled_date'] ?? NULL, ) ); @@ -683,7 +683,7 @@ GROUP BY currency 'is_test' => $params['is_test'], 'status_id' => 2, 'details' => $details, - 'campaign_id' => CRM_Utils_Array::value('campaign_id', $params), + 'campaign_id' => $params['campaign_id'] ?? NULL, ); // lets insert assignee record. diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index 6935d239bb..1ac0016cda 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -229,7 +229,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { foreach ($overduePayments as $id => $payment) { $label = ts("%1 - due on %2 (overdue)", array( 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)), - 2 => CRM_Utils_Array::value('scheduled_date', $payment), + 2 => $payment['scheduled_date'] ?? NULL, )); $paymentID = CRM_Utils_Array::value('id', $payment); $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $payment))); @@ -239,7 +239,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { if (!empty($nextPayment)) { $label = ts("%1 - due on %2", array( 1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)), - 2 => CRM_Utils_Array::value('scheduled_date', $nextPayment), + 2 => $nextPayment['scheduled_date'] ?? NULL, )); $paymentID = CRM_Utils_Array::value('id', $nextPayment); $payments[] = $form->createElement('checkbox', $paymentID, NULL, $label, array('amount' => CRM_Utils_Array::value('scheduled_amount', $nextPayment))); diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index c1f017f435..9c5b9bd58c 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -342,21 +342,21 @@ WHERE li.contribution_id = %1"; $values[$oid] = [ 'price_field_id' => $fid, 'price_field_value_id' => $oid, - 'label' => CRM_Utils_Array::value('label', $options[$oid]), + 'label' => $options[$oid]['label'] ?? NULL, 'field_title' => $fieldTitle, - 'description' => CRM_Utils_Array::value('description', $options[$oid]), + 'description' => $options[$oid]['description'] ?? NULL, 'qty' => $qty, 'unit_price' => $price, 'line_total' => $qty * $price, 'participant_count' => $qty * $participantsPerField, - 'max_value' => CRM_Utils_Array::value('max_value', $options[$oid]), - 'membership_type_id' => CRM_Utils_Array::value('membership_type_id', $options[$oid]), - 'membership_num_terms' => CRM_Utils_Array::value('membership_num_terms', $options[$oid]), - 'auto_renew' => CRM_Utils_Array::value('auto_renew', $options[$oid]), + 'max_value' => $options[$oid]['max_value'] ?? NULL, + 'membership_type_id' => $options[$oid]['membership_type_id'] ?? NULL, + 'membership_num_terms' => $options[$oid]['membership_num_terms'] ?? NULL, + 'auto_renew' => $options[$oid]['auto_renew'] ?? NULL, 'html_type' => $fields['html_type'], - 'financial_type_id' => CRM_Utils_Array::value('financial_type_id', $options[$oid]), + 'financial_type_id' => $options[$oid]['financial_type_id'] ?? NULL, 'tax_amount' => CRM_Utils_Array::value('tax_amount', $options[$oid], 0), - 'non_deductible_amount' => CRM_Utils_Array::value('non_deductible_amount', $options[$oid]), + 'non_deductible_amount' => $options[$oid]['non_deductible_amount'] ?? NULL, ]; if ($values[$oid]['membership_type_id'] && empty($values[$oid]['auto_renew'])) { diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 4325c88315..a65ec27c09 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -145,7 +145,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { 'is_active' => 1, 'is_default' => !empty($defaultArray[$params['option_weight'][$index]]) ? $defaultArray[$params['option_weight'][$index]] : 0, 'membership_num_terms' => NULL, - 'non_deductible_amount' => CRM_Utils_Array::value('non_deductible_amount', $params), + 'non_deductible_amount' => $params['non_deductible_amount'] ?? NULL, 'visibility_id' => CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_visibility_id', $params), self::getVisibilityOptionID('public')), ]; diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 47adf78eed..9690867ff6 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -3378,7 +3378,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND } if ($value && empty($field['no_display'])) { $statistics['filters'][] = [ - 'title' => CRM_Utils_Array::value('title', $field), + 'title' => $field['title'] ?? NULL, 'value' => CRM_Utils_String::htmlToText($value), ]; } diff --git a/CRM/Report/Form/Case/Detail.php b/CRM/Report/Form/Case/Detail.php index 1f7d6cc381..64d8952e71 100644 --- a/CRM/Report/Form/Case/Detail.php +++ b/CRM/Report/Form/Case/Detail.php @@ -509,7 +509,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form { $this->_columnHeaders['case_activity_all_dates'] = [ 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] . ": {$this->caseActivityTypes[$activityType]}", - 'type' => CRM_Utils_Array::value('type', $this->_caseDetailExtra['case_activity_all_dates']), + 'type' => $this->_caseDetailExtra['case_activity_all_dates']['type'] ?? NULL, ]; } diff --git a/CRM/Utils/Address.php b/CRM/Utils/Address.php index 0358f34d14..6e1eb1c61b 100644 --- a/CRM/Utils/Address.php +++ b/CRM/Utils/Address.php @@ -101,54 +101,54 @@ class CRM_Utils_Address { if (!$microformat) { // replacements in case of Individual Name Format $replacements = [ - 'contact.display_name' => CRM_Utils_Array::value('display_name', $fields), - 'contact.individual_prefix' => CRM_Utils_Array::value('individual_prefix', $fields), - 'contact.formal_title' => CRM_Utils_Array::value('formal_title', $fields), - 'contact.first_name' => CRM_Utils_Array::value('first_name', $fields), - 'contact.middle_name' => CRM_Utils_Array::value('middle_name', $fields), - 'contact.last_name' => CRM_Utils_Array::value('last_name', $fields), - 'contact.individual_suffix' => CRM_Utils_Array::value('individual_suffix', $fields), - 'contact.address_name' => CRM_Utils_Array::value('address_name', $fields), - 'contact.street_address' => CRM_Utils_Array::value('street_address', $fields), - 'contact.supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1', $fields), - 'contact.supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2', $fields), - 'contact.supplemental_address_3' => CRM_Utils_Array::value('supplemental_address_3', $fields), - 'contact.city' => CRM_Utils_Array::value('city', $fields), - 'contact.state_province_name' => CRM_Utils_Array::value('state_province_name', $fields), - 'contact.county' => CRM_Utils_Array::value('county', $fields), - 'contact.state_province' => CRM_Utils_Array::value('state_province', $fields), + 'contact.display_name' => $fields['display_name'] ?? NULL, + 'contact.individual_prefix' => $fields['individual_prefix'] ?? NULL, + 'contact.formal_title' => $fields['formal_title'] ?? NULL, + 'contact.first_name' => $fields['first_name'] ?? NULL, + 'contact.middle_name' => $fields['middle_name'] ?? NULL, + 'contact.last_name' => $fields['last_name'] ?? NULL, + 'contact.individual_suffix' => $fields['individual_suffix'] ?? NULL, + 'contact.address_name' => $fields['address_name'] ?? NULL, + 'contact.street_address' => $fields['street_address'] ?? NULL, + 'contact.supplemental_address_1' => $fields['supplemental_address_1'] ?? NULL, + 'contact.supplemental_address_2' => $fields['supplemental_address_2'] ?? NULL, + 'contact.supplemental_address_3' => $fields['supplemental_address_3'] ?? NULL, + 'contact.city' => $fields['city'] ?? NULL, + 'contact.state_province_name' => $fields['state_province_name'] ?? NULL, + 'contact.county' => $fields['county'] ?? NULL, + 'contact.state_province' => $fields['state_province'] ?? NULL, 'contact.postal_code' => $fullPostalCode, - 'contact.country' => CRM_Utils_Array::value('country', $fields), - 'contact.world_region' => CRM_Utils_Array::value('world_region', $fields), - 'contact.geo_code_1' => CRM_Utils_Array::value('geo_code_1', $fields), - 'contact.geo_code_2' => CRM_Utils_Array::value('geo_code_2', $fields), - 'contact.current_employer' => CRM_Utils_Array::value('current_employer', $fields), - 'contact.nick_name' => CRM_Utils_Array::value('nick_name', $fields), - 'contact.email' => CRM_Utils_Array::value('email', $fields), - 'contact.im' => CRM_Utils_Array::value('im', $fields), - 'contact.do_not_email' => CRM_Utils_Array::value('do_not_email', $fields), - 'contact.do_not_phone' => CRM_Utils_Array::value('do_not_phone', $fields), - 'contact.do_not_mail' => CRM_Utils_Array::value('do_not_mail', $fields), - 'contact.do_not_sms' => CRM_Utils_Array::value('do_not_sms', $fields), - 'contact.do_not_trade' => CRM_Utils_Array::value('do_not_trade', $fields), - 'contact.job_title' => CRM_Utils_Array::value('job_title', $fields), - 'contact.birth_date' => CRM_Utils_Array::value('birth_date', $fields), - 'contact.gender' => CRM_Utils_Array::value('gender', $fields), - 'contact.is_opt_out' => CRM_Utils_Array::value('is_opt_out', $fields), - 'contact.preferred_mail_format' => CRM_Utils_Array::value('preferred_mail_format', $fields), - 'contact.phone' => CRM_Utils_Array::value('phone', $fields), - 'contact.home_URL' => CRM_Utils_Array::value('home_URL', $fields), - 'contact.contact_source' => CRM_Utils_Array::value('contact_source', $fields), - 'contact.external_identifier' => CRM_Utils_Array::value('external_identifier', $fields), - 'contact.contact_id' => CRM_Utils_Array::value('id', $fields), - 'contact.household_name' => CRM_Utils_Array::value('display_name', $fields), - 'contact.organization_name' => CRM_Utils_Array::value('display_name', $fields), - 'contact.legal_name' => CRM_Utils_Array::value('legal_name', $fields), - 'contact.preferred_communication_method' => CRM_Utils_Array::value('preferred_communication_method', $fields), - 'contact.communication_style' => CRM_Utils_Array::value('communication_style', $fields), - 'contact.addressee' => CRM_Utils_Array::value('addressee_display', $fields), - 'contact.email_greeting' => CRM_Utils_Array::value('email_greeting_display', $fields), - 'contact.postal_greeting' => CRM_Utils_Array::value('postal_greeting_display', $fields), + 'contact.country' => $fields['country'] ?? NULL, + 'contact.world_region' => $fields['world_region'] ?? NULL, + 'contact.geo_code_1' => $fields['geo_code_1'] ?? NULL, + 'contact.geo_code_2' => $fields['geo_code_2'] ?? NULL, + 'contact.current_employer' => $fields['current_employer'] ?? NULL, + 'contact.nick_name' => $fields['nick_name'] ?? NULL, + 'contact.email' => $fields['email'] ?? NULL, + 'contact.im' => $fields['im'] ?? NULL, + 'contact.do_not_email' => $fields['do_not_email'] ?? NULL, + 'contact.do_not_phone' => $fields['do_not_phone'] ?? NULL, + 'contact.do_not_mail' => $fields['do_not_mail'] ?? NULL, + 'contact.do_not_sms' => $fields['do_not_sms'] ?? NULL, + 'contact.do_not_trade' => $fields['do_not_trade'] ?? NULL, + 'contact.job_title' => $fields['job_title'] ?? NULL, + 'contact.birth_date' => $fields['birth_date'] ?? NULL, + 'contact.gender' => $fields['gender'] ?? NULL, + 'contact.is_opt_out' => $fields['is_opt_out'] ?? NULL, + 'contact.preferred_mail_format' => $fields['preferred_mail_format'] ?? NULL, + 'contact.phone' => $fields['phone'] ?? NULL, + 'contact.home_URL' => $fields['home_URL'] ?? NULL, + 'contact.contact_source' => $fields['contact_source'] ?? NULL, + 'contact.external_identifier' => $fields['external_identifier'] ?? NULL, + 'contact.contact_id' => $fields['id'] ?? NULL, + 'contact.household_name' => $fields['display_name'] ?? NULL, + 'contact.organization_name' => $fields['display_name'] ?? NULL, + 'contact.legal_name' => $fields['legal_name'] ?? NULL, + 'contact.preferred_communication_method' => $fields['preferred_communication_method'] ?? NULL, + 'contact.communication_style' => $fields['communication_style'] ?? NULL, + 'contact.addressee' => $fields['addressee_display'] ?? NULL, + 'contact.email_greeting' => $fields['email_greeting_display'] ?? NULL, + 'contact.postal_greeting' => $fields['postal_greeting_display'] ?? NULL, ]; } else { diff --git a/CRM/Utils/Check/Component/Env.php b/CRM/Utils/Check/Component/Env.php index b6ebd4e7d6..31f13860f3 100644 --- a/CRM/Utils/Check/Component/Env.php +++ b/CRM/Utils/Check/Component/Env.php @@ -595,13 +595,13 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component { $row = CRM_Admin_Page_Extensions::createExtendedInfo($obj); switch ($row['status']) { case CRM_Extension_Manager::STATUS_INSTALLED_MISSING: - $errors[] = ts('%1 extension (%2) is installed but missing files.', [1 => CRM_Utils_Array::value('label', $row), 2 => $key]); + $errors[] = ts('%1 extension (%2) is installed but missing files.', [1 => $row['label'] ?? NULL, 2 => $key]); break; case CRM_Extension_Manager::STATUS_INSTALLED: if (!empty($remotes[$key]) && version_compare($row['version'], $remotes[$key]->version, '<')) { $updates[] = ts('%1 (%2) version %3 is installed. Upgrade to version %5.', [ - 1 => CRM_Utils_Array::value('label', $row), + 1 => $row['label'] ?? NULL, 2 => $key, 3 => $row['version'], 4 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id=$key&key=$key") . '"', diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php index 5accb77e7a..df20858d5b 100644 --- a/CRM/Utils/Date.php +++ b/CRM/Utils/Date.php @@ -395,8 +395,8 @@ class CRM_Utils_Date { } $date = [ - '%b' => CRM_Utils_Array::value($month, $abbrMonths), - '%B' => CRM_Utils_Array::value($month, $fullMonths), + '%b' => $abbrMonths[$month] ?? NULL, + '%B' => $fullMonths[$month] ?? NULL, '%d' => $day > 9 ? $day : '0' . $day, '%e' => $day > 9 ? $day : ' ' . $day, '%E' => $day, diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index fc19eaf7fd..8e62e1e17b 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -255,7 +255,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { if (isset($values['email_greeting'])) { if (!empty($params['email_greeting_id'])) { $emailGreetingFilter = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $params), + 'contact_type' => $params['contact_type'] ?? NULL, 'greeting_type' => 'email_greeting', ]; $emailGreetings = CRM_Core_PseudoConstant::greeting($emailGreetingFilter); @@ -271,7 +271,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { if (isset($values['postal_greeting'])) { if (!empty($params['postal_greeting_id'])) { $postalGreetingFilter = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $params), + 'contact_type' => $params['contact_type'] ?? NULL, 'greeting_type' => 'postal_greeting', ]; $postalGreetings = CRM_Core_PseudoConstant::greeting($postalGreetingFilter); @@ -286,7 +286,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { if (isset($values['addressee'])) { if (!empty($params['addressee_id'])) { $addresseeFilter = [ - 'contact_type' => CRM_Utils_Array::value('contact_type', $params), + 'contact_type' => $params['contact_type'] ?? NULL, 'greeting_type' => 'addressee', ]; $addressee = CRM_Core_PseudoConstant::addressee($addresseeFilter); diff --git a/CRM/Utils/Pager.php b/CRM/Utils/Pager.php index 26bb54c737..e2c4c26e7a 100644 --- a/CRM/Utils/Pager.php +++ b/CRM/Utils/Pager.php @@ -83,10 +83,10 @@ class CRM_Utils_Pager extends Pager_Sliding { 'last' => $this->getLastPageLink(), 'currentPage' => $this->getCurrentPageID(), 'numPages' => $this->numPages(), - 'csvString' => CRM_Utils_Array::value('csvString', $params), - 'status' => CRM_Utils_Array::value('status', $params), - 'buttonTop' => CRM_Utils_Array::value('buttonTop', $params), - 'buttonBottom' => CRM_Utils_Array::value('buttonBottom', $params), + 'csvString' => $params['csvString'] ?? NULL, + 'status' => $params['status'] ?? NULL, + 'buttonTop' => $params['buttonTop'] ?? NULL, + 'buttonBottom' => $params['buttonBottom'] ?? NULL, 'currentLocation' => $this->getCurrentLocation(), ]; diff --git a/CRM/Utils/Recent.php b/CRM/Utils/Recent.php index f70c76c2e3..0b9f3de7ab 100644 --- a/CRM/Utils/Recent.php +++ b/CRM/Utils/Recent.php @@ -119,11 +119,11 @@ class CRM_Utils_Recent { 'type' => $type, 'contact_id' => $contactId, 'contactName' => $contactName, - 'subtype' => CRM_Utils_Array::value('subtype', $others), + 'subtype' => $others['subtype'] ?? NULL, 'isDeleted' => CRM_Utils_Array::value('isDeleted', $others, FALSE), - 'image_url' => CRM_Utils_Array::value('imageUrl', $others), - 'edit_url' => CRM_Utils_Array::value('editUrl', $others), - 'delete_url' => CRM_Utils_Array::value('deleteUrl', $others), + 'image_url' => $others['imageUrl'] ?? NULL, + 'edit_url' => $others['editUrl'] ?? NULL, + 'delete_url' => $others['deleteUrl'] ?? NULL, ] ); diff --git a/CRM/Utils/Sort.php b/CRM/Utils/Sort.php index cef2fdcb71..a18e106118 100644 --- a/CRM/Utils/Sort.php +++ b/CRM/Utils/Sort.php @@ -106,7 +106,7 @@ class CRM_Utils_Sort { foreach ($vars as $weight => $value) { $this->_vars[$weight] = [ 'name' => CRM_Utils_Type::validate($value['sort'], 'MysqlColumnNameOrAlias'), - 'direction' => CRM_Utils_Array::value('direction', $value), + 'direction' => $value['direction'] ?? NULL, 'title' => $value['name'], ]; } diff --git a/api/v3/Activity.php b/api/v3/Activity.php index 8a41a70b7c..73f43f05a4 100644 --- a/api/v3/Activity.php +++ b/api/v3/Activity.php @@ -689,9 +689,9 @@ function civicrm_api3_activity_delete($params) { */ function _civicrm_api3_activity_check_params(&$params) { $activityIds = [ - 'activity' => CRM_Utils_Array::value('id', $params), - 'parent' => CRM_Utils_Array::value('parent_id', $params), - 'original' => CRM_Utils_Array::value('original_id', $params), + 'activity' => $params['id'] ?? NULL, + 'parent' => $params['parent_id'] ?? NULL, + 'original' => $params['original_id'] ?? NULL, ]; foreach ($activityIds as $id => $value) { diff --git a/api/v3/Case.php b/api/v3/Case.php index 3cf80ca99e..1f5b9b6ae4 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -145,19 +145,19 @@ function _civicrm_api3_case_create_xmlProcessor($params, $caseBAO) { // Initialize XML processor with $params $xmlProcessor = new CRM_Case_XMLProcessor_Process(); $xmlProcessorParams = [ - 'clientID' => CRM_Utils_Array::value('contact_id', $params), - 'creatorID' => CRM_Utils_Array::value('creator_id', $params), + 'clientID' => $params['contact_id'] ?? NULL, + 'creatorID' => $params['creator_id'] ?? NULL, 'standardTimeline' => 1, 'activityTypeName' => 'Open Case', - 'caseID' => CRM_Utils_Array::value('id', $params), - 'subject' => CRM_Utils_Array::value('subject', $params), - 'location' => CRM_Utils_Array::value('location', $params), - 'activity_date_time' => CRM_Utils_Array::value('start_date', $params), - 'duration' => CRM_Utils_Array::value('duration', $params), - 'medium_id' => CRM_Utils_Array::value('medium_id', $params), - 'details' => CRM_Utils_Array::value('details', $params), + 'caseID' => $params['id'] ?? NULL, + 'subject' => $params['subject'] ?? NULL, + 'location' => $params['location'] ?? NULL, + 'activity_date_time' => $params['start_date'] ?? NULL, + 'duration' => $params['duration'] ?? NULL, + 'medium_id' => $params['medium_id'] ?? NULL, + 'details' => $params['details'] ?? NULL, 'custom' => [], - 'relationship_end_date' => CRM_Utils_Array::value('end_date', $params), + 'relationship_end_date' => $params['end_date'] ?? NULL, ]; // Do it! :-D diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 00c0bebe1d..9fd042bf33 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -1592,9 +1592,9 @@ function civicrm_api3_contact_duplicatecheck($params) { return civicrm_api3('Contact', 'get', [ 'return' => $params['return'], 'id' => ['IN' => $dupes], - 'options' => CRM_Utils_Array::value('options', $params), - 'sequential' => CRM_Utils_Array::value('sequential', $params), - 'check_permissions' => CRM_Utils_Array::value('check_permissions', $params), + 'options' => $params['options'] ?? NULL, + 'sequential' => $params['sequential'] ?? NULL, + 'check_permissions' => $params['check_permissions'] ?? NULL, ]); } foreach ($dupes as $dupe) { diff --git a/api/v3/Domain.php b/api/v3/Domain.php index 8ca245cb80..de3f425b76 100644 --- a/api/v3/Domain.php +++ b/api/v3/Domain.php @@ -61,7 +61,7 @@ function civicrm_api3_domain_get($params) { $domain['domain_phone'] = [ 'phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), - 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]), + 'phone' => $values['location']['phone'][1]['phone'] ?? NULL, ]; } diff --git a/api/v3/Profile.php b/api/v3/Profile.php index 1f12a07322..17463bb1a3 100644 --- a/api/v3/Profile.php +++ b/api/v3/Profile.php @@ -515,10 +515,10 @@ function _civicrm_api3_buildprofile_submitfields($profileID, $optionsBehaviour = $profileFields[$profileID][$fieldName] = array_merge([ 'api.required' => $field['is_required'], 'title' => $field['label'], - 'help_pre' => CRM_Utils_Array::value('help_pre', $field), - 'help_post' => CRM_Utils_Array::value('help_post', $field), + 'help_pre' => $field['help_pre'] ?? NULL, + 'help_post' => $field['help_post'] ?? NULL, 'entity' => $entity, - 'weight' => CRM_Utils_Array::value('weight', $field), + 'weight' => $field['weight'] ?? NULL, ], $aliasArray); $ufFieldTaleFieldName = $field['field_name']; diff --git a/api/v3/System.php b/api/v3/System.php index 3eb6845ce4..486d67bb1b 100644 --- a/api/v3/System.php +++ b/api/v3/System.php @@ -246,7 +246,7 @@ function civicrm_api3_system_get($params) { 'exampleUrl' => CRM_Utils_System::url('civicrm/example', NULL, TRUE, NULL, FALSE), ], 'http' => [ - 'software' => CRM_Utils_Array::value('SERVER_SOFTWARE', $_SERVER), + 'software' => $_SERVER['SERVER_SOFTWARE'] ?? NULL, 'forwarded' => !empty($_SERVER['HTTP_X_FORWARDED_FOR']) || !empty($_SERVER['X_FORWARDED_PROTO']), 'port' => (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == 80 || $_SERVER['SERVER_PORT'] == 443) ? 'Standard' : 'Nonstandard', ], diff --git a/ext/sequentialcreditnotes/sequentialcreditnotes.civix.php b/ext/sequentialcreditnotes/sequentialcreditnotes.civix.php index 0b17d88b11..09228ba9d6 100644 --- a/ext/sequentialcreditnotes/sequentialcreditnotes.civix.php +++ b/ext/sequentialcreditnotes/sequentialcreditnotes.civix.php @@ -386,7 +386,7 @@ function _sequentialcreditnotes_civix_insert_navigation_menu(&$menu, $path, $ite if (empty($path)) { $menu[] = [ 'attributes' => array_merge([ - 'label' => CRM_Utils_Array::value('name', $item), + 'label' => $item['name'] ?? NULL, 'active' => 1, ], $item), ]; diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index 5ecedd18a8..77e6020f6a 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -328,7 +328,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'is_primary' => 1, ]; $compareParams = [ - 'street_address' => CRM_Utils_Array::value('street_address', $params['address'][1]), + 'street_address' => $params['address'][1]['street_address'] ?? NULL, 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1', $params['address'][1] ), @@ -338,14 +338,14 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'supplemental_address_3' => CRM_Utils_Array::value('supplemental_address_3', $params['address'][1] ), - 'city' => CRM_Utils_Array::value('city', $params['address'][1]), - 'postal_code' => CRM_Utils_Array::value('postal_code', $params['address'][1]), - 'country_id' => CRM_Utils_Array::value('country_id', $params['address'][1]), + 'city' => $params['address'][1]['city'] ?? NULL, + 'postal_code' => $params['address'][1]['postal_code'] ?? NULL, + 'country_id' => $params['address'][1]['country_id'] ?? NULL, 'state_province_id' => CRM_Utils_Array::value('state_province_id', $params['address'][1] ), - 'geo_code_1' => CRM_Utils_Array::value('geo_code_1', $params['address'][1]), - 'geo_code_2' => CRM_Utils_Array::value('geo_code_2', $params['address'][1]), + 'geo_code_1' => $params['address'][1]['geo_code_1'] ?? NULL, + 'geo_code_2' => $params['address'][1]['geo_code_2'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams); @@ -359,8 +359,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //Now check DB for IM $compareParams = [ - 'name' => CRM_Utils_Array::value('name', $params['im'][1]), - 'provider_id' => CRM_Utils_Array::value('provider_id', $params['im'][1]), + 'name' => $params['im'][1]['name'] ?? NULL, + 'provider_id' => $params['im'][1]['provider_id'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams); @@ -369,7 +369,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'contact_id' => $contactId, 'location_type_id' => 1, 'is_primary' => 1, - 'phone_type_id' => CRM_Utils_Array::value('phone_type_id', $params['phone'][1]), + 'phone_type_id' => $params['phone'][1]['phone_type_id'] ?? NULL, ]; $compareParams = ['phone' => CRM_Utils_Array::value('phone', $params['phone'][1])]; $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); @@ -378,7 +378,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $searchParams = [ 'contact_id' => $contactId, 'location_type_id' => 1, - 'phone_type_id' => CRM_Utils_Array::value('phone_type_id', $params['phone'][2]), + 'phone_type_id' => $params['phone'][2]['phone_type_id'] ?? NULL, ]; $compareParams = ['phone' => CRM_Utils_Array::value('phone', $params['phone'][2])]; $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); @@ -838,16 +838,16 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'is_primary' => 1, ]; $compareParams = [ - 'street_address' => CRM_Utils_Array::value('street_address-Primary', $profileParams), - 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1-Primary', $profileParams), - 'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2-Primary', $profileParams), - 'supplemental_address_3' => CRM_Utils_Array::value('supplemental_address_3-Primary', $profileParams), - 'city' => CRM_Utils_Array::value('city-Primary', $profileParams), - 'postal_code' => CRM_Utils_Array::value('postal_code-Primary', $profileParams), - 'country_id' => CRM_Utils_Array::value('country-Primary', $profileParams), - 'state_province_id' => CRM_Utils_Array::value('state_province-Primary', $profileParams), - 'geo_code_1' => CRM_Utils_Array::value('geo_code_1-Primary', $profileParams), - 'geo_code_2' => CRM_Utils_Array::value('geo_code_2-Primary', $profileParams), + 'street_address' => $profileParams['street_address-Primary'] ?? NULL, + 'supplemental_address_1' => $profileParams['supplemental_address_1-Primary'] ?? NULL, + 'supplemental_address_2' => $profileParams['supplemental_address_2-Primary'] ?? NULL, + 'supplemental_address_3' => $profileParams['supplemental_address_3-Primary'] ?? NULL, + 'city' => $profileParams['city-Primary'] ?? NULL, + 'postal_code' => $profileParams['postal_code-Primary'] ?? NULL, + 'country_id' => $profileParams['country-Primary'] ?? NULL, + 'state_province_id' => $profileParams['state_province-Primary'] ?? NULL, + 'geo_code_1' => $profileParams['geo_code_1-Primary'] ?? NULL, + 'geo_code_2' => $profileParams['geo_code_2-Primary'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams); @@ -857,8 +857,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //Now check DB for IM $compareParams = [ - 'name' => CRM_Utils_Array::value('im-Primary', $profileParams), - 'provider_id' => CRM_Utils_Array::value('im-Primary-provider_id', $profileParams), + 'name' => $profileParams['im-Primary'] ?? NULL, + 'provider_id' => $profileParams['im-Primary-provider_id'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams); @@ -875,7 +875,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $searchParams = [ 'contact_id' => $contactId, 'location_type_id' => 1, - 'phone_type_id' => CRM_Utils_Array::value('phone_type_id', $params['phone'][2]), + 'phone_type_id' => $params['phone'][2]['phone_type_id'] ?? NULL, ]; $compareParams = ['phone' => CRM_Utils_Array::value('phone-Primary-2', $profileParams)]; @@ -1044,16 +1044,16 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'is_primary' => 1, ]; $compareParams = [ - 'street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams), - 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1-Primary', $updatePfParams), - 'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2-Primary', $updatePfParams), - 'supplemental_address_3' => CRM_Utils_Array::value('supplemental_address_3-Primary', $updatePfParams), - 'city' => CRM_Utils_Array::value('city-Primary', $updatePfParams), - 'postal_code' => CRM_Utils_Array::value('postal_code-Primary', $updatePfParams), - 'country_id' => CRM_Utils_Array::value('country-Primary', $updatePfParams), - 'state_province_id' => CRM_Utils_Array::value('state_province-Primary', $updatePfParams), - 'geo_code_1' => CRM_Utils_Array::value('geo_code_1-Primary', $updatePfParams), - 'geo_code_2' => CRM_Utils_Array::value('geo_code_2-Primary', $updatePfParams), + 'street_address' => $updatePfParams['street_address-Primary'] ?? NULL, + 'supplemental_address_1' => $updatePfParams['supplemental_address_1-Primary'] ?? NULL, + 'supplemental_address_2' => $updatePfParams['supplemental_address_2-Primary'] ?? NULL, + 'supplemental_address_3' => $updatePfParams['supplemental_address_3-Primary'] ?? NULL, + 'city' => $updatePfParams['city-Primary'] ?? NULL, + 'postal_code' => $updatePfParams['postal_code-Primary'] ?? NULL, + 'country_id' => $updatePfParams['country-Primary'] ?? NULL, + 'state_province_id' => $updatePfParams['state_province-Primary'] ?? NULL, + 'geo_code_1' => $updatePfParams['geo_code_1-Primary'] ?? NULL, + 'geo_code_2' => $updatePfParams['geo_code_2-Primary'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams); @@ -1063,8 +1063,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //Now check DB for IM $compareParams = [ - 'name' => CRM_Utils_Array::value('im-Primary', $updatePfParams), - 'provider_id' => CRM_Utils_Array::value('im-Primary-provider_id', $updatePfParams), + 'name' => $updatePfParams['im-Primary'] ?? NULL, + 'provider_id' => $updatePfParams['im-Primary-provider_id'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams); @@ -1081,7 +1081,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $searchParams = [ 'contact_id' => $contactId, 'location_type_id' => 1, - 'phone_type_id' => CRM_Utils_Array::value('phone_type_id', $params['phone'][2]), + 'phone_type_id' => $params['phone'][2]['phone_type_id'] ?? NULL, ]; $compareParams = ['phone' => CRM_Utils_Array::value('phone-Primary-2', $updatePfParams)]; $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); @@ -1615,7 +1615,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'is_primary' => 1, ]; $compareParams = [ - 'street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams), + 'street_address' => $updatePfParams['street_address-Primary'] ?? NULL, ]; $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams); diff --git a/tests/phpunit/CRM/Core/BAO/LocationTest.php b/tests/phpunit/CRM/Core/BAO/LocationTest.php index 26fc750bc5..f91874864a 100644 --- a/tests/phpunit/CRM/Core/BAO/LocationTest.php +++ b/tests/phpunit/CRM/Core/BAO/LocationTest.php @@ -275,7 +275,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { //Now check DB for location elements. $searchParams = [ - 'id' => CRM_Utils_Array::value('address_id', $locElementIds), + 'id' => $locElementIds['address_id'] ?? NULL, 'location_type_id' => 1, 'is_primary' => 1, ]; @@ -294,7 +294,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams); $searchParams = [ - 'id' => CRM_Utils_Array::value('email_id', $locElementIds), + 'id' => $locElementIds['email_id'] ?? NULL, 'location_type_id' => 1, 'is_primary' => 1, ]; @@ -302,7 +302,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams); $searchParams = [ - 'id' => CRM_Utils_Array::value('phone_id', $locElementIds), + 'id' => $locElementIds['phone_id'] ?? NULL, 'location_type_id' => 1, 'is_primary' => 1, 'phone_type_id' => 1, @@ -311,7 +311,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); $searchParams = [ - 'id' => CRM_Utils_Array::value('phone_2_id', $locElementIds), + 'id' => $locElementIds['phone_2_id'] ?? NULL, 'location_type_id' => 1, 'phone_type_id' => 2, ]; @@ -319,7 +319,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); $searchParams = [ - 'id' => CRM_Utils_Array::value('im_id', $locElementIds), + 'id' => $locElementIds['im_id'] ?? NULL, 'location_type_id' => 1, 'is_primary' => 1, ]; diff --git a/tools/extensions/org.civicrm.angularex/angularex.civix.php b/tools/extensions/org.civicrm.angularex/angularex.civix.php index 69dee259d3..fcb5d572b0 100644 --- a/tools/extensions/org.civicrm.angularex/angularex.civix.php +++ b/tools/extensions/org.civicrm.angularex/angularex.civix.php @@ -256,7 +256,7 @@ function _angularex_civix_insert_navigation_menu(&$menu, $path, $item, $parentId $navId++; $menu[$navId] = [ 'attributes' => array_merge($item, [ - 'label' => CRM_Utils_Array::value('name', $item), + 'label' => $item['name'] ?? NULL, 'active' => 1, 'parentID' => $parentId, 'navID' => $navId, -- 2.25.1