From bae80d2262c304b787a882780dda0bbb3613d9a8 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 12 Jul 2016 15:46:47 -0700 Subject: [PATCH] option to show all package locations on invoice, #71474 --- FS/FS/Conf.pm | 7 +++++++ FS/FS/Template_Mixin.pm | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 672d4897a..205c1d2cd 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -3602,6 +3602,13 @@ and customer address. Include units.', }, { + 'key' => 'invoice-all_pkg_addresses', + 'section' => 'invoicing', + 'description' => 'Show all package addresses on invoices, even the default.', + 'type' => 'checkbox', + }, + + { 'key' => 'invoice-unitprice', 'section' => 'invoicing', 'description' => 'Enable unit pricing on invoices and quantities on packages.', diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index ddc933e4a..23555294e 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -3186,7 +3186,9 @@ sub _items_cust_bill_pkg { # for location labels: use default location on the invoice date my $default_locationnum; - if ( $self->custnum ) { + if ( $conf->exists('invoice-all_pkg_addresses') ) { + $default_locationnum = 0; # treat them all as non-default + } elsif ( $self->custnum ) { my $h_cust_main; my @h_search = FS::h_cust_main->sql_h_search($self->_date); $h_cust_main = qsearchs({ @@ -3358,7 +3360,7 @@ sub _items_cust_bill_pkg { # location, and we're not grouping items by location already if ( $cust_pkg->locationnum != $default_locationnum and !defined($locationnum) ) { - my $loc = $cust_pkg->location_label; + my $loc = $cust_pkg->location_label(no_prefix => 1); $loc = substr($loc, 0, $maxlength). '...' if $format eq 'latex' && length($loc) > $maxlength; push @d, &{$escape_function}($loc); @@ -3468,7 +3470,7 @@ sub _items_cust_bill_pkg { # location, and we're not grouping items by location already if ( $cust_pkg->locationnum != $default_locationnum and !defined($locationnum) ) { - my $loc = $cust_pkg->location_label; + my $loc = $cust_pkg->location_label(no_prefix => 1); $loc = substr($loc, 0, $maxlength). '...' if $format eq 'latex' && length($loc) > $maxlength; push @d, &{$escape_function}($loc); -- 2.11.0