projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bring in freeside.css
[freeside.git]
/
httemplate
/
misc
/
download-batch.cgi
diff --git
a/httemplate/misc/download-batch.cgi
b/httemplate/misc/download-batch.cgi
index
306ef5d
..
01bf5d2
100644
(file)
--- a/
httemplate/misc/download-batch.cgi
+++ b/
httemplate/misc/download-batch.cgi
@@
-1,16
+1,23
@@
-<%
+<% $pay_batch->export_batch($format) %>
+
+<%init>
#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
#http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
-http_header('Content-Type' => 'text/plain' );
+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";
+}
-for my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum }
- qsearch('cust_pay_batch', {} )
-) {
+my $format;
+if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) {
+ $format = $1;
+}
-$cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
-my( $mon, $y ) = ( $2, $1 );
-$mon = "0$mon" if $mon < 10;
-my $exp = "$mon$y";
+my $pay_batch = qsearchs('pay_batch', { batchnum => $batchnum } );
+die "Batch not found: '$batchnum'" if !$pay_batch;
-%>,,,,<%= $cust_pay_batch->cardnum %>,<%= $exp %>,<%= $cust_pay_batch->amount %>,<%= $cust_pay_batch->paybatchnum %>
-<% } %>
+</%init>