X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pay_batch.cgi;h=6f5db2d967ae9bf0074c4aa399a2eb27426a7d5c;hb=884bd92cd47b9602dab999502877545a5bc5be98;hp=b47aaf37c116b6a5d4e4e4001679450b6ed00127;hpb=4c289fa61fa2cc6ed21bdacd047c969eb5c7f96c;p=freeside.git diff --git a/httemplate/search/cust_pay_batch.cgi b/httemplate/search/cust_pay_batch.cgi index b47aaf37c..6f5db2d96 100755 --- a/httemplate/search/cust_pay_batch.cgi +++ b/httemplate/search/cust_pay_batch.cgi @@ -14,6 +14,7 @@ 'Exp', 'Amount', 'Status', + '', # delete link '', # error_message ], 'fields' => [ 'paybatchnum', @@ -31,9 +32,10 @@ sprintf('%.02f', $_[0]->amount) }, 'status', + $sub_unbatch, 'error_message', ], - 'align' => 'rrrlllcrll', + 'align' => 'rrrlllcrlll', 'links' => [ '', ["${p}view/cust_bill.cgi?", 'invnum'], (["${p}view/cust_main.cgi?", 'custnum']) x 2, @@ -129,6 +131,36 @@ my $sub_receipt = sub { ); }; +my $sub_unbatch = ''; +if ( ($pay_batch && ($pay_batch->status eq 'O')) + && ( $curuser->access_right('Process batches') + || $curuser->access_right('Process global batches') ) +) { + $sub_unbatch = sub { + my $self = shift; + return '' if $self->status; # sanity check, shouldn't happen + my $batchnum = $self->batchnum; + my $paybatchnum = $self->paybatchnum; + my $out = < + + +EOF + $out .= include('/elements/progress-init.html', + "delete_cust_pay_batch_$paybatchnum", + [ 'paybatchnum' ], + $p.'misc/process/delete-cust_pay_batch.cgi', + $p.'search/cust_pay_batch.cgi?' . $cgi->query_string, + "paybatchnum$paybatchnum", + ); + my $onclick = 'if ( confirm(\''; + $onclick .= emt('Are you sure you want to delete batch payment ') . $self->paybatchnum; + $onclick .= emt(' from payment batch ') . $self->batchnum; + $onclick .= '\') ) { paybatchnum' . $paybatchnum . 'process() }'; + return $out . 'delete'; + }; +} + my $html_init = ''; if ( $pay_batch ) { $html_init = include('elements/cust_pay_batch_top.html',