From: Eileen McNaughton Date: Fri, 19 May 2023 02:47:39 +0000 (+1200) Subject: dev/core#4282 Fix isShowMembershipBlock X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dfc5fb948b0cb11947b3b75131b54b1c365f08b1;p=civicrm-core.git dev/core#4282 Fix isShowMembershipBlock As determined by Konadave & myself this isShowMembershipBlock was always true when memberships were in play in 5.60 - despite various code comments. I have renamed & assigned it regardless of QuickConfig. Since it is a condition of including the tpl & within it it already checks the context I made the context check the top level check & removed the isShowMembershipBlock check --- diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 1d41e1ae54..fb6f61e3e7 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -446,7 +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->assign('isShowMembershipBlock', $this->isShowMembershipBlock()); $this->set('membershipBlock', $this->getMembershipBlock()); // Handle PCP @@ -1327,11 +1327,15 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { /** * Should the membership block be displayed. * - * This should be shown when the price set is quick config and is a membership price set. + * This should be shown when a membership is available to purchase. + * + * It could be a quick config price set or a standard price set that extends + * CiviMember. + * * @return bool */ - protected function isShowMembershipQuickConfigBlock(): bool { - return CRM_Core_Component::isEnabled('CiviMember') && $this->getMembershipBlock() && $this->isQuickConfig(); + protected function isShowMembershipBlock(): bool { + return CRM_Core_Component::isEnabled('CiviMember') && $this->getMembershipBlock(); } /** diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 3a0c541a7e..e1d71b5d91 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 $isShowMembershipQuickConfigBlock && !$ccid} + {if $isShowMembershipBlock && !$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 fd70bbe249..848e2d73d7 100644 --- a/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl +++ b/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl @@ -7,9 +7,9 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{if $isShowMembershipQuickConfigBlock} +{if $context EQ "makeContribution"}
- {if $context EQ "makeContribution"} +
{if $renewal_mode} @@ -61,7 +61,7 @@
{include file="CRM/Price/Page/LineItem.tpl" context="Membership"}
- {/if} +
{literal}