From b865b4839d2a0eb2de6862580734222df5692c6b Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Fri, 26 May 2023 18:14:49 -0600 Subject: [PATCH] Clean up Additional Payment Form --- CRM/Contribute/Form/AdditionalPayment.php | 13 +++++++++---- templates/CRM/Contribute/Form/AdditionalPayment.tpl | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 1bca1e5259..f2247c0969 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -152,10 +152,12 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $defaults['trxn_date'] = date('Y-m-d H:i:s'); } - if ($this->isARefund() && $this->amountDue < 0) { - $defaults['total_amount'] = CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency(abs($this->amountDue)); + if ($this->isARefund()) { + if ($this->amountDue < 0) { + $defaults['total_amount'] = CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency(abs($this->amountDue)); + } } - elseif ($this->_owed && $this->amountDue > 0) { + elseif ($this->_owed) { $defaults['total_amount'] = CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency($this->_owed); } @@ -244,9 +246,12 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $attributes['fee_amount'] ); $this->addRule('fee_amount', ts('Please enter a valid monetary value for Fee Amount.'), 'money'); + $buttonName = $this->isARefund() ? ts('Record Refund') : ts('Record Payment'); + } + else { + $buttonName = ts('Submit Payment'); } - $buttonName = $this->isARefund() ? ts('Record Refund') : ts('Record Payment'); $this->addButtons([ [ 'type' => 'upload', diff --git a/templates/CRM/Contribute/Form/AdditionalPayment.tpl b/templates/CRM/Contribute/Form/AdditionalPayment.tpl index 0c10fe597a..3a6b3e8b7f 100644 --- a/templates/CRM/Contribute/Form/AdditionalPayment.tpl +++ b/templates/CRM/Contribute/Form/AdditionalPayment.tpl @@ -53,7 +53,7 @@ {$form.total_amount.label} - {$form.currency.html|crmAddClass:eight} {$form.total_amount.html|crmAddClass:eight}  {if $paymentType EQ 'refund' || $paymentAmt < 0}{ts}Refund Due : {$absolutePaymentAmount|crmMoney} {/ts}{else}{ts}Balance Owed{/ts} : {$paymentAmt|crmMoney}{/if} + {$form.currency.html|crmAddClass:eight} {$form.total_amount.html|crmAddClass:eight}  {if $paymentAmt < 0}{ts}Refund Due : {$absolutePaymentAmount|crmMoney} {/ts}{else}{ts}Balance Owed{/ts} : {$paymentAmt|crmMoney}{/if} {if $email and $outBound_option != 2} -- 2.25.1