summaryrefslogtreecommitdiff
path: root/httemplate/misc/download-batch.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/download-batch.cgi')
-rw-r--r--httemplate/misc/download-batch.cgi23
1 files changed, 23 insertions, 0 deletions
diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi
new file mode 100644
index 0000000..01bf5d2
--- /dev/null
+++ b/httemplate/misc/download-batch.cgi
@@ -0,0 +1,23 @@
+<% $pay_batch->export_batch($format) %>
+
+<%init>
+
+#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
+http_header('Content-Type' => 'text/plain' ); # not necessarily correct...
+
+my $batchnum;
+if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) {
+ $batchnum = $1;
+} else {
+ die "No batch number (bad URL) \n";
+}
+
+my $format;
+if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) {
+ $format = $1;
+}
+
+my $pay_batch = qsearchs('pay_batch', { batchnum => $batchnum } );
+die "Batch not found: '$batchnum'" if !$pay_batch;
+
+</%init>