X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fcust_main-import.cgi;h=aa8cd5298d3cc59249ac18dd35c1dd7b289a102b;hp=c8d1b6cd1ec8ad9266e3f310c9b52b5d49b8b331;hb=f49f11d4c3c4ba9480cc5c9acfaa606a5ba73ad1;hpb=2d53d2ebdce80d0f0dc7f75ccf506a06c2f852f9 diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi index c8d1b6cd1..aa8cd5298 100644 --- a/httemplate/misc/process/cust_main-import.cgi +++ b/httemplate/misc/process/cust_main-import.cgi @@ -1,35 +1,28 @@ -% -% -% my $fh = $cgi->upload('csvfile'); -% #warn $cgi; -% #warn $fh; -% -% my $error = defined($fh) -% ? FS::cust_main::batch_import( { -% filehandle => $fh, -% agentnum => scalar($cgi->param('agentnum')), -% refnum => scalar($cgi->param('refnum')), -% pkgpart => scalar($cgi->param('pkgpart')), -% #'fields' => [qw( cust_pkg.setup dayphone first last address1 address2 -% # city state zip comments )], -% 'format' => scalar($cgi->param('format')), -% } ) -% : 'No file'; -% -% if ( $error ) { -% - - -% -% errorpage($error); -%# $cgi->param('error', $error); -%# print $cgi->redirect( "${p}cust_main-import.cgi +% if ( $error ) { +% errorpage($error); % } else { -% - - - <% include("/elements/header.html",'Import successful') %> -% + <% include('/elements/header.html','Import successful') %> + <% include('/elements/footer.html') %> % } -% +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + +my $fh = $cgi->upload('csvfile'); +#warn $cgi; +#warn $fh; + +my $error = defined($fh) + ? FS::cust_main::batch_import( { + filehandle => $fh, + agentnum => scalar($cgi->param('agentnum')), + refnum => scalar($cgi->param('refnum')), + pkgpart => scalar($cgi->param('pkgpart')), + #'fields' => [qw( cust_pkg.setup dayphone first last address1 address2 + # city state zip comments )], + 'format' => scalar($cgi->param('format')), + } ) + : 'No file'; +