X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill-pdf.cgi;h=a72a60551190bb1299a8c2a4ed58bd7c6b1e7b5f;hb=93e53eec9c0385c707760987cc2c6ab179a4ea63;hp=03340a16f664ebec672de0973167000845623a87;hpb=01c33bcdfa27576bee4ab922095749794a6b9f57;p=freeside.git diff --git a/httemplate/view/cust_bill-pdf.cgi b/httemplate/view/cust_bill-pdf.cgi index 03340a16f..a72a60551 100755 --- a/httemplate/view/cust_bill-pdf.cgi +++ b/httemplate/view/cust_bill-pdf.cgi @@ -2,12 +2,17 @@ #untaint invnum my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $invnum = $1; +$query =~ /^((.+)-)?(\d+)(.pdf)?$/; +my $templatename = $2; +my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Invoice #$invnum not found!" unless $cust_bill; -http_header('Content-Type' => 'application/postscript' ); +my $pdf = $cust_bill->print_pdf( '', $templatename); + +http_header('Content-Type' => 'application/pdf' ); +http_header('Content-Length' => length($pdf) ); +http_header('Cache-control' => 'max-age=60' ); %> -<%= $cust_bill->print_ps %> +<%= $pdf %>