X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FMember%2FForm%2FMembershipBlock.php;h=2dcecf49bf20948b165703e896262263fb23f122;hb=c5c263cabdd47a41f44c6a39a81e212d69616ea1;hp=af6a018766dcb368c6492983285c033da5407b92;hpb=f85b80630e8324121dcdef2d7aacd432946b541f;p=civicrm-core.git diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index af6a018766..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(); @@ -231,7 +230,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa if (!empty($params['member_price_set_id'])) { //check if this price set has membership type both auto-renew and non-auto-renew memberships. - $bothTypes = CRM_Price_BAO_PriceSet::checkMembershipPriceSet($params['member_price_set_id']); + $bothTypes = CRM_Price_BAO_PriceSet::isMembershipPriceSetContainsMixOfRenewNonRenew($params['member_price_set_id']); //check for supporting payment processors //if both auto-renew and non-auto-renew memberships @@ -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) {