From 312826c67ca563a120c99aedafe5170a32ca2cd0 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 12 Sep 2023 15:43:15 +1200 Subject: [PATCH] Fix a couple more templates to look for elements not a variable that says the element is present --- CRM/Pledge/BAO/PledgeBlock.php | 8 +++----- templates/CRM/Contribute/Form/Contribution/Main.tpl | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CRM/Pledge/BAO/PledgeBlock.php b/CRM/Pledge/BAO/PledgeBlock.php index c26bccc3e6..052a23fbbd 100644 --- a/CRM/Pledge/BAO/PledgeBlock.php +++ b/CRM/Pledge/BAO/PledgeBlock.php @@ -116,6 +116,8 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { * Build Pledge Block in Contribution Pages. * * @param CRM_Core_Form $form + * + * @throws \CRM_Core_Exception */ public static function buildPledgeBlock($form) { //build pledge payment fields. @@ -189,10 +191,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { if (empty($payments)) { throw new CRM_Core_Exception(ts('Oops. It looks like there is no valid payment status for online payment.')); } - else { - $form->assign('is_pledge_payment', TRUE); - $form->addGroup($payments, 'pledge_amount', ts('Make Pledge Payment(s):'), '
'); - } + $form->addGroup($payments, 'pledge_amount', ts('Make Pledge Payment(s):'), '
'); } else { @@ -209,7 +208,6 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $form->addElement('text', 'pledge_installments', ts('Installments'), ['size' => 3, 'aria-label' => ts('Installments')]); if (!empty($pledgeBlock['is_pledge_interval'])) { - $form->assign('is_pledge_interval', CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock)); $form->addElement('text', 'pledge_frequency_interval', NULL, ['size' => 3, 'aria-label' => ts('Frequency Intervals')]); } else { diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 31854354ae..44f138379f 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -101,7 +101,7 @@ {if !$ccid} {crmRegion name='contribution-main-pledge-block'} {if $pledgeBlock} - {if $is_pledge_payment} + {if array_key_exists('pledge_amount', $form)}
{$form.pledge_amount.label} *
{$form.pledge_amount.html}
@@ -112,7 +112,7 @@
 
{$form.is_pledge.html}  - {if $is_pledge_interval} + {if array_key_exists('pledge_frequency_interval', $form)} {$form.pledge_frequency_interval.html}  {/if} {$form.pledge_frequency_unit.html} {ts}for{/ts} {$form.pledge_installments.html} {ts}installments.{/ts} -- 2.25.1