summaryrefslogtreecommitdiff
path: root/httemplate/view
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-02-05 15:16:12 -0600
committerJonathan Prykop <jonathan@freeside.biz>2016-02-23 08:35:56 -0600
commit1bb85d2484b3d9f45c2b1142951503ff1c54e2e9 (patch)
treefb77f0b5d02a031859afbf1e4e72700b619422ed /httemplate/view
parent7d44517cf03a15c0b65b77c01720f3758374af22 (diff)
RT#39586 Manual check refunds cannot be unapplied
Diffstat (limited to 'httemplate/view')
-rw-r--r--httemplate/view/cust_main/payment_history/credit.html25
-rw-r--r--httemplate/view/cust_main/payment_history/payment.html24
2 files changed, 33 insertions, 16 deletions
diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html
index db2e5e582..85911a03f 100644
--- a/httemplate/view/cust_main/payment_history/credit.html
+++ b/httemplate/view/cust_main/payment_history/credit.html
@@ -139,14 +139,23 @@ $void = ' ('.
&& $opt{'Void credit'};
my $unapply = '';
-$unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->crednum,
- emt('Are you sure you want to unapply this credit?'),
- '',
- emt('unapply')
- )
- if $cust_credit->closed !~ /^Y/i
- && scalar(@cust_credit_bill)
- && $opt{'Unapply credit'};
+
+if ($opt{'Unapply credit'} && !$cust_credit->closed) {
+ my $refund_to_unapply = $cust_credit->refund_to_unapply;
+ my $usepre = $refund_to_unapply && @cust_credit_bill;
+ $unapply = areyousure_link("${p}misc/unapply-cust_credit.cgi?".$cust_credit->crednum,
+ emt('Are you sure you want to unapply this credit from invoices?'),
+ emt('Keep this credit, but dissociate it from the invoices it is currently applied against'),
+ emt('unapply') . ($usepre ? '&nbsp;' . emt('invoices') : '')
+ )
+ if @cust_credit_bill;
+ $unapply .= areyousure_link("${p}misc/unapply-cust_credit_refund.cgi?".$cust_credit->crednum,
+ emt('Are you sure you want to unapply this credit from refunds?'),
+ emt('Keep this credit, but dissociate it from the refunds it is currently applied to'),
+ emt('unapply') . ($usepre ? '&nbsp;' . emt('refunds') : '')
+ )
+ if $refund_to_unapply;
+}
my $reason = $cust_credit->reason;
$reason = $reason ? " ($reason)" : '';
diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html
index 6c93f7b27..16b91c2f2 100644
--- a/httemplate/view/cust_main/payment_history/payment.html
+++ b/httemplate/view/cust_main/payment_history/payment.html
@@ -197,13 +197,21 @@ $void = ' ('.
);
my $unapply = '';
-$unapply = areyousure_link("${p}misc/unapply-cust_pay.cgi?".$cust_pay->paynum,
- emt('Are you sure you want to unapply this payment?'),
- emt('Keep this payment, but dissociate it from the invoices it is currently applied against'),
- emt('unapply')
- )
- if $cust_pay->closed !~ /^Y/i
- && scalar(@cust_bill_pay)
- && $opt{'Unapply payment'};
+if ($opt{'Unapply payment'} && !$cust_pay->closed) {
+ my $refund_to_unapply = $cust_pay->refund_to_unapply;
+ my $usepre = $refund_to_unapply && @cust_bill_pay;
+ $unapply = areyousure_link("${p}misc/unapply-cust_pay.cgi?".$cust_pay->paynum,
+ emt('Are you sure you want to unapply this payment from invoices?'),
+ emt('Keep this payment, but dissociate it from the invoices it is currently applied against'),
+ emt('unapply') . ($usepre ? '&nbsp;' . emt('invoices') : '')
+ )
+ if @cust_bill_pay;
+ $unapply .= areyousure_link("${p}misc/unapply-cust_pay_refund.cgi?".$cust_pay->paynum,
+ emt('Are you sure you want to unapply this payment from refunds?'),
+ emt('Keep this payment, but dissociate it from the refunds it is currently applied to'),
+ emt('unapply') . ($usepre ? '&nbsp;' . emt('refunds') : '')
+ )
+ if $refund_to_unapply;
+}
</%init>