[freeside-commits] freeside/httemplate/view legacy_cust_bill-pdf.cgi, NONE, 1.1.2.2 legacy_cust_bill.html, NONE, 1.1.2.2
Ivan,,,
ivan at wavetail.420.am
Tue Oct 25 15:35:23 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/view
In directory wavetail.420.am:/tmp/cvs-serv5216/httemplate/view
Added Files:
Tag: FREESIDE_2_3_BRANCH
legacy_cust_bill-pdf.cgi legacy_cust_bill.html
Log Message:
add legacy_cust_bill to hold legacy invoice content, RT#12981
--- NEW FILE: legacy_cust_bill.html ---
<& /elements/header.html, mt('Legacy Invoice View'), menubar(
emt("View this customer (#[_1])",$display_custnum) => "${p}view/cust_main.cgi?$custnum",
) &>
% if ( 0 ) { #implement resending of legacy invoices?
% #if ( $curuser->access_right('Resend invoices') ) {
<A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>
% if ( grep { $_ ne 'POST' } $legacy_cust_bill->cust_main->invoicing_list ) {
| <A HREF="<% $p %>misc/send-invoice.cgi?method=email;<% $link %>"><% mt('Re-email this invoice') |h %></A>
% }
% if ( $conf->exists('hylafax') && length($legacy_cust_bill->cust_main->fax) ) {
| <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
% }
<BR><BR>
% }
% if ( length($legacy_cust_bill->content_pdf) ) {
<A HREF="<% $p %>view/legacy_cust_bill-pdf.cgi?<% $link %>"><% mt('View typeset invoice PDF') |h %></A>
<BR><BR>
% }
<% $legacy_cust_bill->content_html %>
<& /elements/footer.html &>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('View invoices');
my $legacyinvnum;
my($query) = $cgi->keywords;
if ( $query =~ /^(\d+)$/ ) {
$legacyinvnum = $3;
} else {
$legacyinvnum = $cgi->param('legacyinvnum');
}
my $conf = new FS::Conf;
my $legacy_cust_bill = qsearchs({
'select' => 'legacy_cust_bill.*',
'table' => 'legacy_cust_bill',
'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
'hashref' => { 'legacyinvnum' => $legacyinvnum },
'extra_sql' => ' AND '. $curuser->agentnums_sql,
});
die "Legacy invoice #$legacyinvnum not found!" unless $legacy_cust_bill;
my $custnum = $legacy_cust_bill->custnum;
my $display_custnum = $legacy_cust_bill->cust_main->display_custnum;
my $link = "legacyinvnum=$legacyinvnum";
</%init>
--- NEW FILE: legacy_cust_bill-pdf.cgi ---
<% $content %>\
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
my $legacyinvnum;
my($query) = $cgi->keywords;
if ( $query =~ /^(\d+)(.pdf)?$/ ) { #.pdf probably not necessary anymore?
$legacyinvnum = $1;
} else {
$legacyinvnum = $cgi->param('legacyinvnum');
$legacyinvnum =~ s/\.pdf//i; #probably not necessary anymore
}
my $legacy_cust_bill = qsearchs({
'select' => 'legacy_cust_bill.*',
'table' => 'legacy_cust_bill',
'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
'hashref' => { 'legacyinvnum' => $legacyinvnum },
'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});
die "Legacy invoice #$legacyinvnum not found!" unless $legacy_cust_bill;
my $content = $legacy_cust_bill->content_pdf;
#maybe should name the file after legacyid if present, but have to clean it
#my $filename = $legacy_cust_bill->legacyid
http_header('Content-Type' => 'application/pdf' );
http_header('Content-Disposition' => "filename=$legacyinvnum.pdf" );
http_header('Content-Length' => length($content) );
#http_header('Cache-control' => 'max-age=60' );
</%init>
More information about the freeside-commits
mailing list