);
# but NOT $conf
use vars qw( $invoice_lines @buf ); #yuck
-use List::Util qw(sum first);
+use List::Util qw(sum); #can't import first, it conflicts with cust_main.first
use Date::Format;
use Date::Language;
use Text::Template 1.20;
unless $format =~ /^(latex|html|template)$/;
my $cust_main = $self->cust_main || $self->prospect_main;
- $cust_main->payname( $cust_main->first. ' '. $cust_main->getfield('last') )
- unless $cust_main->payname
- && $cust_main->payby !~ /^(CARD|DCRD|CHEK|DCHK)$/;
my $locale = $params{'locale'} || $cust_main->locale;
'custnum' => $cust_main->display_custnum,
'prospectnum' => $cust_main->prospectnum,
'agent_custid' => &$escape_function($cust_main->agent_custid),
- ( map { $_ => &$escape_function($cust_main->$_()) } qw(
- payname company address1 address2 city state zip fax
- )),
+ ( map { $_ => &$escape_function($cust_main->$_()) }
+ qw( company address1 address2 city state zip fax )
+ ),
+ 'payname' => &$escape_function( $cust_main->invoice_attn
+ || $cust_main->contact_firstlast ),
#global config
'ship_enable' => $conf->exists('invoice-ship_address'),
my @address = ();
$invoice_data{'address'} = \@address;
push @address,
- $cust_main->payname.
- ( ( $cust_main->payby eq 'BILL' ) && $cust_main->payinfo
- ? " (P.O. #". $cust_main->payinfo. ")"
- : ''
+ $invoice_data{'payname'}.
+ ( $cust_main->po_number
+ ? " (P.O. #". $cust_main->po_number. ")"
+ : ''
)
;
push @address, $cust_main->company
# create a tax section if we don't yet have one
my $tax_description = 'Taxes, Surcharges, and Fees';
- my $tax_section = first { $_->{description} eq $tax_description } @sections;
+ my $tax_section =
+ List::Util::first { $_->{description} eq $tax_description } @sections;
if (!$tax_section) {
$tax_section = { 'description' => $tax_description };
push @sections, $tax_section if $multisection;