CRM/Contribute - Refactor unnecessary uses of CRM_Utils_Array::value
authorcolemanw <coleman@civicrm.org>
Fri, 13 Oct 2023 23:41:54 +0000 (19:41 -0400)
committercolemanw <coleman@civicrm.org>
Mon, 16 Oct 2023 21:37:54 +0000 (17:37 -0400)
22 files changed:
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/ContributionSoft.php
CRM/Contribute/BAO/FinancialProcessor.php
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/ContributionCharts.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ContributionPage/Premium.php
CRM/Contribute/Form/ContributionPage/Settings.php
CRM/Contribute/Form/ContributionPage/ThankYou.php
CRM/Contribute/Form/ContributionPage/Widget.php
CRM/Contribute/Form/ContributionView.php
CRM/Contribute/Form/Task/Invoice.php
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Contribute/Page/ContributionRecur.php
CRM/Contribute/Page/DashBoard.php
CRM/Financial/BAO/Payment.php
CRM/Financial/Form/BatchTransaction.php
CRM/Financial/Form/FinancialAccount.php
CRM/Financial/Form/FinancialType.php

index ffecfa20329c27ddb5a27d6f3bf3c8fd8adab1e0..a04da212f21ceed1deb6daea3579f61519e90578 100644 (file)
@@ -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'],
       ];
     }
index 72fec24e84372f1b39c2ec41984ee0adee599a02..a2a5ce289d62a2d4828dcd3533bc77a14ee39000 100644 (file)
@@ -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);
           }
         }
index 797d3dce9bf58178dd8a939b5a6c77a73461bd04..2a2885c95f3415cfc0c10cef94a380dc46dcb936 100644 (file)
@@ -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);
index 475caa8165cc7db90661226007f636fae6992009..73056b55dafef88e30086e1a443df8b4f4b3781e 100644 (file)
@@ -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;
index 68e86322e4a1672d45c7621bfb6a21270111bcaa..6b9b5472ef3c8ff348d043a749b5bed4305130d8 100644 (file)
@@ -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;
   }
index 3deaec2b7eb4fc21291b8cf14144e9ec195d5052..8cef2dc7ebdb7097996447e3f6710cee2fc4e5be 100644 (file)
@@ -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'])) {
index db7d69715be041922b9ae655c0261f73c567ad98..e79ab0d3335e36a404379f919f41387966d5e108 100644 (file)
@@ -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'];
index 5b2005f7464186e9cd1dfa89799ee1113ed8c166..666546e0ca81c8ae0e5c2b6ae4ee4fc70e2779ea 100644 (file)
@@ -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')) {
index d71efaa43f6b66022da89e8e6acdf0de31a02ba2..03df84064adebaedb978280aae5f24c5de370967 100644 (file)
@@ -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);
index 7683f3d90015b1aa8cb8acc8b47e7927321940a1..258c4e1cbafe5c5842604184f5f2d281048eec01 100644 (file)
@@ -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;
 
index c91b6e9ec64afb4c338c7203a4ff74b17523f2b3..a91499ab6a5ff2846451087dacba027f909ee1c2 100644 (file)
@@ -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']);
 
index f8cc668f07015c60061073306661c2b8b0c91240..2b325bc60b61234b6790217ed52a57d5c71b2c1c 100644 (file)
@@ -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;
index 937d7457c35a43236c50ec980e6375235353fa5e..a8b838cbb4bce5400dd79304ea7b945e9bc13899 100644 (file)
@@ -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();
index f19d8b5f68185b2c30e7a51ce82a7d260591bb0e..d68c4d30876da0937fa7622b3b728e26095e6d06 100644 (file)
@@ -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
index c43a24be99b1702569833b7221f05f0e15bcea46..f8b885edcbb6885a12acb190be8177e1762faf0b 100644 (file)
@@ -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
index 833bc44be9a455eb38a604d20932e965804d317f..1718cca1a701f6b4104e48332c76071e8476519a 100644 (file)
@@ -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);
 
index 644c4144b9767190e4835ba69e80e7998a595c70..4236ae3a582ae08845447203741e53c0483acb5a 100644 (file)
@@ -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) {
index b7df27e2f79da5750a5684443cce67ea97d0da87..aa8cdbbc413df36175391074c8d05fbeff134199 100644 (file)
@@ -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;
index 0f8cffbc5147a158f420abdaf5ed8d6c678a5cc5..82da1f25805b9403f923c723586c8610b5aa2b37 100644 (file)
@@ -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;
   }
 
index dee4265809c09cd5bb91f8566bb8fc9aa6751b78..08870c4883e980226b9466c516e6d53b665d872f 100644 (file)
@@ -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');
index 7878fadb8e4b90deab9b982803e3dee631b06a51..727c2335e3451c2dee677a0b797b444cffebeae7 100644 (file)
@@ -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');
index 2b6f1079dde33c392c54ca2ac0675c07730a1ae6..4521ca3afc41fb62ca76540a376457f326230ca8 100644 (file)
@@ -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) {