summaryrefslogtreecommitdiff
path: root/httemplate/view
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-08-28 00:56:49 -0500
committerJonathan Prykop <jonathan@freeside.biz>2015-08-29 17:23:58 -0500
commit8508117a6127dc363736da08be6e71cb7aefc9d3 (patch)
tree1cf9cbad185a4a6485e9706a69dec841f68440f3 /httemplate/view
parent225f922a9b48c5179b3fd9b28d9eb442d7e8598d (diff)
RT#37064: Add action link to manually refund a payment
Diffstat (limited to 'httemplate/view')
-rw-r--r--httemplate/view/cust_main/payment_history.html1
-rw-r--r--httemplate/view/cust_main/payment_history/payment.html13
2 files changed, 8 insertions, 6 deletions
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index e3599bc06..1525e9314 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -228,6 +228,7 @@ my %opt = (
(
'View invoices', 'Void invoices', 'Unvoid invoices',
'Apply payment', 'Refund credit card payment', 'Refund Echeck payment',
+ 'Post refund', 'Post check refund', 'Post cash refund ', 'Refund payment',
'Credit card void', 'Echeck void', 'Void payments', 'Unvoid payments',
'Delete payment', 'Unapply payment',
'Apply credit', 'Delete credit', 'Unapply credit', 'Void credit', 'Unvoid credit',
diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html
index bf88a6607..0ed2f8003 100644
--- a/httemplate/view/cust_main/payment_history/payment.html
+++ b/httemplate/view/cust_main/payment_history/payment.html
@@ -154,18 +154,19 @@ if ( $apply && $opt{'pkg-balances'} && $cust_pay->pkgnum ) {
my $refund = '';
my $refund_days = $opt{'card_refund-days'} || 120;
-my $refund_right = '';
-$refund_right = 'Refund credit card payment' if $cust_pay->payby eq 'CARD';
-$refund_right = 'Refund Echeck payment' if $cust_pay->payby eq 'CHEK';
+my @refund_right = grep { $opt{$_} } $FS::CurrentUser::CurrentUser->refund_rights($cust_pay->payby);
if ( $cust_pay->closed !~ /^Y/i
- && $cust_pay->payby =~ /^(CARD|CHEK)$/
+ && $cust_pay->payby =~ /^(CARD|CHEK|BILL)$/
&& time-$cust_pay->_date < $refund_days*86400
&& $cust_pay->unrefunded > 0
- && $opt{$refund_right}
+ && scalar(@refund_right)
) {
+ my $refundtitle = ($cust_pay->payby =~ /^(CARD|CHEK)$/)
+ ? emt('Send a refund for this payment to the payment gateway')
+ : emt('Record a refund for this payment');
$refund = qq! (<A HREF="${p}edit/cust_refund.cgi?payby=$1;!.
qq!paynum=!. $cust_pay->paynum. '"'.
- qq! TITLE="! .emt('Send a refund for this payment to the payment gateway')
+ qq! TITLE="! . $refundtitle
. '">' . emt('refund') . '</A>)';
}