From 11816755e4b7a40333db579c78e577d735f0e986 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 24 Oct 2023 12:03:01 +1300 Subject: [PATCH] Further recent regression fix --- CRM/Contribute/Form/Contribution.php | 3 --- CRM/Financial/BAO/Order.php | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 39ac9d91cb16..dca9336472f2 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -946,9 +946,6 @@ public function buildQuickForm() { */ private function buildPriceSet($form, $component = NULL, $validFieldsOnly = TRUE): void { $priceSetId = $this->getPriceSetID(); - - $priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId, TRUE, $validFieldsOnly); - $form->_priceSet = $priceSet[$priceSetId] ?? NULL; $validPriceFieldIds = array_keys($form->_priceSet['fields']); // @todo - this code is from previously shared function - can probaly go. diff --git a/CRM/Financial/BAO/Order.php b/CRM/Financial/BAO/Order.php index 7f05c741c3fc..80ef1d33d2fd 100644 --- a/CRM/Financial/BAO/Order.php +++ b/CRM/Financial/BAO/Order.php @@ -683,10 +683,10 @@ protected function setPriceFieldMetadata(array $metadata): void { if (!empty($option['membership_type_id'])) { $membershipType = CRM_Member_BAO_MembershipType::getMembershipType((int) $option['membership_type_id']); $metadata[$index]['options'][$optionID]['auto_renew'] = (int) $membershipType['auto_renew']; - if ($membershipType['auto_renew'] && empty($this->priceSetMetadata['auto_renew_membership_type'])) { + if ($membershipType['auto_renew'] && empty($this->priceSetMetadata['auto_renew_membership_field'])) { // Quick form layer supports one auto-renew membership type per price set. If we // want more for any reason we can add another array property. - $this->priceSetMetadata['auto_renew_membership_type'] = (int) $option['membership_type_id']; + $this->priceSetMetadata['auto_renew_membership_field'] = (int) $option['membership_type_id']; } } } @@ -711,6 +711,7 @@ public function getPriceSetMetadata(): array { if (empty($this->priceSetMetadata)) { $this->priceSetMetadata = CRM_Price_BAO_PriceSet::getCachedPriceSetDetail($this->getPriceSetID()); $this->priceSetMetadata['id'] = $this->getPriceSetID(); + $this->priceSetMetadata['auto_renew_membership_field'] = NULL; $this->setPriceFieldMetadata($this->priceSetMetadata['fields']); unset($this->priceSetMetadata['fields']); }