X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FMember%2FForm%2FMembershipBlock.php;h=2dcecf49bf20948b165703e896262263fb23f122;hb=c5c263cabdd47a41f44c6a39a81e212d69616ea1;hp=73a8cb254f528efa72b76d67fb24b8723c878f42;hpb=dd3218d2667655b7d271dbc84b20ee3c0e265704;p=civicrm-core.git diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index 73a8cb254f..2dcecf49bf 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -1,7 +1,7 @@ $pValue) { if ($pValue['html_type'] == 'Radio' && $pValue['name'] == 'membership_amount') { $defaults['mem_price_field_id'] = $pValue['id']; @@ -196,18 +196,17 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa $single = $session->get('singleForm'); if ($single) { $this->addButtons(array( - array( - 'type' => 'next', - 'name' => ts('Save'), - 'spacing' => '         ', - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - ) - ); + array( + 'type' => 'next', + 'name' => ts('Save'), + 'spacing' => '         ', + 'isDefault' => TRUE, + ), + array( + 'type' => 'cancel', + 'name' => ts('Cancel'), + ), + )); } else { parent::buildQuickForm(); @@ -266,12 +265,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 +353,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) {