X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fdownload-bill_batch.html;fp=httemplate%2Fmisc%2Fdownload-bill_batch.html;h=00d9236f3ec853863ff8bc5a06573dc5107455cd;hb=007fd3026ade508a9d88b436575a4797d003280a;hp=0000000000000000000000000000000000000000;hpb=8043c7dc35455c0c2a7afce70e9f79448952d170;p=freeside.git diff --git a/httemplate/misc/download-bill_batch.html b/httemplate/misc/download-bill_batch.html new file mode 100644 index 000000000..00d9236f3 --- /dev/null +++ b/httemplate/misc/download-bill_batch.html @@ -0,0 +1,20 @@ +<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); +my ($batchnum) = $cgi->keywords; +$batchnum =~ /^\d+$/ or die "invalid batchnum '$batchnum'"; +my $batch = FS::bill_batch->by_key($batchnum) + or die "Batch $batchnum not found"; + +# send the batch +my $content = $batch->pdf; +$m->clear_buffer; +$r->content_type('application/pdf'); +$r->headers_out->add( 'Content-Disposition' => + 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"'); +$m->print($content); + +$batch->pdf(''); +my $error = $batch->replace; +warn "error deleting cached PDF: '$error'\n" if $error; +