add upload of batch result from TD Canada Trust
[freeside.git] / httemplate / misc / upload-batch.cgi
diff --git a/httemplate/misc/upload-batch.cgi b/httemplate/misc/upload-batch.cgi
new file mode 100644 (file)
index 0000000..565a6da
--- /dev/null
@@ -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') %> <%
+  }
+%>
+