[freeside-commits] branch FREESIDE_4_BRANCH updated. 3a532ec892ee17b58691d0c04baead999ebdbab9
Christopher Burger
burgerc at freeside.biz
Tue Jul 10 11:16:59 PDT 2018
The branch, FREESIDE_4_BRANCH has been updated
via 3a532ec892ee17b58691d0c04baead999ebdbab9 (commit)
from b94ae73fdc40568f33b7f7dbdac15bda18fb9347 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3a532ec892ee17b58691d0c04baead999ebdbab9
Author: Christopher Burger <burgerc at freeside.biz>
Date: Mon Jul 9 08:27:53 2018 -0400
RT# 74435 - Fixed error with refund link on payment history page not allowing batch refund when batch payment was made.
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index df1410423..0769eb578 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -1530,7 +1530,7 @@ sub realtime_refund_bop {
my $payment_gateway =
$self->agent->payment_gateway( 'method' => $options{method} );
- my( $processor, $login, $password, $namespace ) =
+ ( $processor, $login, $password, $namespace ) =
map { my $method = "gateway_$_"; $payment_gateway->$method }
qw( module username password namespace );
diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi
index 27c4b1937..f3dec98e1 100755
--- a/httemplate/edit/cust_refund.cgi
+++ b/httemplate/edit/cust_refund.cgi
@@ -105,7 +105,7 @@
</TR>
</TABLE>
% }
-% elsif ($payby eq 'CHEK') {
+% elsif ($payby eq 'CHEK' || $payby eq 'CARD') {
%
<SCRIPT TYPE="text/javascript">
function cust_payby_changed (what) {
@@ -132,14 +132,35 @@
% my $custpaybynum = length(scalar($cgi->param('custpaybynum')))
% ? scalar($cgi->param('custpaybynum'))
% : scalar(@cust_payby) && $cust_payby[0]->custpaybynum;
-<& /elements/tr-select-cust_payby.html,
+
+% if ($cust_pay) {
+ <INPUT TYPE="hidden" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10>
+% }
+% else {
+ <& /elements/tr-select-cust_payby.html,
'cust_payby' => \@cust_payby,
'curr_value' => $custpaybynum,
'onchange' => 'cust_payby_changed(this)',
-&>
- <INPUT TYPE="hidden" NAME="batch" VALUE="1">
+ &>
+% }
+
+% if ( $conf->exists("batch-enable")
+% || grep $payby eq $_, $conf->config('batch-enable_payby')
+% ) {
+% if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) {
+ <INPUT TYPE="hidden" NAME="batch" VALUE="1">
+% } else {
+ <TR>
+ <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="batch" VALUE="1" ID="batch" <% ($batchnum || $batch) ? 'checked' : '' %> ></TD>
+ <TH ALIGN="left"> <% mt('Add to current batch') |h %></TH>
+ </TR>
+% }
+% }
+
</TABLE>
<P>
+
+% if ( !$cust_pay ) {
<DIV ID="cust_payby"
<% $custpaybynum ? 'STYLE="display:none"'
: ''
@@ -147,13 +168,14 @@
>
<TABLE class="fsinnerbox">
-<& /elements/cust_payby_new.html,
- 'cust_payby' => \@cust_payby,
- 'curr_value' => $custpaybynum,
-&>
+ <& /elements/cust_payby_new.html,
+ 'cust_payby' => \@cust_payby,
+ 'curr_value' => $custpaybynum,
+ &>
</TABLE>
</DIV>
+% } # end if cust_pay
% } else {
<INPUT TYPE="hidden" NAME="payinfo" VALUE="">
@@ -194,16 +216,18 @@ my $payby = $cgi->param('payby');
my $payinfo = $cgi->param('payinfo');
my $reason = $cgi->param('reason');
my $link = $cgi->param('popup') ? 'popup' : '';
+my $batch = $cgi->param('batch');
die "access denied"
unless $FS::CurrentUser::CurrentUser->refund_access_right($payby);
-my( $paynum, $cust_pay ) = ( '', '' );
+my( $paynum, $cust_pay, $batchnum ) = ( '', '', '' );
if ( $cgi->param('paynum') =~ /^(\d+)$/ ) {
$paynum = $1;
$cust_pay = qsearchs('cust_pay', { paynum=>$paynum } )
or die "unknown payment # $paynum";
$refund ||= $cust_pay->unrefunded;
+ $batchnum = $cust_pay->batchnum;
if ( $custnum ) {
die "payment # $paynum is not for specified customer # $custnum"
unless $custnum == $cust_pay->custnum;
diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi
index 77da8d5d2..1f96456e0 100755
--- a/httemplate/edit/process/cust_refund.cgi
+++ b/httemplate/edit/process/cust_refund.cgi
@@ -53,7 +53,7 @@ if ( $error ) {
'CHEK' => 'electronic check (ACH)',
);
-my( $cust_payby, $payinfo, $paycvv, $month, $year, $payname );
+my( $cust_pay, $cust_payby, $payinfo, $paycvv, $month, $year, $payname );
my $paymask = '';
if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
@@ -73,6 +73,17 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
$payname = $cust_payby->payname;
$cgi->param(-name=>"paytype", -value=>$cust_payby->paytype) unless $cgi->param("paytype");
+} elsif ( $cgi->param('paynum') > 0) {
+
+ $cust_pay = qsearchs({
+ 'table' => 'cust_pay',
+ 'hashref' => { 'paynum' => $cgi->param('paynum') },
+ 'select' => 'cust_pay.*, cust_pay_batch.payname ',
+ 'addl_from' => "left join cust_pay_batch on cust_pay_batch.batchnum = cust_pay.batchnum and cust_pay_batch.custnum = $custnum ",
+ });
+ $payinfo = $cust_pay->payinfo;
+ $payname = $cust_pay->payname;
+
} else {
##
@@ -194,11 +205,13 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
$cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!";
my $paynum = $1;
my $paydate;
- if ($cust_payby->paydate) { $paydate = "$year-$month-01"; }
- else { $paydate = "2037-12-01"; }
+ unless ($paynum) {
+ if ($cust_payby->paydate) { $paydate = "$year-$month-01"; }
+ else { $paydate = "2037-12-01"; }
+ }
if ( $cgi->param('batch') ) {
-
+ $paydate = "2037-12-01" unless $paydate;
$error ||= $cust_main->batch_card(
'payby' => $payby,
'amount' => $refund,
@@ -211,28 +224,23 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
);
errorpage($error) if $error;
-#### post refund #####
my %hash = map {
$_, scalar($cgi->param($_))
} fields('cust_refund');
- $paynum = $cgi->param('paynum');
- $paynum =~ /^(\d*)$/ or die "Illegal paynum!";
- if ($paynum) {
- my $cust_pay = qsearchs('cust_pay',{ 'paynum' => $paynum });
- die "Could not find paynum $paynum" unless $cust_pay;
- $error = $cust_pay->refund(\%hash);
- } else {
- my $new = new FS::cust_refund ( \%hash );
- $error = $new->insert;
- }
- # if not a batch refund run realtime.
+
+ my $new = new FS::cust_refund ( { 'paynum' => $paynum,
+ %hash,
+ } );
+ $error = $new->insert;
+
+ # if not a batch refund run realtime.
} else {
$error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund,
'paynum' => $paynum,
'reasonnum' => scalar($cgi->param('reasonnum')),
%options );
}
-} else {
+} else { # run cash refund.
my %hash = map {
$_, scalar($cgi->param($_))
} fields('cust_refund');
diff --git a/httemplate/view/cust_main/menu.html b/httemplate/view/cust_main/menu.html
index f3aca21e8..7ec4d07db 100644
--- a/httemplate/view/cust_main/menu.html
+++ b/httemplate/view/cust_main/menu.html
@@ -460,7 +460,7 @@ my @menu = (
## condition => sub { $payby{MCHK} },
#},
{
- label => 'Batch Electronic check refund',
+ label => 'Enter electronic check refund',
popup => "edit/cust_refund.cgi?popup=1;payby=CHEK;custnum=$custnum",
actionlabel => 'Enter electronic check refund',
width => 440,
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main/Billing_Realtime.pm | 2 +-
httemplate/edit/cust_refund.cgi | 42 ++++++++++++++++++++++++++-------
httemplate/edit/process/cust_refund.cgi | 42 ++++++++++++++++++++-------------
httemplate/view/cust_main/menu.html | 2 +-
4 files changed, 60 insertions(+), 28 deletions(-)
More information about the freeside-commits
mailing list