diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-08-28 00:56:49 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-08-28 00:56:49 -0500 |
commit | 46bbbb1a78fd822805226abea832b6206273c091 (patch) | |
tree | aedc878b1ee1ca33f065678f61d5805b7c6d9da9 /httemplate/view/cust_main/payment_history | |
parent | 76e8fffdfe3b6f6f8ab422038b62e40cc10f95e8 (diff) |
RT#37064: Add action link to manually refund a payment
Diffstat (limited to 'httemplate/view/cust_main/payment_history')
-rw-r--r-- | httemplate/view/cust_main/payment_history/payment.html | 13 |
1 files changed, 7 insertions, 6 deletions
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>)'; } |