From aca3b506837ec61cf74b454a2611d38bbc334196 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 8 May 2023 16:27:08 +1200 Subject: [PATCH] Re-instate the renewal message --- CRM/Contribute/Form/ContributionBase.php | 11 +++++++++++ templates/CRM/Contribute/Form/Contribution/Main.tpl | 2 +- .../Contribute/Form/Contribution/MembershipBlock.tpl | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 8ea9c95123..1b79b33b3d 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -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. * diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index a7ee32e09e..3a0c541a7e 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -76,7 +76,7 @@
{ts}You have a current Lifetime Membership which does not need to be renewed.{/ts}
{/if} - {if !empty($useForMember) && !$ccid} + {if $isShowMembershipQuickConfigBlock && !$ccid}
{include file="CRM/Contribute/Form/Contribution/MembershipBlock.tpl" context="makeContribution"}
diff --git a/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl b/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl index 4ad6d4ad82..fd70bbe249 100644 --- a/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl +++ b/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl @@ -7,7 +7,7 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if !empty($useForMember) AND !$is_quick_config} +{if $isShowMembershipQuickConfigBlock}
{if $context EQ "makeContribution"}
-- 2.25.1