set the suspension date before calling service suspensions, fix RADIUS groups suspens...
[freeside.git] / httemplate / view / cust_statement-pdf.cgi
1 <% $pdf %>
2 <%init>
3
4 die "access denied"
5   unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
6
7 #untaint statementnum
8 my($query) = $cgi->keywords;
9 $query =~ /^((.+)-)?(\d+)(.pdf)?$/;
10 my $templatename = $2 || 'statement'; #XXX configure... via event??  eh..
11 my $statementnum = $3;
12
13 my $cust_statement = qsearchs({
14   'select'    => 'cust_statement.*',
15   'table'     => 'cust_statement',
16   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
17   'hashref'   => { 'statementnum' => $statementnum },
18   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
19 });
20 die "Statement #$statementnum not found!" unless $cust_statement;
21
22 my $pdf = $cust_statement->print_pdf( '', $templatename);
23
24 http_header('Content-Type' => 'application/pdf' );
25 http_header('Content-Length' => length($pdf) );
26 http_header('Cache-control' => 'max-age=60' );
27
28 </%init>