X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fcust_main-import_charges.cgi;h=d877ad17dbbda37b3c745ce007a77198d9bb9258;hb=d61cf1825f89216eebc83da5510c34b330b55abb;hp=14df1bd8d280a99a6bee392a75e735c4ba1b0ab0;hpb=c0567c688084e89fcd11bf82348b6c418f1254ac;p=freeside.git diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi index 14df1bd8d..d877ad17d 100644 --- a/httemplate/misc/process/cust_main-import_charges.cgi +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -1,26 +1,24 @@ -<% +% if ( $error ) { +% errorpage($error); +% } else { + <% include('/elements/header.html','Import successful') %> + <% include('/elements/footer.html') %> +% } +<%init> - my $fh = $cgi->upload('csvfile'); - #warn $cgi; - #warn $fh; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); - my $error = defined($fh) - ? FS::cust_main::batch_charge( { - filehandle => $fh, - 'fields' => [qw( custnum amount pkg )], - } ) - : 'No file'; +my $fh = $cgi->upload('csvfile'); +#warn $cgi; +#warn $fh; - if ( $error ) { - %> - - <% - eidiot($error); -# $cgi->param('error', $error); -# print $cgi->redirect( "${p}cust_main-import_charges.cgi - } else { - %> - - <%= header('Import sucessful') %> <% - } -%> +my $error = defined($fh) + ? FS::cust_main::Import_Charges::batch_charge( { + filehandle => $fh, + 'agentnum' => scalar($cgi->param('agentnum')), + 'format' => scalar($cgi->param('format')), + } ) + : 'No file'; + +