From b4647550d33068067925f7f3fe8d6fe4f02a67e4 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 12 Jun 2018 09:51:58 -0400 Subject: [PATCH] RT# 74435 - fixed errors in posting a echeck refund when no account is listed. Conflicts: FS/FS/cust_main/Billing_Batch.pm httemplate/elements/tr-select-cust_payby.html httemplate/misc/payment.cgi httemplate/misc/process/payment.cgi --- FS/FS/cust_main.pm | 4 ++-- httemplate/edit/cust_refund.cgi | 34 +++++++++++++++++++++++++++++++++ httemplate/edit/process/cust_refund.cgi | 8 +++++--- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index d4214d1c8..c5cee8d94 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2790,7 +2790,7 @@ sub batch_card { } ); foreach (qw( address1 address2 city state zip country latitude longitude - payby payinfo paydate payname paycode )) + payby payinfo paydate payname paycode paytype )) { $options{$_} = '' unless exists($options{$_}); } @@ -2817,7 +2817,7 @@ sub batch_card { 'exp' => $options{paydate} || $self->paydate, 'payname' => $options{payname} || $self->payname, 'amount' => $amount, # consolidating - 'paycode' => $options{paycode} || $cust_payby->paycode, + 'paycode' => $options{paycode} || '', } ); $cust_pay_batch->paybatchnum($old_cust_pay_batch->paybatchnum) diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index e1975ed70..473648f42 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -85,6 +85,7 @@
Refund + <% ntable("#cccccc", 2) %> @@ -105,6 +106,19 @@ % } % elsif ($payby eq 'CHEK') { % + % my @cust_payby = (); % if ( $payby eq 'CARD' ) { % @cust_payby = $cust_main->cust_payby('CARD','DCRD'); @@ -123,10 +137,30 @@ 'onchange' => 'cust_payby_changed(this)', &> + +

+

+> + + +<& /elements/cust_payby_new.html, + 'cust_payby' => \@cust_payby, + 'curr_value' => $custpaybynum, +&> + +
+
+ % } else { + % } +

+ <& /elements/tr-select-reason.html, 'field' => 'reasonnum', 'reason_class' => 'F', diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index b1b5c80bd..8dbe4fc63 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -71,6 +71,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { $paycvv = $cust_payby->paycvv; # pass it if we got it, running a transaction will clear it ( $month, $year ) = $cust_payby->paydate_mon_year; $payname = $cust_payby->payname; + $cgi->param(-name=>"paytype", -value=>$cust_payby->paytype) unless $cgi->param("paytype"); } else { @@ -192,8 +193,9 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { my $refund = "$1$2"; $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; my $paynum = $1; - my $paydate = $cgi->param('exp_year'). '-'. $cgi->param('exp_month'). '-01'; - $options{'paydate'} = $paydate if $paydate =~ /^\d{2,4}-\d{1,2}-01$/; + my $paydate; + if ($cust_payby->paydate) { $paydate = "$year-$month-01"; } + else { $paydate = "2037-12-01"; } if ( $cgi->param('batch') ) { @@ -201,7 +203,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { 'payby' => $payby, 'amount' => $refund, 'payinfo' => $payinfo, - 'paydate' => "$year-$month-01", + 'paydate' => $paydate, 'payname' => $payname, 'paycode' => 'C', map { $_ => scalar($cgi->param($_)) } -- 2.11.0