X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_refund.cgi;h=bea3786f76cf9f427cd423bf88c5587fdf02a112;hb=833839f66761df30a0b0b965ed4314cce32f8f3d;hp=ba93040662b66148e7ecd41b4103cc2052ee619f;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index ba9304066..bea3786f7 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -10,7 +10,7 @@ <% small_custview($custnum, $conf->config('countrydefault')) %> % } -
+ @@ -33,7 +33,7 @@ % $paydate = '' unless ($paydate =~ /^\d{2,4}-\d{1,2}-01$'/); % } -
Payment +
Payment <% ntable("#cccccc", 2) %> @@ -59,36 +59,32 @@ % } - -% -% #false laziness w/FS/FS/cust_main::realtime_refund_bop -% if ( $cust_pay->paybatch =~ /^(\w+):(\w+)(:(\w+))?$/ ) { -% my ( $processor, $auth, $order_number ) = ( $1, $2, $4 ); -% - - +% if ( $cust_pay->processor ) { - Processor<% $processor %> + Processor + <% $cust_pay->processor %> -% if ( length($auth) ) { +% if ( length($cust_pay->auth) ) { - Authorization<% $auth %> + Authorization + <% $cust_pay->auth %> % } -% if ( length($order_number) ) { +% if ( length($cust_pay->order_number) ) { - Order number<% $order_number %> + Order number + <% $cust_pay->order_number %> % } -% } +% } # if ($cust_pay->processor) -% } +% } #if $cust_pay -
Refund +
Refund <% ntable("#cccccc", 2) %> @@ -98,26 +94,53 @@ Amount - $ by <% FS::payby->payname($payby) %> + $ % if ( $payby eq 'BILL' ) { - Check # - + Check + -% } else { - % } +% elsif ($payby eq 'CHEK' || $payby eq 'CARD') { - Reason - + Method + <% FS::payby->payname($real_payby) %> # <% $real_paymask %> + +% if ($payby eq "CARD" || $payby eq "DCRD") { + +% } +% elsif ( $conf->exists("batch-enable") +% || grep $payby eq $_, $conf->config('batch-enable_payby') +% ) { +% if ( grep $payby eq $_, $conf->config('realtime-disable_payby') ) { + +% } else { + + > +    <% mt('Add to current batch') |h %> + +% } +% } + +% } else { + +% } + +<& /elements/tr-select-reason.html, + 'field' => 'reasonnum', + 'reason_class' => 'F', + 'control_button' => "confirm_refund_button", + 'cgi' => $cgi, +&> +
- +
@@ -139,24 +162,18 @@ my $payby = $cgi->param('payby'); my $payinfo = $cgi->param('payinfo'); my $reason = $cgi->param('reason'); my $link = $cgi->param('popup') ? 'popup' : ''; - -my @rights = (); -push @rights, 'Post refund' if $payby =~ /^(BILL|CASH)$/; -push @rights, 'Post check refund' if $payby eq 'BILL'; -push @rights, 'Post cash refund ' if $payby eq 'CASH'; -push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/; -push @rights, 'Refund credit card payment' if $payby eq 'CARD'; -push @rights, 'Refund Echeck payment' if $payby eq 'CHEK'; +my $batch = $cgi->param('batch'); die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right(\@rights); + 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; @@ -166,6 +183,12 @@ if ( $cgi->param('paynum') =~ /^(\d+)$/ ) { } die "no custnum or paynum specified!" unless $custnum; +my $cust_main = qsearchs( 'cust_main', { 'custnum'=>$custnum } ); +die "unknown custnum $custnum" unless $cust_main; + +my $real_payby = $cust_main->payby; +my $real_paymask = $cust_main->paymask; + my $_date = time; my $p1 = popurl(1);