Fix notices on credit_card & bank number on Confirm & ThankYou
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 29 Nov 2023 19:43:19 +0000 (08:43 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 29 Nov 2023 19:43:19 +0000 (08:43 +1300)
CRM/Contribute/Form/ContributionBase.php
templates/CRM/Contribute/Form/Contribution/Confirm.tpl
templates/CRM/Contribute/Form/Contribution/ThankYou.tpl

index 9dff9a23622e61008f23b271c427e31164a1d486..fe27e59f2124a54b69691ad28f0945b022d736c3 100644 (file)
@@ -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 ?? []);
   }
 
   /**
index e39176129d35ae69cfa89f746f3b458e9ddd22bf..6147afa37dfdc1b7730c010c2c6eb326c45cefdf 100644 (file)
 
   {* 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)}
       <div class="crm-group credit_card-group">
         {if $paymentFieldsetLabel}
           <div class="header-dark">
             {$paymentFieldsetLabel}
           </div>
         {/if}
-        {if in_array('bank_account_number', $form) && $bank_account_number}
+        {if in_array('bank_account_number', $paymentFields) && $bank_account_number}
           <div class="display-block">
             {ts}Account Holder{/ts}: {$account_holder}<br/>
             {ts}Bank Account Number{/ts}: {$bank_account_number}<br/>
             </div>
           {/if}
         {/if}
-        {if in_array('credit_card_number', $form) && $credit_card_number}
+        {if in_array('credit_card_number', $paymentFields) && $credit_card_number}
           <div class="crm-section no-label credit_card_details-section">
             <div class="content">{$credit_card_type}</div>
             <div class="content">{$credit_card_number}</div>
index 5d6e7943b54f86ba32eabc3678200a123ae541ee..b7322d7480faa141446183be9b9a0efd673542fd 100644 (file)
     </div>
   {/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"}
       <div class="crm-group credit_card-group">
         {if $paymentFieldsetLabel}
             {$paymentFieldsetLabel}
           </div>
         {/if}
-          {if in_array('bank_account_number', $form) && $bank_account_number}
+          {if in_array('bank_account_number', $paymentFields) && $bank_account_number}
           <div class="display-block">
             {ts}Account Holder{/ts}: {$account_holder}<br />
             {ts}Bank Identification Number{/ts}: {$bank_identification_number}<br />