DNS, RT#8933
[freeside.git] / httemplate / view / cust_bill-ps.cgi
1 <% $cust_bill->print_ps(\%opt) %>
2 <%init>
3
4 die "access denied"
5   unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
6
7 my( $invnum, $template, $notice_name );
8 my($query) = $cgi->keywords;
9 if ( $query =~ /^((.+)-)?(\d+)(.pdf)?$/ ) {
10   $template = $2;
11   $invnum = $3;
12   $notice_name = 'Invoice';
13 } else {
14   $invnum = $cgi->param('invnum');
15   $template = $cgi->param('template');
16   $notice_name = ( $cgi->param('notice_name') || 'Invoice' );
17 }
18
19 my %opt = (
20   'template'    => $template,
21   'notice_name' => $notice_name,
22 );
23
24 my $cust_bill = qsearchs({
25   'select'    => 'cust_bill.*',
26   'table'     => 'cust_bill',
27   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
28   'hashref'   => { 'invnum' => $invnum },
29   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
30 });
31 die "Invoice #$invnum not found!" unless $cust_bill;
32
33 http_header('Content-Type' => 'application/postscript' );
34
35 </%init>