CRM-16974 - Disable amounts section of contribution page when enabling member price set
authorColeman Watts <coleman@civicrm.org>
Wed, 26 Aug 2015 20:20:15 +0000 (16:20 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 26 Aug 2015 20:20:15 +0000 (16:20 -0400)
CRM/Member/Form/MembershipBlock.php

index fefe3843d0d4eddcae70c9013c0d7b4e28e8496c..12640d12252a473f5434be38b95fb7dbfd30113f 100644 (file)
@@ -266,12 +266,6 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         }
       }
 
-      if ($contributionPageId && !empty($params['member_price_set_id']) &&
-        CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')
-      ) {
-        $errors['member_price_set_id'] = ts('You cannot use Membership Price Sets with the Contribution Amounts section. However, a membership price set may include additional fields for non-membership options that requires an additional fee (e.g. magazine subscription) or an additional voluntary contribution.');
-      }
-
       if (!empty($params['member_price_set_id'])) {
         return $errors;
       }
@@ -360,6 +354,10 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         }
       }
 
+      if ($this->_id && !empty($params['member_price_set_id'])) {
+        CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'amount_block_is_active', 0);
+      }
+
       // check for price set.
       $priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
       if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) {