links to show alternate invoices also
[freeside.git] / httemplate / view / cust_bill-pdf.cgi
1 <%
2
3 #untaint invnum
4 my($query) = $cgi->keywords;
5 $query =~ /^((.+)-)?(\d+)(.pdf)?$/;
6 my $templatename = $2;
7 my $invnum = $3;
8
9 my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum});
10 die "Invoice #$invnum not found!" unless $cust_bill;
11
12 my $pdf = $cust_bill->print_pdf( '', $templatename);
13
14 http_header('Content-Type' => 'application/pdf' );
15 http_header('Content-Length' => length($pdf) );
16 http_header('Cache-control' => 'max-age=60' );
17 %>
18 <%= $pdf %>