diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-05-16 13:31:08 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-05-16 13:31:08 -0700 |
commit | 67d6d7a6c446837af1855eef8495c286a58a9ac1 (patch) | |
tree | 63fa5dcad085e3040bb4771aba1170ceadfcdb83 /httemplate/view | |
parent | cf5ea7941e280b3f30761213b393ead465124c52 (diff) |
statement link display by default, better label, statements say "statement" and have no dates/numbers, RT#23148
Diffstat (limited to 'httemplate/view')
-rw-r--r-- | httemplate/view/cust_main/payment_history.html | 5 | ||||
-rwxr-xr-x | httemplate/view/cust_main_statement-pdf.cgi | 32 |
2 files changed, 22 insertions, 15 deletions
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 915be49e5..c7bf3748c 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -141,10 +141,9 @@ %# invoice reports, combined statement % if ( $curuser->access_right('List invoices') ) { -% if ( $conf->exists('cust_main-print_statement_link') -% and $num_cust_bill > 0 ) { +% if ( $num_cust_bill > 0 ) { <A HREF="<% $p %>view/cust_main_statement-pdf.cgi?<% $custnum %>"><% - mt('Print a current statement') |h %></A> + mt('Download typeset statement PDF') |h %></A> <BR> % } <A HREF="<% $p %>search/report_cust_bill.html?custnum=<% $custnum %>"><% mt('Invoice reports') |h %></A> diff --git a/httemplate/view/cust_main_statement-pdf.cgi b/httemplate/view/cust_main_statement-pdf.cgi index 7c2c20799..79110ee20 100755 --- a/httemplate/view/cust_main_statement-pdf.cgi +++ b/httemplate/view/cust_main_statement-pdf.cgi @@ -1,29 +1,34 @@ +<% $pdf %>\ <%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; +$query =~ /^(\d+)$/; +my $custnum = $1; +#mostly for the agent-virt, i guess. could probably bolt it onto the cust_bill +# search 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_bill = ($cust_main->cust_bill)[-1] +}) + or die "Customer #$custnum not found!"; + +my $cust_bill = qsearchs({ + 'table' => 'cust_bill', + 'hashref' => { 'custnum' => $custnum }, + 'order_by' => 'ORDER BY _date desc LIMIT 1', +}) or die "Customer #$custnum has no invoices!"; my $cust_statement = FS::cust_statement->new({ @@ -33,11 +38,14 @@ my $cust_statement = FS::cust_statement->new({ '_date' => time, }); +my $pdf = $cust_statement->print_pdf({ + 'notice_name' => 'Statement', + 'no_date' => 1, + 'no_number' => 1, +}); -my $pdf = $cust_statement->print_pdf( '', $templatename ); - -http_header('Content-Type' => 'application/pdf' ); +http_header('Content-Type' => 'application/pdf' ); http_header('Content-Length' => length($pdf) ); -http_header('Cache-control' => 'max-age=60' ); +http_header('Cache-control' => 'max-age=60' ); </%init> |