From 2e285c870b33ab931dafc111ade7a7be454e9eb6 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 5 Jun 2023 19:52:49 +1200 Subject: [PATCH] PriceSet forms - remove reference to undeclared _contributionAmount property I don't find this value anywhere in our universe outside this function - which implies it should be not be a property - especially for php 8,x reasons. In fact it really just is a case of checking if field_name is contribution_amount at the right places. I didn't include it in the place where it would read if field_name = x AND field_name <> y.... --- CRM/Price/BAO/PriceField.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 9ff1d0cc93..554e097e0b 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -273,11 +273,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $currencyName = $config->defaultCurrency; if (!isset($label)) { - $label = (!empty($qf->_membershipBlock) && $field->name == 'contribution_amount') ? ts('Additional Contribution') : $field->label; - } - - if ($field->name === 'contribution_amount') { - $qf->_contributionAmount = 1; + $label = (!empty($qf->_membershipBlock) && $field->name === 'contribution_amount') ? ts('Additional Contribution') : $field->label; } if (isset($qf->_online) && $qf->_online) { @@ -313,13 +309,13 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { ]); $extra = []; - if (!empty($qf->_membershipBlock) && $isQuickConfig && $field->name == 'other_amount' && empty($qf->_contributionAmount)) { + if (!empty($qf->_membershipBlock) && $isQuickConfig && $field->name == 'other_amount') { $useRequired = 0; } elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label. $label = $fieldOptions[$optionKey]['label']; - if ($isQuickConfig && !empty($qf->_contributionAmount) && strtolower($fieldOptions[$optionKey]['name']) == 'other_amount') { + if ($isQuickConfig && $field->name === 'contribution_amount' && strtolower($fieldOptions[$optionKey]['name']) == 'other_amount') { $label .= ' ' . $currencySymbol; $qf->assign('priceset', $elementName); $extra = [ @@ -365,7 +361,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { case 'Radio': $choice = []; - if ($isQuickConfig && !empty($qf->_contributionAmount)) { + if ($isQuickConfig && $field->name === 'contribution_amount') { $qf->assign('contriPriceset', $elementName); } -- 2.25.1