From 221d6a54da7ac2a732cd807c8d1d039731696f65 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 24 Jul 2023 17:10:01 +1200 Subject: [PATCH] [PHP8.2] Remove undefined property in favour of calc-as-needed This appears to be one of those cases where they wanted to 'save the code the effort' of calculating twice - but it is a trivial calculation balanced against the confusion of setting an undefined property in one place to use later --- CRM/Contribute/Form/Contribution/Main.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index f5ff70097d..0e48c39269 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -1201,7 +1201,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } if (!empty($this->_ccid)) { - $this->set('lineItem', $this->_lineItem); + $this->set('lineItem', [$this->getPriceSetID() => $this->getExistingContributionLineItems()]); } elseif ($priceSetId = CRM_Utils_Array::value('priceSetId', $params)) { $lineItem = []; @@ -1383,8 +1383,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $lineItems = $this->getExistingContributionLineItems(); - // Is this used? - $this->_lineItem[$this->getPriceSetID()] = $lineItems; $this->assign('lineItem', [$this->getPriceSetID() => $lineItems]); $this->assign('is_quick_config', $this->isQuickConfig()); $this->assign('priceSetID', $this->getPriceSetID()); -- 2.25.1