diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 9249c65c5bc9b468b040d17c2b93dc940560b669..139b41619c2727c20ccc97f18aaa1045972945c8 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -6889,7 +6889,7 @@ AND displayRelType.is_active = 1 if (!empty($field) && empty($field['name'])) { // standardising field formatting here - over time we can phase out variants. // all paths using this currently unit tested - $field['name'] = CRM_Utils_Array::value('field_name', $field, CRM_Utils_Array::value('idCol', $field, $fieldName)); + $field['name'] = $field['field_name'] ?? $field['idCol'] ?? $fieldName; } return $field; } diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index fa111ba3655f3412e0f75947dcbdefe10bfb0669..c87a090f4a72f889d0468c8eb4d11d6657fc4a2b 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -158,7 +158,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship implemen * @throws \CRM_Core_Exception */ public static function add($params, $ids = []) { - $params['id'] = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params)); + $params['id'] = $ids['relationship'] ?? $params['id'] ?? NULL; $hook = 'create'; if ($params['id']) { diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 5db97fb7c3d463a2b3b24481781b66a0a43b31a9..affa7ced5c687da8416b09bbe23f721108d53578 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1833,10 +1833,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ } } - $paymentProcessorID = CRM_Utils_Array::value('payment_processor_id', $input, CRM_Utils_Array::value( - 'paymentProcessor', - $ids - )); + $paymentProcessorID = $input['payment_processor_id'] ?? $ids['paymentProcessor'] ?? NULL; if (!isset($input['payment_processor_id']) && !$paymentProcessorID && $contribution->contribution_page_id) { $paymentProcessorID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 09d4cabe72199bcdba72fe07d8f4e82d194b2101..d8b15bd113f94c77630fd3748d9a2293ac37c2fd 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1239,7 +1239,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP 'is_test' => $isTest, '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)), + 'source' => $paymentParams['source'] ?? $paymentParams['description'] ?? NULL, 'thankyou_date' => $this->_params['thankyou_date'] ?? NULL, ]; $contributionParams['payment_instrument_id'] = $this->_paymentProcessor['payment_instrument_id']; @@ -2016,7 +2016,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP } $params['line_item'] = $lineItem; $params['payment_processor_id'] = $params['payment_processor'] = $this->_paymentProcessor['id'] ?? NULL; - $params['tax_amount'] = CRM_Utils_Array::value('tax_amount', $submittedValues, CRM_Utils_Array::value('tax_amount', $this->_values)); + $params['tax_amount'] = $submittedValues['tax_amount'] ?? $this->_values['tax_amount'] ?? NULL; //create contribution. if ($isQuickConfig) { $params['is_quick_config'] = 1; diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 3a5398554959e1d17b98993dab100dd67dc03851..4b9103b8e7cf621ff698481bc03c8969e6cc50f9 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -2514,13 +2514,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr 'id' => $paymentParams['contribution_id'] ?? NULL, 'contact_id' => $contactID, 'is_test' => $isTest, - 'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)), + 'source' => $paymentParams['source'] ?? $paymentParams['description'] ?? NULL, ]; // CRM-21200: Don't overwrite contribution details during 'Pay now' payment if (empty($form->_params['contribution_id'])) { $contributionParams['contribution_page_id'] = $form->_id; - $contributionParams['campaign_id'] = CRM_Utils_Array::value('campaign_id', $paymentParams, CRM_Utils_Array::value('campaign_id', $form->_values)); + $contributionParams['campaign_id'] = $paymentParams['campaign_id'] ?? $form->_values['campaign_id'] ?? NULL; } // In case of 'Pay now' payment, append the contribution source with new text 'Paid later via page ID: N.' else { diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 42262451c72c34d4068f8d38230e9bcf05db1635..f36f7ebb9786a7bc9954065f0c885286cd52488f 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1063,7 +1063,7 @@ DESC limit 1"); 'line_items' => $this->getLineItemForOrderApi(), 'is_test' => $this->isTest(), 'campaign_id' => $this->getSubmittedValue('campaign_id'), - 'source' => CRM_Utils_Array::value('source', $paymentParams, CRM_Utils_Array::value('description', $paymentParams)), + 'source' => $paymentParams['source'] ?? $paymentParams['description'] ?? NULL, 'payment_instrument_id' => $this->getPaymentInstrumentID(), 'financial_type_id' => $this->getFinancialTypeID(), 'receive_date' => $this->getReceiveDate(), diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index f54b31133aeb908de25c9329ea129c0d52f07f75..eb48202e851e2e9f56c093af18ce85c1a133af2a 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -677,7 +677,7 @@ WHERE li.contribution_id = %1"; $updatedAmount = CRM_Price_BAO_LineItem::getLineTotal($contributionId); } else { - $updatedAmount = CRM_Utils_Array::value('amount', $params, CRM_Utils_Array::value('total_amount', $params)); + $updatedAmount = $params['amount'] ?? $params['total_amount'] ?? NULL; } if (strlen($params['tax_amount']) != 0) { $taxAmount = $params['tax_amount']; diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 7e523d79ceaa4358e4f43a49fd4a44f0c2994ac2..dbb474afe75a71c97ca2e2c4f6845c775a9caf2e 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -820,7 +820,7 @@ class CRM_Report_Form extends CRM_Core_Form { $expFields = []; // higher preference to bao object - $daoOrBaoName = CRM_Utils_Array::value('bao', $table, CRM_Utils_Array::value('dao', $table)); + $daoOrBaoName = $table['bao'] ?? $table['dao'] ?? NULL; if ($daoOrBaoName) { if (method_exists($daoOrBaoName, 'exportableFields')) { diff --git a/CRM/Report/Utils/Report.php b/CRM/Report/Utils/Report.php index 33e5f7342903e7c054cf26a09302ec57c8bcee85..dc95ffd95b2b474717907d58469a002cd229520c 100644 --- a/CRM/Report/Utils/Report.php +++ b/CRM/Report/Utils/Report.php @@ -390,7 +390,7 @@ WHERE inst.report_id = %1"; $_REQUEST['sendmail'] = CRM_Utils_Array::value('sendmail', $params, 1); // if cron is run from terminal --output is reserved, and therefore we would provide another name 'format' - $_REQUEST['output'] = CRM_Utils_Array::value('format', $params, CRM_Utils_Array::value('output', $params, 'pdf')); + $_REQUEST['output'] = $params['format'] ?? $params['output'] ?? 'pdf'; $_REQUEST['reset'] = CRM_Utils_Array::value('reset', $params, 1); $optionVal = self::getValueFromUrl($instanceId);