From a115bf890aeacc835a46cb6078836492128ecebe Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 13 Oct 2023 19:41:54 -0400 Subject: [PATCH] CRM/Contribute - Refactor unnecessary uses of CRM_Utils_Array::value --- CRM/Contribute/BAO/Contribution.php | 6 +++--- CRM/Contribute/BAO/ContributionPage.php | 2 +- CRM/Contribute/BAO/ContributionSoft.php | 2 +- CRM/Contribute/BAO/FinancialProcessor.php | 6 +++--- CRM/Contribute/Form/AbstractEditPayment.php | 2 +- CRM/Contribute/Form/Contribution.php | 12 ++++++------ CRM/Contribute/Form/ContributionBase.php | 2 +- CRM/Contribute/Form/ContributionCharts.php | 2 +- .../Form/ContributionPage/Amount.php | 8 ++++---- .../Form/ContributionPage/Premium.php | 4 ++-- .../Form/ContributionPage/Settings.php | 18 +++++++++--------- .../Form/ContributionPage/ThankYou.php | 2 +- .../Form/ContributionPage/Widget.php | 2 +- CRM/Contribute/Form/ContributionView.php | 2 +- CRM/Contribute/Form/Task/Invoice.php | 4 ++-- CRM/Contribute/Form/Task/PDFLetter.php | 2 +- CRM/Contribute/Page/ContributionRecur.php | 2 +- CRM/Contribute/Page/DashBoard.php | 2 +- CRM/Financial/BAO/Payment.php | 2 +- CRM/Financial/Form/BatchTransaction.php | 2 +- CRM/Financial/Form/FinancialAccount.php | 2 +- CRM/Financial/Form/FinancialType.php | 2 +- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index ffecfa2032..a04da212f2 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -3366,7 +3366,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac } // record line items and financial items if (empty($params['skipLineItem'])) { - CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $isUpdate); + CRM_Price_BAO_LineItem::processPriceSet($entityId, $params['line_item'] ?? NULL, $params['contribution'], $entityTable, $isUpdate); } // create batch entry if batch_id is passed and @@ -3490,7 +3490,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac 'version' => 3, 'id' => ($props['contribution_page_id']), ]); - $types = (array) CRM_Utils_Array::value('payment_processor', $page, 0); + $types = (array) $page['payment_processor'] ?? 0; $params['condition'] = 'id IN (' . implode(',', $types) . ')'; } break; @@ -3954,7 +3954,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac // if we are still empty see if we can use anything from a contribution page. if (!empty($pageValues['receipt_from_email'])) { return [ - CRM_Utils_Array::value('receipt_from_name', $pageValues), + $pageValues['receipt_from_name'] ?? NULL, $pageValues['receipt_from_email'], ]; } diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 72fec24e84..a2a5ce289d 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -261,7 +261,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio if ($gId) { $email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify'); if ($email) { - $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), TRUE); + $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, $params[$key] ?? NULL, TRUE); CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val); } } diff --git a/CRM/Contribute/BAO/ContributionSoft.php b/CRM/Contribute/BAO/ContributionSoft.php index 797d3dce9b..2a2885c95f 100644 --- a/CRM/Contribute/BAO/ContributionSoft.php +++ b/CRM/Contribute/BAO/ContributionSoft.php @@ -30,7 +30,7 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio */ public static function add(&$params) { $hook = empty($params['id']) ? 'create' : 'edit'; - CRM_Utils_Hook::pre($hook, 'ContributionSoft', CRM_Utils_Array::value('id', $params), $params); + CRM_Utils_Hook::pre($hook, 'ContributionSoft', $params['id'] ?? NULL, $params); $contributionSoft = new CRM_Contribute_DAO_ContributionSoft(); $contributionSoft->copyValues($params); diff --git a/CRM/Contribute/BAO/FinancialProcessor.php b/CRM/Contribute/BAO/FinancialProcessor.php index 475caa8165..73056b55da 100644 --- a/CRM/Contribute/BAO/FinancialProcessor.php +++ b/CRM/Contribute/BAO/FinancialProcessor.php @@ -81,7 +81,7 @@ class CRM_Contribute_BAO_FinancialProcessor { if ($params['contribution']->currency) { $currency = $params['contribution']->currency; } - $previousLineItemTotal = CRM_Utils_Array::value('line_total', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0); + $previousLineItemTotal = CRM_Utils_Array::value('line_total', $previousLineItems[$fieldValueId] ?? NULL, 0); $itemParams = [ 'transaction_date' => $receiveDate, 'contact_id' => $params['prevContribution']->contact_id, @@ -101,10 +101,10 @@ class CRM_Contribute_BAO_FinancialProcessor { $taxAmount = (float) $lineItemDetails['tax_amount']; if ($context === 'changeFinancialType' && $lineItemDetails['tax_amount'] === 'null') { // reverse the Sale Tax amount if there is no tax rate associated with new Financial Type - $taxAmount = CRM_Utils_Array::value('tax_amount', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0); + $taxAmount = CRM_Utils_Array::value('tax_amount', $previousLineItems[$fieldValueId] ?? NULL, 0); } elseif ($previousLineItemTotal != $lineItemDetails['line_total']) { - $taxAmount -= CRM_Utils_Array::value('tax_amount', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0); + $taxAmount -= CRM_Utils_Array::value('tax_amount', $previousLineItems[$fieldValueId] ?? NULL, 0); } if ($taxAmount != 0) { $itemParams['amount'] = CRM_Contribute_BAO_FinancialProcessor::getMultiplier($params['contribution']->contribution_status_id, $context) * $taxAmount; diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index 68e86322e4..6b9b5472ef 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -529,7 +529,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task { } $tplParams['credit_card_exp_date'] = isset($params['credit_card_exp_date']) ? CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format($params['credit_card_exp_date'])) : NULL; - $tplParams['credit_card_type'] = CRM_Utils_Array::value('credit_card_type', $params); + $tplParams['credit_card_type'] = $params['credit_card_type'] ?? NULL; $tplParams['credit_card_number'] = CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $params)); return $tplParams; } diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 3deaec2b7e..8cef2dc7eb 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1297,7 +1297,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $contributionParams, $financialType, $this->_bltID, - CRM_Utils_Array::value('is_recur', $this->_params) + $this->_params['is_recur'] ?? NULL ); $paymentParams['contributionID'] = $contribution->id; @@ -1653,7 +1653,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP if ($this->getPriceSetID() && $action & CRM_Core_Action::UPDATE) { $line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution'); $lineID = key($line); - $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('price_field_id', $line[$lineID]), 'price_set_id'); + $priceSetId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $line[$lineID]['price_field_id'] ?? NULL, 'price_set_id'); $quickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config'); // Why do we do this? Seems like a like a wrapper for old functionality - but single line price sets & quick // config should be treated the same. @@ -1802,7 +1802,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $submittedValues['total_amount'] = $this->_values['total_amount'] ?? NULL; // Avoid tax amount deduction on edit form and keep it original, because this will lead to error described in CRM-20676 if (!$this->_id) { - $submittedValues['total_amount'] -= CRM_Utils_Array::value('tax_amount', $this->_values, 0); + $submittedValues['total_amount'] -= $this->_values['tax_amount'] ?? 0; } } $this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE); @@ -1990,9 +1990,9 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $contribution->id, ($formValues['option_type'] ?? 0) == 2, $formValues['total_amount'], - CRM_Utils_Array::value('total_amount', $this->_defaults), + $this->_defaults['total_amount'] ?? NULL, $formValues['contribution_status_id'], - CRM_Utils_Array::value('contribution_status_id', $this->_defaults) + $this->_defaults['contribution_status_id'] ?? NULL ); return $contribution; } @@ -2014,7 +2014,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP foreach ($lineItem as $key => $value) { foreach ($value as $v) { if (isset($taxRate[(string) CRM_Utils_Array::value('tax_rate', $v)])) { - $taxRate[(string) $v['tax_rate']] = $taxRate[(string) $v['tax_rate']] + CRM_Utils_Array::value('tax_amount', $v); + $taxRate[(string) $v['tax_rate']] = $taxRate[(string) $v['tax_rate']] + ($v['tax_amount'] ?? 0); } else { if (isset($v['tax_rate'])) { diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index db7d69715b..e79ab0d333 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -513,7 +513,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { //assign cancelSubscription URL to templates $this->assign('cancelSubscriptionUrl', - CRM_Utils_Array::value('cancelSubscriptionUrl', $this->_values) + $this->_values['cancelSubscriptionUrl'] ?? NULL ); $title = $this->_values['frontend_title']; diff --git a/CRM/Contribute/Form/ContributionCharts.php b/CRM/Contribute/Form/ContributionCharts.php index 5b2005f746..666546e0ca 100644 --- a/CRM/Contribute/Form/ContributionCharts.php +++ b/CRM/Contribute/Form/ContributionCharts.php @@ -97,7 +97,7 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form { $abbrMonthNames = CRM_Utils_Date::getAbbrMonthNames(); foreach ($abbrMonthNames as $monthKey => $monthName) { - $val = CRM_Utils_Array::value($monthKey, $chartInfoMonthly['By Month'], 0); + $val = $chartInfoMonthly['By Month'][$monthKey] ?? 0; // don't include zero value month. if (!$val && ($chartType != 'bvg')) { diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index d71efaa43f..03df84064a 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -443,7 +443,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co if (array_key_exists(CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor', 'AuthNet', 'id', 'payment_processor_type_id' ), - CRM_Utils_Array::value('payment_processor', $params) + ($params['payment_processor'] ?? NULL) )) { CRM_Core_Session::setStatus(ts(' Please note that the Authorize.net payment processor only allows recurring contributions and auto-renew memberships with payment intervals from 7-365 days or 1-12 months (i.e. not greater than 1 year).'), '', 'alert'); } @@ -497,8 +497,8 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co $params['recur_frequency_unit'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['recur_frequency_unit']) ); - $params['is_recur_interval'] = CRM_Utils_Array::value('is_recur_interval', $params, FALSE); - $params['is_recur_installments'] = CRM_Utils_Array::value('is_recur_installments', $params, FALSE); + $params['is_recur_interval'] = $params['is_recur_interval'] ?? FALSE; + $params['is_recur_installments'] = $params['is_recur_installments'] ?? FALSE; } if (!empty($params['adjust_recur_start_date'])) { @@ -814,7 +814,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co } if ($deleteAmountBlk) { - $priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : CRM_Utils_Array::value('price_field_other', $params); + $priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : $params['price_field_other'] ?? NULL; if ($priceField) { $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id'); CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0); diff --git a/CRM/Contribute/Form/ContributionPage/Premium.php b/CRM/Contribute/Form/ContributionPage/Premium.php index 7683f3d900..258c4e1cba 100644 --- a/CRM/Contribute/Form/ContributionPage/Premium.php +++ b/CRM/Contribute/Form/ContributionPage/Premium.php @@ -127,8 +127,8 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C $params['id'] = $premiumID; } - $params['premiums_active'] = CRM_Utils_Array::value('premiums_active', $params, FALSE); - $params['premiums_display_min_contribution'] = CRM_Utils_Array::value('premiums_display_min_contribution', $params, FALSE); + $params['premiums_active'] = $params['premiums_active'] ?? FALSE; + $params['premiums_display_min_contribution'] = $params['premiums_display_min_contribution'] ?? FALSE; $params['entity_table'] = 'civicrm_contribution_page'; $params['entity_id'] = $this->_id; diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index c91b6e9ec6..a91499ab6a 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -69,8 +69,8 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $defaults['honoree_profile'] = $ufGroupDAO->id; } $defaults['soft_credit_types'] = [ - CRM_Utils_Array::value('in_honor_of', $soft_credit_types), - CRM_Utils_Array::value('in_memory_of', $soft_credit_types), + $soft_credit_types['in_honor_of'] ?? NULL, + $soft_credit_types['in_memory_of'] ?? NULL, ]; } else { @@ -92,8 +92,8 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $defaults['honoree_profile'] = $ufGroupDAO->id; } $defaults['soft_credit_types'] = [ - CRM_Utils_Array::value('in_honor_of', $soft_credit_types), - CRM_Utils_Array::value('in_memory_of', $soft_credit_types), + $soft_credit_types['in_honor_of'] ?? NULL, + $soft_credit_types['in_memory_of'] ?? NULL, ]; } @@ -311,11 +311,11 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ $params['currency'] = $config->defaultCurrency; } - $params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE); - $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE); - $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); - $params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE); - $params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE); + $params['is_confirm_enabled'] = $params['is_confirm_enabled'] ?? FALSE; + $params['is_share'] = $params['is_share'] ?? FALSE; + $params['is_active'] = $params['is_active'] ?? FALSE; + $params['is_credit_card_only'] = $params['is_credit_card_only'] ?? FALSE; + $params['honor_block_is_active'] = $params['honor_block_is_active'] ?? FALSE; $params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0; $params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']); diff --git a/CRM/Contribute/Form/ContributionPage/ThankYou.php b/CRM/Contribute/Form/ContributionPage/ThankYou.php index f8cc668f07..2b325bc60b 100644 --- a/CRM/Contribute/Form/ContributionPage/ThankYou.php +++ b/CRM/Contribute/Form/ContributionPage/ThankYou.php @@ -100,7 +100,7 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_ $params = $this->controller->exportValues($this->_name); $params['id'] = $this->_id; - $params['is_email_receipt'] = CRM_Utils_Array::value('is_email_receipt', $params, FALSE); + $params['is_email_receipt'] = $params['is_email_receipt'] ?? FALSE; if (!$params['is_email_receipt']) { $params['receipt_from_name'] = NULL; $params['receipt_from_email'] = NULL; diff --git a/CRM/Contribute/Form/ContributionPage/Widget.php b/CRM/Contribute/Form/ContributionPage/Widget.php index 937d7457c3..a8b838cbb4 100644 --- a/CRM/Contribute/Form/ContributionPage/Widget.php +++ b/CRM/Contribute/Form/ContributionPage/Widget.php @@ -241,7 +241,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co $params['id'] = $this->_widget->id; } $params['contribution_page_id'] = $this->_id; - $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE); + $params['is_active'] = $params['is_active'] ?? FALSE; $params['url_homepage'] = 'null'; $widget = new CRM_Contribute_DAO_Widget(); diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index f19d8b5f68..d68c4d3087 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -83,7 +83,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { $values['contribution_page_title'] = ''; if (!empty($values['contribution_page_id'])) { $contribPages = CRM_Contribute_PseudoConstant::contributionPage(NULL, TRUE); - $values['contribution_page_title'] = CRM_Utils_Array::value(CRM_Utils_Array::value('contribution_page_id', $values), $contribPages); + $values['contribution_page_title'] = $contribPages[$values['contribution_page_id']] ?? ''; } // get received into i.e to_financial_account_id from last trxn diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index c43a24be99..f8b885edcb 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -287,12 +287,12 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { $lineItem = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionID); foreach ($lineItem as $taxRate) { if (isset($dataArray[(string) $taxRate['tax_rate']])) { - $dataArray[(string) $taxRate['tax_rate']] = $dataArray[(string) $taxRate['tax_rate']] + CRM_Utils_Array::value('tax_amount', $taxRate); + $dataArray[(string) $taxRate['tax_rate']] = $dataArray[(string) $taxRate['tax_rate']] + ($taxRate['tax_amount'] ?? 0); } else { $dataArray[(string) $taxRate['tax_rate']] = $taxRate['tax_amount'] ?? NULL; } - $subTotal += CRM_Utils_Array::value('subTotal', $taxRate); + $subTotal += $taxRate['subTotal'] ?? 0; } // to email the invoice diff --git a/CRM/Contribute/Form/Task/PDFLetter.php b/CRM/Contribute/Form/Task/PDFLetter.php index 833bc44be9..1718cca1a7 100644 --- a/CRM/Contribute/Form/Task/PDFLetter.php +++ b/CRM/Contribute/Form/Task/PDFLetter.php @@ -241,7 +241,7 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task { $contactIds = array_keys($contacts); // CRM-16725 Skip creation of activities if user is previewing their PDF letter(s) if ($this->isLiveMode()) { - $this->createActivities($html_message, $contactIds, CRM_Utils_Array::value('subject', $formValues, ts('Thank you letter')), CRM_Utils_Array::value('campaign_id', $formValues), $contactHtml); + $this->createActivities($html_message, $contactIds, CRM_Utils_Array::value('subject', $formValues, ts('Thank you letter')), $formValues['campaign_id'] ?? NULL, $contactHtml); } $html = array_diff_key($html, $emailedHtml); diff --git a/CRM/Contribute/Page/ContributionRecur.php b/CRM/Contribute/Page/ContributionRecur.php index 644c4144b9..4236ae3a58 100644 --- a/CRM/Contribute/Page/ContributionRecur.php +++ b/CRM/Contribute/Page/ContributionRecur.php @@ -51,7 +51,7 @@ class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page { } $contributionRecur['payment_processor'] = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessorName( - CRM_Utils_Array::value('payment_processor_id', $contributionRecur) + $contributionRecur['payment_processor_id'] ?? NULL ); $idFields = ['contribution_status_id', 'campaign_id', 'financial_type_id']; foreach ($idFields as $idField) { diff --git a/CRM/Contribute/Page/DashBoard.php b/CRM/Contribute/Page/DashBoard.php index b7df27e2f7..aa8cdbbc41 100644 --- a/CRM/Contribute/Page/DashBoard.php +++ b/CRM/Contribute/Page/DashBoard.php @@ -68,7 +68,7 @@ class CRM_Contribute_Page_DashBoard extends CRM_Core_Page { } //for contribution tabular View - $buildTabularView = CRM_Utils_Array::value('showtable', $_GET, FALSE); + $buildTabularView = $_GET['showtable'] ?? FALSE; $this->assign('buildTabularView', $buildTabularView); if ($buildTabularView) { return; diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index 0f8cffbc51..82da1f2580 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -223,7 +223,7 @@ class CRM_Financial_BAO_Payment { // change status to refunded. self::updateContributionStatus($contribution['id'], 'Refunded'); } - CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], CRM_Utils_Array::value('participant_id', $params), $params['total_amount'], $trxn->currency, $trxn->trxn_date); + CRM_Contribute_BAO_Contribution::recordPaymentActivity($params['contribution_id'], $params['participant_id'] ?? NULL, $params['total_amount'], $trxn->currency, $trxn->trxn_date); return $trxn; } diff --git a/CRM/Financial/Form/BatchTransaction.php b/CRM/Financial/Form/BatchTransaction.php index dee4265809..08870c4883 100644 --- a/CRM/Financial/Form/BatchTransaction.php +++ b/CRM/Financial/Form/BatchTransaction.php @@ -38,7 +38,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form_Search { public function preProcess() { // This reuses some styles from search forms CRM_Core_Resources::singleton()->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header'); - self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : CRM_Utils_Array::value('batch_id', $_POST); + self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ?: $_POST['batch_id'] ?? NULL; $this->assign('entityID', self::$_entityID); if (isset(self::$_entityID)) { $this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id'); diff --git a/CRM/Financial/Form/FinancialAccount.php b/CRM/Financial/Form/FinancialAccount.php index 7878fadb8e..727c2335e3 100644 --- a/CRM/Financial/Form/FinancialAccount.php +++ b/CRM/Financial/Form/FinancialAccount.php @@ -206,7 +206,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { 'is_tax', 'is_default', ] as $field) { - $params[$field] = CRM_Utils_Array::value($field, $params, FALSE); + $params[$field] = $params[$field] ?? FALSE; } $financialAccount = CRM_Financial_BAO_FinancialAccount::writeRecord($params); CRM_Core_Session::setStatus(ts('The Financial Account \'%1\' has been saved.', [1 => $financialAccount->name]), ts('Saved'), 'success'); diff --git a/CRM/Financial/Form/FinancialType.php b/CRM/Financial/Form/FinancialType.php index 2b6f1079dd..4521ca3afc 100644 --- a/CRM/Financial/Form/FinancialType.php +++ b/CRM/Financial/Form/FinancialType.php @@ -122,7 +122,7 @@ class CRM_Financial_Form_FinancialType extends CRM_Core_Form { 'is_reserved', 'is_deductible', ] as $field) { - $params[$field] = CRM_Utils_Array::value($field, $params, FALSE); + $params[$field] = $params[$field] ?? FALSE; } $financialType = civicrm_api3('FinancialType', 'create', $params); if ($this->_action & CRM_Core_Action::UPDATE) { -- 2.25.1