From 2ea58badb5e0e2985a796f8b614912db9b6e43bf Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Mar 2009 10:04:00 +0000 Subject: [PATCH] add previous_balance-summary_only config, RT#4404 --- FS/FS/Conf.pm | 7 +++++++ FS/FS/cust_bill.pm | 52 ++++++++++++++++++++++++++++------------------------ 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 3921afdaa..3f150e1e7 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2486,6 +2486,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'previous_balance-summary_only', + 'section' => 'billing', + 'description' => 'Only show a single line summarizing the total previous balance rather than one line per invoice.', + 'type' => 'checkbox', + }, + + { 'key' => 'usps_webtools-userid', 'section' => 'UI', 'description' => 'Production UserID for USPS web tools. Enables USPS address standardization. See the USPS website, register and agree not to use the tools for batch purposes.', diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 704b3504a..1f78d72f4 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2080,33 +2080,37 @@ sub print_generic { push @sections, { 'description' => '', 'subtotal' => '' }; } - foreach my $line_item ( $conf->exists('disable_previous_balance') - ? () - : $self->_items_previous - ) + unless ( $conf->exists('disable_previous_balance') + || $conf->exists('previous_balance-summary_only') + ) { - my $detail = { - ext_description => [], - }; - $detail->{'ref'} = $line_item->{'pkgnum'}; - $detail->{'quantity'} = 1; - $detail->{'section'} = $previous_section; - $detail->{'description'} = &$escape_function($line_item->{'description'}); - if ( exists $line_item->{'ext_description'} ) { - @{$detail->{'ext_description'}} = map { - &$escape_function($_); - } @{$line_item->{'ext_description'}}; + + foreach my $line_item ( $self->_items_previous ) { + + my $detail = { + ext_description => [], + }; + $detail->{'ref'} = $line_item->{'pkgnum'}; + $detail->{'quantity'} = 1; + $detail->{'section'} = $previous_section; + $detail->{'description'} = &$escape_function($line_item->{'description'}); + if ( exists $line_item->{'ext_description'} ) { + @{$detail->{'ext_description'}} = map { + &$escape_function($_); + } @{$line_item->{'ext_description'}}; + } + $detail->{'amount'} = ( $old_latex ? '' : $money_char). + $line_item->{'amount'}; + $detail->{'product_code'} = $line_item->{'pkgpart'} || 'N/A'; + + push @detail_items, $detail; + push @buf, [ $detail->{'description'}, + $money_char. sprintf("%10.2f", $line_item->{'amount'}), + ]; } - $detail->{'amount'} = ( $old_latex ? '' : $money_char). - $line_item->{'amount'}; - $detail->{'product_code'} = $line_item->{'pkgpart'} || 'N/A'; - - push @detail_items, $detail; - push @buf, [ $detail->{'description'}, - $money_char. sprintf("%10.2f", $line_item->{'amount'}), - ]; + } - + if ( @pr_cust_bill && !$conf->exists('disable_previous_balance') ) { push @buf, ['','-----------']; push @buf, [ 'Total Previous Balance', -- 2.11.0