Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / misc / download-batch.cgi
1 <% $pay_batch->export_batch(%opt) %><%init>
2
3 #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes
4 http_header('Content-Type' => 'text/plain' ); # not necessarily correct...
5
6 my $batchnum;
7 if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) {
8   $batchnum = $1;
9 } else {
10   die "No batch number (bad URL) \n";
11 }
12
13 my %opt;
14 if ( $cgi->param('gatewaynum') =~ /^(\d+)$/ ) {
15   my $gateway = FS::payment_gateway->by_key($1);
16   die "gatewaynum $1 not found" unless $gateway;
17   $opt{'gateway'} = $gateway;
18 }
19 elsif ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) {
20   $opt{'format'} = $1;
21 }
22
23 my $pay_batch = qsearchs('pay_batch', { batchnum => $batchnum } );
24 die "Batch not found: '$batchnum'" if !$pay_batch;
25
26 </%init>