X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fupload-batch.cgi;h=be80b1ff75a94a628c04ba622fcda3b4563f4abb;hp=a551702182013df7fd672e1330a512c668d9b01a;hb=ded6a5654efd56d2f271970c992133600e0223b1;hpb=f731dc5a2bab0f3d04a43d7501257e18164bdcd8 diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi index a55170218..be80b1ff7 100644 --- a/httemplate/misc/upload-batch.cgi +++ b/httemplate/misc/upload-batch.cgi @@ -1,37 +1,10 @@ -% if ( $error ) { - - - -% eidiot($error); -%# $cgi->param('error', $error); -%# print $cgi->redirect( "${p}cust_main-import.cgi -% } else { - - <% include("/elements/header.html",'Batch results upload successful') %> - -% } +<% $server->process %> <%init> -my $error; - -my $fh = $cgi->upload('batch_results'); -$error = 'No file uploaded' unless defined($fh); - -unless ( $error ) { - - $cgi->param('batchnum') =~ /^(\d+)$/; - my $batchnum = $1; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Process batches'); - my $pay_batch = qsearchs( 'pay_batch', { 'batchnum' => $batchnum } ); - if ( ! $pay_batch ) { - $error = "batchnum $batchnum not found"; - } elsif ( $pay_batch->status ne 'I' ) { - $error = "batch $paybatch is not in transit"; - } else { - $error = $pay_batch->import_results( - 'filehandle' => $fh, - 'format' => $cgi->param('format'), - ); - } +my $server = + new FS::UI::Web::JSRPC 'FS::pay_batch::process_import_results', $cgi;