Skip to content

Commit

Permalink
Merge pull request #32050 from colemanw/contDep
Browse files Browse the repository at this point in the history
[REF] CiviContribute - Refactor out uses of deprecated CRM_Utils_Array::value
  • Loading branch information
eileenmcnaughton authored Feb 11, 2025
2 parents 0b4bf58 + c7aca01 commit c282913
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
5 changes: 1 addition & 4 deletions CRM/Batch/Form/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,7 @@ private function processContribution(array &$params): bool {
[$products, $options] = CRM_Contribute_BAO_Premium::getPremiumProductInfo();

$value['hidden_Premium'] = 1;
$value['product_option'] = CRM_Utils_Array::value(
$value['product_name'][1],
$options[$value['product_name'][0]]
);
$value['product_option'] = $options[$value['product_name'][0]][$value['product_name'][1]] ?? NULL;

$premiumParams = [
'product_id' => $value['product_name'][0],
Expand Down
5 changes: 1 addition & 4 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,10 +1224,7 @@ protected function processCreditCard($submittedValues, $lineItem, $contactID) {
// @todo - stop setting amount level in this function - use $this->order->getAmountLevel()
$this->_params['amount_level'] = 0;
$this->_params['description'] = ts("Contribution submitted by a staff person using contributor's credit card");
$this->_params['currencyID'] = CRM_Utils_Array::value('currency',
$this->_params,
CRM_Core_Config::singleton()->defaultCurrency
);
$this->_params['currencyID'] = $this->_params['currency'] ?? CRM_Core_Config::singleton()->defaultCurrency;

$this->_params['pcp_display_in_roll'] = $params['pcp_display_in_roll'] ?? NULL;
$this->_params['pcp_roll_nickname'] = $params['pcp_roll_nickname'] ?? NULL;
Expand Down
8 changes: 2 additions & 6 deletions CRM/Contribute/Form/ContributionPage/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,8 @@ public function postProcess() {
foreach ($pledgeBlock as $key) {
$pledgeBlockParams[$key] = $params[$key] ?? NULL;
}
$pledgeBlockParams['is_pledge_interval'] = CRM_Utils_Array::value('is_pledge_interval',
$params, FALSE
);
$pledgeBlockParams['pledge_start_date'] = CRM_Utils_Array::value('pledge_start_date',
$params, FALSE
);
$pledgeBlockParams['is_pledge_interval'] = $params['is_pledge_interval'] ?? FALSE;
$pledgeBlockParams['pledge_start_date'] = $params['pledge_start_date'] ?? FALSE;
// create pledge block.
CRM_Pledge_BAO_PledgeBlock::create($pledgeBlockParams);
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Financial/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public static function getFinancialTransactionsList() {
);
}
if ($financialItem->contact_id) {
$row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(!empty($row[$financialItem->id]['contact_sub_type']) ? $row[$financialItem->id]['contact_sub_type'] : CRM_Utils_Array::value('contact_type', $row[$financialItem->id]), FALSE, $financialItem->contact_id);
$row[$financialItem->id]['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage(!empty($row[$financialItem->id]['contact_sub_type']) ? $row[$financialItem->id]['contact_sub_type'] : ($row[$financialItem->id]['contact_type'] ?? NULL), FALSE, $financialItem->contact_id);
}
// @todo: Is this right? Shouldn't it be adding to the array as we loop?
$financialitems = $row;
Expand Down

0 comments on commit c282913

Please sign in to comment.