dev/core#5007 Fix failure to assign default membership to quick config price set
authoreileen <emcnaughton@wikimedia.org>
Thu, 15 Feb 2024 23:16:10 +0000 (12:16 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 15 Feb 2024 23:20:37 +0000 (12:20 +1300)
CRM/Contribute/Form/Contribution/Main.php

index 04279378a74e38a44143accd47fe98d4b21172ca..bbdb41256b2aab4780030f8c6c11b63aea8695d4 100644 (file)
@@ -242,7 +242,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
 
     $memtypeID = NULL;
     if ($this->_priceSetId) {
-      if ($this->isMembershipPriceSet()) {
+      if ($this->getFormContext() === 'membership') {
         $selectedCurrentMemTypes = [];
         foreach ($this->_priceSet['fields'] as $key => $val) {
           foreach ($val['options'] as $keys => $values) {
@@ -926,6 +926,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         $errors["price_{$otherAmount}"] = ts('Amount is required field.');
       }
 
+      // @todo - this should probably be $this->getFormContext() === 'membership'
+      // which would make it apply to quick config & non quick config.
+      // See https://lab.civicrm.org/dev/core/-/issues/3314
       if ($self->isMembershipPriceSet() && !empty($check) && $membershipIsActive) {
         $priceFieldIDS = [];
         $priceFieldMemTypes = [];