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