From 4d7f3ee5afe1ab23f1db36928fff67dfb98dcdba Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 22 Nov 2023 08:52:23 +1300 Subject: [PATCH] Standardise a couple of calls to get values from the line items --- CRM/Contribute/Form/Contribution/Confirm.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 88bed9766c..edf0bec8b7 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -206,18 +206,17 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * @param array $params * @param CRM_Financial_BAO_FinancialType $financialType * @param bool $online - * @param CRM_Contribute_Form_Contribution_Confirm $form * * @return array */ - private function getNonDeductibleAmount($params, $financialType, $online, $form) { + private function getNonDeductibleAmount($params, $financialType, $online) { if (isset($params['non_deductible_amount']) && (!empty($params['non_deductible_amount']))) { return $params['non_deductible_amount']; } $priceSetId = $params['priceSetId'] ?? NULL; // return non-deductible amount if it is set at the price field option level - if ($priceSetId && !empty($form->_lineItem)) { - $nonDeductibleAmount = CRM_Price_BAO_PriceSet::getNonDeductibleAmountFromPriceSet($priceSetId, $form->_lineItem); + if ($priceSetId && !empty($this->getLineItems())) { + $nonDeductibleAmount = CRM_Price_BAO_PriceSet::getNonDeductibleAmountFromPriceSet($priceSetId, [$this->getPriceSetID() => $this->getLineItems()]); } if (!empty($nonDeductibleAmount)) { @@ -1554,7 +1553,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } } - $this->assign('lineItem', $this->isQuickConfig() ? NULL : $this->getLineItems()); + $this->assign('lineItem', $this->isQuickConfig() ? NULL : [$this->getPriceSetID() => $this->getLineItems()]); if (!empty($errors)) { $message = $this->compileErrorMessage($errors); @@ -2235,7 +2234,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $paymentParams['skipLineItem'] = 0; if (!isset($paymentParams['line_item'])) { - $paymentParams['line_item'] = $this->_lineItem; + $paymentParams['line_item'] = [$this->getPriceSetID() => $this->getLineItems()]; } if (!empty($paymentParams['onbehalf']) && @@ -2410,8 +2409,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr foreach ($this->_values['fee'] as $key => $feeValues) { if ($feeValues['name'] == 'membership_amount') { $fieldId = $this->_params['price_' . $key]; - $membershipLineItems[$this->_priceSetId][$fieldId] = $this->_lineItem[$this->_priceSetId][$fieldId]; unset($this->_lineItem[$this->_priceSetId][$fieldId]); + $membershipLineItems[$this->_priceSetId][$fieldId] = $this->getLineItems()[$fieldId]; break; } } -- 2.25.1