From: Coleman Watts Date: Wed, 26 Aug 2015 20:20:15 +0000 (-0400) Subject: CRM-16974 - Disable amounts section of contribution page when enabling member price set X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2d8ae2ae6eb6cd3d31e56953a353c2e8fae198c2;p=civicrm-core.git CRM-16974 - Disable amounts section of contribution page when enabling member price set --- diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index fefe3843d0..12640d1225 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -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) {