From: Eileen McNaughton Date: Mon, 20 Nov 2023 05:54:41 +0000 (+1300) Subject: Replace undefined property _currentMemberships with a define X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=64407f452dbced7f8300009a4fffed9ab9745891;p=civicrm-core.git Replace undefined property _currentMemberships with a define --- diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 90d939c4b1..1c8f7ecdf3 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -214,7 +214,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $entityId = $memtypeID = NULL; if ($this->_priceSetId) { - if (($this->isMembershipPriceSet() && !empty($this->_currentMemberships)) || $this->_defaultMemTypeId) { + if (($this->isMembershipPriceSet() && !$this->isDefined('CurrentMembership')) || $this->_defaultMemTypeId) { $selectedCurrentMemTypes = []; foreach ($this->_priceSet['fields'] as $key => $val) { foreach ($val['options'] as $keys => $values) { @@ -230,7 +230,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu break; } elseif ($opMemTypeId && - in_array($opMemTypeId, $this->_currentMemberships) && + in_array($opMemTypeId, $this->lookup('CurrentMembership', 'membership_type_id')) && !in_array($opMemTypeId, $selectedCurrentMemTypes) ) { CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults); @@ -606,7 +606,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $separateMembershipPayment = FALSE; $this->addOptionalQuickFormElement('auto_renew'); if ($this->_membershipBlock) { - $this->_currentMemberships = []; $membershipTypeIds = $membershipTypes = $radio = $radioOptAttrs = []; // This is always true if this line is reachable - remove along with the upcoming if. @@ -697,7 +696,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu continue; } $this->assign('renewal_mode', TRUE); - $this->_currentMemberships[$membership['membership_type_id']] = $membership['membership_type_id']; + $this->define('Membership', 'CurrentMembership', $membership); $memType['current_membership'] = $membership['end_date']; if (!$endDate) { $endDate = $memType['current_membership'];