summaryrefslogtreecommitdiff
path: root/FS/FS/cust_bill.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-10-01 21:05:14 -0700
committerMark Wells <mark@freeside.biz>2015-10-01 21:05:14 -0700
commitbf6c11bc520aa4e4e0fa75f0469c66a11cf11a31 (patch)
tree69f87245d3f2a731f57d07ff34323780e5ad22bd /FS/FS/cust_bill.pm
parent55de788f065cebc8273bcc52befb82cec9eff129 (diff)
refine disable_previous_balance behavior to show new charges only, #35222, #37396
Diffstat (limited to 'FS/FS/cust_bill.pm')
-rw-r--r--FS/FS/cust_bill.pm16
1 files changed, 13 insertions, 3 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 09424ba..6546bfa 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2836,8 +2836,7 @@ sub _items_total {
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
+ # if enabled, specifically add a line for the previous balance total
$previous_charges_desc = $self->mt(
$conf->config('previous_balance-text') || 'Previous Balance'
);
@@ -2849,6 +2848,12 @@ sub _items_total {
total_amount => sprintf('%.2f',$pr_total)
};
}
+ }
+
+ if ( $conf->exists('previous_balance-exclude_from_total')
+ or !$self->enable_previous ) {
+ # show new charges only
+
$new_charges_desc = $self->mt(
$conf->config('previous_balance-text-total_new_charges')
|| 'Total New Charges'
@@ -2857,9 +2862,14 @@ sub _items_total {
$new_charges_amount = $self->charged;
} else {
+ # show new charges + previous invoice total
$new_charges_desc = $self->mt('Total Charges');
- $new_charges_amount = sprintf('%.2f',$self->charged + $pr_total);
+ if ( $self->enable_previous ) {
+ $new_charges_amount = sprintf('%.2f', $self->charged + $pr_total);
+ } else {
+ $new_charges_amount = sprintf('%.2f', $self->charged);
+ }
}