use common base for inventory import too, fixes problems with errors due to dos line...
[freeside.git] / httemplate / misc / inventory_item-import.html
1 <% include("/elements/header.html", PL($inventory_class->classname)) %>
2
3 Import a file containing <% PL($inventory_class->classname) %>, one per line.
4 <BR><BR>
5
6 <% include( '/elements/form-file_upload.html',
7               'name'      => 'InventoryItemImportForm',
8               'action'    => 'process/inventory_item-import.html',
9               'num_files' => 1,
10               #'fields'    => [ 'format', 'itembatch', 'classnum', ],
11               'fields'    => [ 'format', 'classnum', ],
12               'message'   => 'Inventory import successful',
13               #XXX redirect via $itembatch?  or just back to class browse?
14               'url'       => $p."search/inventory_item.html?classnum=$classnum;avail=1",
15           )
16 %>
17
18 <% &ntable("#cccccc", 2) %>
19
20   <INPUT TYPE="hidden" NAME="format" VALUE="default">
21
22   <INPUT TYPE="hidden" NAME="classnum" VALUE="<% $classnum %>">
23
24 %#  <INPUT TYPE="hidden" NAME="itembatch" VALUE="<% $itembatch %>">
25
26   <% include( '/elements/file-upload.html',
27                 'field' => 'file',
28                 'label' => 'Filename',
29             )
30   %>
31
32   <TR>
33     <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
34       <INPUT TYPE    = "submit"
35              ID      = "submit"
36              VALUE   = "Import file"
37              onClick = "document.InventoryItemImportForm.submit.disabled=true;"
38       >
39     </TD>
40   </TR>
41
42 </TABLE>
43
44 </FORM>
45
46 <BR>
47
48 Upload file can be a text file or Excel spreadsheet.  If an Excel spreadsheet,
49  should have an .XLS extension.
50 <BR><BR>
51
52 <% include('/elements/footer.html') %>
53
54 <%init>
55
56 die "access denied"
57   unless $FS::CurrentUser::CurrentUser->access_right('Import');
58
59 $cgi->param =~ /^(\d+)$/ or errorpage("illegal classnum");
60 my $classnum = $1;
61 my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } );
62
63 #my $conf = new FS::Conf;
64 #my $itembatch =
65 #  time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
66
67 </%init>