[freeside-commits] branch FREESIDE_3_BRANCH updated. f746168f9c0a003a2ccb7032c9feae37ca4e20d3

Mark Wells mark at 420.am
Wed Apr 29 18:15:43 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  f746168f9c0a003a2ccb7032c9feae37ca4e20d3 (commit)
      from  ff8b4b6909c09643439a4a2a7b0bc936b754e6d4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f746168f9c0a003a2ccb7032c9feae37ca4e20d3
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Apr 29 18:15:37 2015 -0700

    customize "previous balance" subtotal line, #34736

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4e2139b..38ccb6e 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4377,8 +4377,22 @@ and customer address. Include units.',
   {
     'key'         => 'previous_balance-exclude_from_total',
     'section'     => 'invoicing',
-    'description' => 'Do not include previous balance in the \'Total\' line.  Only meaningful when invoice_sections is false.  Optionally provide text to override the Total New Charges description',
-    'type'        => [ qw(checkbox text) ],
+    'description' => 'Show separate totals for previous invoice balance and new charges. Only meaningful when invoice_sections is false.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'previous_balance-text',
+    'section'     => 'invoicing',
+    'description' => 'Text for the label of the total previous balance, when it is shown separately. Defaults to "Previous Balance".',
+    'type'        => 'text',
+  },
+
+  {
+    'key'         => 'previous_balance-text-total_new_charges',
+    'section'     => 'invoicing',
+    'description' => 'Text for the label of the total of new charges, when it is shown separately. If invoice_show_prior_due_date is enabled, the due date of current charges will be appended. Defaults to "Total New Charges".',
+    'type'        => 'text',
   },
 
   {
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 3694f8a..f508685 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -138,6 +138,13 @@ If you need to continue using the old Form 477 report, turn on the
     $conf->delete('tax-cust_exempt-groups-require_individual_nums');
   }
 
+  # boolean+text previous_balance-exclude_from_total is now two separate options
+  my $total_new_charges = $conf->config('previous_balance-exclude_from_total');
+  if (length($total_new_charges) > 0) {
+    $conf->set('previous_balance-text-total_new_charges', $total_new_charges);
+    $conf->set('previous_balance-exclude_from_total', '');
+  }
+
 }
 
 sub upgrade_overlimit_groups {
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 0de124c..a195e5d 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2862,20 +2862,26 @@ sub _items_total {
 
   my @items;
   my ($pr_total) = $self->previous;
-  my ($new_charges_desc, $new_charges_amount);
+  my ($previous_charges_desc, $new_charges_desc, $new_charges_amount);
 
   if ( $conf->exists('previous_balance-exclude_from_total') ) {
+    # can we do some caching on this stuff? it's going to change infrequently
+    # in production
+    $previous_charges_desc = $self->mt(
+      $conf->config('previous_balance-text') || 'Previous Balance'
+    );
+
     # then return separate lines for previous balance and total new charges
     if ( $pr_total ) {
       push @items,
-        { total_item    => $self->mt('Previous Balance'),
+        { total_item    => $previous_charges_desc,
           total_amount  => sprintf('%.2f',$pr_total)
         };
     }
     $new_charges_desc = $self->mt(
-      $conf->config('previous_balance-exclude_from_total')
+      $conf->config('previous_balance-text-total_new_charges')
        || 'Total New Charges'
-    ); # localize 'Total New Charges' or whatever's in the config
+    );
 
     $new_charges_amount = $self->charged;
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm      |   18 ++++++++++++++++--
 FS/FS/Upgrade.pm   |    7 +++++++
 FS/FS/cust_bill.pm |   14 ++++++++++----
 3 files changed, 33 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list