3 unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
4 my ($batchnum) = $cgi->keywords;
5 $batchnum =~ /^\d+$/ or die "invalid batchnum '$batchnum'";
6 my $batch = FS::bill_batch->by_key($batchnum)
7 or die "Batch $batchnum not found";
10 my $content = $batch->pdf;
12 $r->content_type('application/pdf');
13 $r->headers_out->add( 'Content-Disposition' =>
14 'attachment;filename="invoice_batch_'.$batchnum.'.pdf"');
15 my $cookie = CGI::Cookie->new(
16 -name => "bill_batch_download",
20 $r->headers_out->add( 'Set-Cookie' => $cookie->as_string );
24 my $error = $batch->replace;
25 warn "error deleting cached PDF: '$error'\n" if $error;