$this->freeze();
$this->addElement('button', 'done', ts('Done'), array('onclick' => "location.href='civicrm/admin/custom/group?reset=1&action=browse'"));
}
+
+ // don't show option for contribution amounts section if membership price set
+ // this flag is sent to template
+
+ $membershipBlock = new CRM_Member_DAO_MembershipBlock();
+ $membershipBlock->entity_table = 'civicrm_contribution_page';
+ $membershipBlock->entity_id = $this->_id;
+ $membershipBlock->is_active = 1;
+ $hasMembershipBlk = FALSE;
+ if ($membershipBlock->find(TRUE) &&
+ ($setID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, NULL, 1))
+ ) {
+ $extends = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $setID, 'extends');
+ if ($extends && $extends == CRM_Core_Component::getComponentID('CiviMember')) {
+ $hasMembershipBlk = TRUE;
+ }
+ }
+ // set value in DOM that membership price set exists
+ CRM_Core_Resources::singleton()->addSetting(array('memberPriceset' => $hasMembershipBlk));
}
/**
if ( ! amount_block[0].checked || priceSetID ) {
if ( !priceSetID ) {
cj('#priceSet').hide();
+ if (CRM.memberPriceset) {
+ cj(".crm-contribution-contributionpage-amount-form-block-amount_block_is_active td").html('<span class="description">{/literal}{ts}You cannot enable the Contribution Amounts section when a Membership Price Set is in use. (See the Memberships tab above.) Membership Price Sets may include additional fields for non-membership options that require an additional fee (e.g. magazine subscription) or an additional voluntary contribution.</span>{/ts}{literal}');
+ }
}
cj('#amountFields').hide();
- }
+ }
cj(function() {
payLater('is_pay_later');