& /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') ) {
    <% mt('Re-print this invoice') |h %>
%   if ( grep { $_ ne 'POST' } $legacy_cust_bill->cust_main->invoicing_list ) { 
        | <% mt('Re-email this invoice') |h %>
%   } 
%   if ( $conf->exists('hylafax') && length($legacy_cust_bill->cust_main->fax) ) { 
        | <% mt('Re-fax this invoice') |h %>
%   } 
    
% } 
% if ( length($legacy_cust_bill->content_pdf) ) {
  <% mt('View typeset invoice PDF') |h %>
  
% } 
<% $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>