[freeside-commits] freeside/httemplate/view cust_main_statement-pdf.cgi, NONE, 1.1.2.2
Mark Wells
mark at wavetail.420.am
Tue Jan 31 21:35:29 PST 2012
Update of /home/cvs/cvsroot/freeside/httemplate/view
In directory wavetail.420.am:/tmp/cvs-serv19347/httemplate/view
Added Files:
Tag: FREESIDE_2_3_BRANCH
cust_main_statement-pdf.cgi
Log Message:
print customer statements on the fly, #15864
--- NEW FILE: cust_main_statement-pdf.cgi ---
<%doc>
Like view/cust_statement-pdf.cgi, but for viewing/printing the implicit
statement containing all of a customer's invoices. Slightly redundant.
I don't see the need to create an equivalent to view/cust_statement.html
for this case, but one can be added if necessary.
</%doc>
<% $pdf %>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
#untaint statement
my($query) = $cgi->keywords;
$query =~ /^((.+)-)?(\d+)$/;
my $templatename = $2 || 'statement'; #XXX configure... via event?? eh..
my $custnum = $3;
my $cust_main = qsearchs({
'select' => 'cust_main.*',
'table' => 'cust_main',
'hashref' => { 'custnum' => $custnum },
'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});
die "Customer #$custnum not found!" unless $cust_main;
my $cust_statement = FS::cust_statement->new({
'custnum' => $custnum,
'statementnum' => 'ALL', #magic
'_date' => time,
});
my $pdf = $cust_statement->print_pdf( '', $templatename );
http_header('Content-Type' => 'application/pdf' );
http_header('Content-Length' => length($pdf) );
http_header('Cache-control' => 'max-age=60' );
</%init>
More information about the freeside-commits
mailing list