aa8cd5298d3cc59249ac18dd35c1dd7b289a102b
[freeside.git] / httemplate / misc / process / cust_main-import.cgi
1 % if ( $error ) {
2 %   errorpage($error);
3 %  } else {
4     <% include('/elements/header.html','Import successful') %> 
5     <% include('/elements/footer.html') %> 
6 %  }
7 <%init>
8
9 die "access denied"
10   unless $FS::CurrentUser::CurrentUser->access_right('Import');
11
12 my $fh = $cgi->upload('csvfile');
13 #warn $cgi;
14 #warn $fh;
15
16 my $error = defined($fh)
17   ? FS::cust_main::batch_import( {
18       filehandle => $fh,
19       agentnum   => scalar($cgi->param('agentnum')),
20       refnum     => scalar($cgi->param('refnum')),
21       pkgpart    => scalar($cgi->param('pkgpart')),
22       #'fields'    => [qw( cust_pkg.setup dayphone first last address1 address2
23       #                   city state zip comments                          )],
24       'format'   => scalar($cgi->param('format')),
25     } )
26   : 'No file';
27
28 </%init>