summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/cust_pay_batch.cgi13
-rw-r--r--httemplate/misc/upload-batch.cgi28
2 files changed, 38 insertions, 3 deletions
diff --git a/httemplate/browse/cust_pay_batch.cgi b/httemplate/browse/cust_pay_batch.cgi
index f9d0921a1..d90a03313 100755
--- a/httemplate/browse/cust_pay_batch.cgi
+++ b/httemplate/browse/cust_pay_batch.cgi
@@ -2,11 +2,18 @@
<%= header("Pending credit card batch", menubar( 'Main Menu' => $p,)) %>
<FORM ACTION="<%=$p%>misc/download-batch.cgi" METHOD="POST">
-
Download batch in format <SELECT NAME="format">
-<OPTION VALUE="csv">Generic CSV (comma-separated value)</OPTION>
<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV file for TD Canada Trust Merchant PC Batch</OPTION>
-</SELECT><INPUT TYPE="submit" VALUE="Download">
+</SELECT><INPUT TYPE="submit" VALUE="Download"></FORM>
+<BR><BR>
+
+<FORM ACTION="<%=$p%>misc/upload-batch.cgi" METHOD="POST" ENCTYPE="multipart/form-data">
+Upload results<BR>
+Filename <INPUT TYPE="file" NAME="batch_results"><BR>
+Format <SELECT NAME="format">
+<OPTION VALUE="csv-td_canada_trust-merchant_pc_batch">CSV results from TD Canada Trust Merchant PC Batch</OPTION>
+</SELECT><BR>
+<INPUT TYPE="submit" VALUE="Upload"></FORM>
<BR><BR>
<%= &table() %>
diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi
new file mode 100644
index 000000000..565a6da5c
--- /dev/null
+++ b/httemplate/misc/upload-batch.cgi
@@ -0,0 +1,28 @@
+<%
+
+ my $fh = $cgi->upload('batch_results');
+ my $filename = $cgi->param('batch_results');
+ my $paybatch = basename($filename);
+
+ my $error = defined($fh)
+ ? FS::cust_pay_batch::import_results( {
+ 'filehandle' => $fh,
+ 'format' => $cgi->param('format'),
+ 'paybatch' => $paybatch,
+ } )
+ : 'No file';
+
+ if ( $error ) {
+ %>
+ <!-- mason kludge -->
+ <%
+ eidiot($error);
+# $cgi->param('error', $error);
+# print $cgi->redirect( "${p}cust_main-import.cgi
+ } else {
+ %>
+ <!-- mason kludge -->
+ <%= header('Batch results upload sucessful') %> <%
+ }
+%>
+