Set default payment method for addt payment or refund
authorlarssandergreen <lars@wildsight.ca>
Thu, 27 Apr 2023 16:37:41 +0000 (10:37 -0600)
committerlarssandergreen <lars@wildsight.ca>
Thu, 27 Apr 2023 16:37:41 +0000 (10:37 -0600)
CRM/Contribute/Form/AdditionalPayment.php
templates/CRM/Contribute/Form/AdditionalPayment.tpl

index 97369550449eb9401b59a2d161107f0a957c9862..5fe2d3ac339a6b81ffc192dff30fd9f614b97038 100644 (file)
@@ -161,6 +161,12 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
 
     // Set $newCredit variable in template to control whether link to credit card mode is included
     $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments());
+
+    $defaults['payment_instrument_id'] = \Civi\Api4\Contribution::get(FALSE)
+      ->addSelect('payment_instrument_id')
+      ->addWhere('id', '=', $this->_contributionId)
+      ->execute()->first()['payment_instrument_id'];
+
     return $defaults;
   }
 
index df7c946dba1910ff741092dc74933228af0b59f3..0c10fe597a35e686d7514db6d4697b0920ed2a27 100644 (file)
@@ -84,9 +84,7 @@
         <table class="form-layout-compressed" >
           <tr class="crm-payment-form-block-trxn_date">
             <td class="label">{$form.trxn_date.label}</td>
-            <td>{$form.trxn_date.html}<br />
-              <span class="description">{ts}The date this payment was received.{/ts}</span>
-            </td>
+            <td>{$form.trxn_date.html}</td>
           </tr>
           <tr class="crm-payment-form-block-payment_instrument_id">
             <td class="label">{$form.payment_instrument_id.label}</td>