Re-instate the renewal message
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 8 May 2023 04:27:08 +0000 (16:27 +1200)
committerTim Otten <totten@civicrm.org>
Mon, 8 May 2023 20:35:43 +0000 (13:35 -0700)
CRM/Contribute/Form/ContributionBase.php
templates/CRM/Contribute/Form/Contribution/Main.tpl
templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl

index 8ea9c95123aa736cc032e203cfaeba0a4f62815a..1b79b33b3d92cd3fab16044c5b5e1f7156b898f0 100644 (file)
@@ -446,6 +446,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
       $this->set('values', $this->_values);
       $this->set('fields', $this->_fields);
     }
+    $this->assign('isShowMembershipQuickConfigBlock', $this->isShowMembershipQuickConfigBlock());
     $this->set('membershipBlock', $this->getMembershipBlock());
 
     // Handle PCP
@@ -1317,6 +1318,16 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
     return (bool) $this->_useForMember;
   }
 
+  /**
+   * Should the membership block be displayed.
+   *
+   * This should be shown when the price set is quick config and is a membership price set.
+   * @return bool
+   */
+  protected function isShowMembershipQuickConfigBlock(): bool {
+    return CRM_Core_Component::isEnabled('CiviMember') && $this->getMembershipBlock() && $this->isQuickConfig();
+  }
+
   /**
    * Is the contribution page configured for 2 payments, one being membership & one not.
    *
index a7ee32e09e5eb1db14e451b97dbc01d5f512308e..3a0c541a7e33f3b430d96b9177a65bfd02d0a3d8 100644 (file)
@@ -76,7 +76,7 @@
       <div class="help">{ts}You have a current Lifetime Membership which does not need to be renewed.{/ts}</div>
     {/if}
 
-    {if !empty($useForMember) && !$ccid}
+    {if $isShowMembershipQuickConfigBlock && !$ccid}
       <div class="crm-public-form-item crm-section">
         {include file="CRM/Contribute/Form/Contribution/MembershipBlock.tpl" context="makeContribution"}
       </div>
index 4ad6d4ad8280c18476ed2da26cc0edaca5657a73..fd70bbe2495630e2227a7fa721a8054c833b0623 100644 (file)
@@ -7,7 +7,7 @@
  | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
 *}
-{if !empty($useForMember) AND !$is_quick_config}
+{if $isShowMembershipQuickConfigBlock}
   <div id="membership" class="crm-group membership-group">
     {if $context EQ "makeContribution"}
       <div id="priceset">