[freeside-commits] freeside/httemplate/misc inventory_item-import.html, 1.5, 1.6

Ivan,,, ivan at wavetail.420.am
Mon Dec 8 17:46:55 PST 2008


Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory wavetail.420.am:/tmp/cvs-serv25262/httemplate/misc

Modified Files:
	inventory_item-import.html 
Log Message:
use common base for inventory import too, fixes problems with errors due to dos line endings and allows Excel upload, RT#4346

Index: inventory_item-import.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/inventory_item-import.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- inventory_item-import.html	20 Feb 2008 22:45:28 -0000	1.5
+++ inventory_item-import.html	9 Dec 2008 01:46:53 -0000	1.6
@@ -1,14 +1,54 @@
-<% include("/elements/header.html", $inventory_class->classname. 's') %>
+<% include("/elements/header.html", PL($inventory_class->classname)) %>
 
-<FORM ACTION="process/inventory_item-import.html" METHOD="POST" ENCTYPE="multipart/form-data">
-<INPUT TYPE="hidden" NAME="classnum" VALUE="<% $classnum %>">
-Import a file containing <% $inventory_class->classname %>s, one per line.<BR><BR>
+Import a file containing <% PL($inventory_class->classname) %>, one per line.
+<BR><BR>
 
-Filename: <INPUT TYPE="file" NAME="filename"><BR><BR>
+<% include( '/elements/form-file_upload.html',
+              'name'      => 'InventoryItemImportForm',
+              'action'    => 'process/inventory_item-import.html',
+              'num_files' => 1,
+              #'fields'    => [ 'format', 'itembatch', 'classnum', ],
+              'fields'    => [ 'format', 'classnum', ],
+              'message'   => 'Inventory import successful',
+              #XXX redirect via $itembatch?  or just back to class browse?
+              'url'       => $p."search/inventory_item.html?classnum=$classnum;avail=1",
+          )
+%>
+
+<% &ntable("#cccccc", 2) %>
+
+  <INPUT TYPE="hidden" NAME="format" VALUE="default">
+
+  <INPUT TYPE="hidden" NAME="classnum" VALUE="<% $classnum %>">
+
+%#  <INPUT TYPE="hidden" NAME="itembatch" VALUE="<% $itembatch %>">
+
+  <% include( '/elements/file-upload.html',
+                'field' => 'file',
+                'label' => 'Filename',
+            )
+  %>
+
+  <TR>
+    <TD COLSPAN=2 ALIGN="center" STYLE="padding-top:6px">
+      <INPUT TYPE    = "submit"
+             ID      = "submit"
+             VALUE   = "Import file"
+             onClick = "document.InventoryItemImportForm.submit.disabled=true;"
+      >
+    </TD>
+  </TR>
+
+</TABLE>
 
-<INPUT TYPE="submit" VALUE="Upload">
 </FORM>
 
+<BR>
+
+Upload file can be a text file or Excel spreadsheet.  If an Excel spreadsheet,
+ should have an .XLS extension.
+<BR><BR>
+
 <% include('/elements/footer.html') %>
 
 <%init>
@@ -20,4 +60,8 @@
 my $classnum = $1;
 my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } );
 
+#my $conf = new FS::Conf;
+#my $itembatch =
+#  time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time);
+
 </%init>



More information about the freeside-commits mailing list