From: Eileen McNaughton Date: Wed, 29 Nov 2023 19:43:19 +0000 (+1300) Subject: Fix notices on credit_card & bank number on Confirm & ThankYou X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e4ea0929229bc91138de666a1522e2c22359c0e4;p=civicrm-core.git Fix notices on credit_card & bank number on Confirm & ThankYou --- diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 9dff9a2362..fe27e59f21 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -1020,7 +1020,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { public function assignPaymentFields() { //fix for CRM-3767 $isMonetary = FALSE; - if ($this->_amount > 0.0) { + if ($this->order->getTotalAmount() > 0.0) { $isMonetary = TRUE; } elseif (!empty($this->_params['selectMembership'])) { @@ -1064,9 +1064,8 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } } $this->assign('paymentFieldsetLabel', CRM_Core_Payment_Form::getPaymentLabel($paymentProcessorObject)); - $this->assign('paymentFields', $paymentFields); - } + $this->assign('paymentFields', $paymentFields ?? []); } /** diff --git a/templates/CRM/Contribute/Form/Contribution/Confirm.tpl b/templates/CRM/Contribute/Form/Contribution/Confirm.tpl index e39176129d..6147afa37d 100644 --- a/templates/CRM/Contribute/Form/Contribution/Confirm.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Confirm.tpl @@ -231,14 +231,14 @@ {* Show credit or debit card section for 'direct' mode, except for PayPal Express (detected because credit card number is empty) *} {crmRegion name="contribution-confirm-billing-block"} - {if in_array('credit_card_number', $form) || in_array('bank_account_number', $form)} + {if in_array('credit_card_number', $paymentFields) || in_array('bank_account_number', $paymentFields)}
{if $paymentFieldsetLabel}
{$paymentFieldsetLabel}
{/if} - {if in_array('bank_account_number', $form) && $bank_account_number} + {if in_array('bank_account_number', $paymentFields) && $bank_account_number}
{ts}Account Holder{/ts}: {$account_holder}
{ts}Bank Account Number{/ts}: {$bank_account_number}
@@ -256,7 +256,7 @@
{/if} {/if} - {if in_array('credit_card_number', $form) && $credit_card_number} + {if in_array('credit_card_number', $paymentFields) && $credit_card_number}
{$credit_card_type}
{$credit_card_number}
diff --git a/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl b/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl index 5d6e7943b5..b7322d7480 100644 --- a/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl +++ b/templates/CRM/Contribute/Form/Contribution/ThankYou.tpl @@ -273,7 +273,7 @@
{/if} - {if in_array('credit_card_number', $form) || in_array('bank_account_number', $form) && ($amount GT 0 OR $minimum_fee GT 0)} + {if in_array('credit_card_number', $paymentFields) || in_array('bank_account_number', $paymentFields) && ($amount GT 0 OR $minimum_fee GT 0)} {crmRegion name="contribution-thankyou-billing-block"}
{if $paymentFieldsetLabel} @@ -281,7 +281,7 @@ {$paymentFieldsetLabel}
{/if} - {if in_array('bank_account_number', $form) && $bank_account_number} + {if in_array('bank_account_number', $paymentFields) && $bank_account_number}
{ts}Account Holder{/ts}: {$account_holder}
{ts}Bank Identification Number{/ts}: {$bank_identification_number}