diff options
author | Mark Wells <mark@freeside.biz> | 2015-11-12 15:34:55 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-11-12 16:52:08 -0800 |
commit | 979f2b7488f2399fb2e4c7c98a57536b5cf1bff7 (patch) | |
tree | 46ef776f88ef66b082ecee69e32415bcbe8f9f51 | |
parent | ed817ff4b918df398fa89835909723c7d8f311f8 (diff) |
fix selfservice display when there are term discounts defined, looks like fallout from #15539
-rw-r--r-- | FS/FS/cust_main/Billing.pm | 3 | ||||
-rw-r--r-- | FS/FS/cust_main/Billing_Discount.pm | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index b7837c598..333b07f1c 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -1357,7 +1357,8 @@ sub _make_lines { } else { # the normal case $next_bill = $part_pkg->add_freq($sdate, $options{freq_override} || 0); - return "unparsable frequency: ". $part_pkg->freq + return "unparsable frequency: ". + ($options{freq_override} || $part_pkg->freq) if $next_bill == -1; } diff --git a/FS/FS/cust_main/Billing_Discount.pm b/FS/FS/cust_main/Billing_Discount.pm index 9dda389f6..e64c76134 100644 --- a/FS/FS/cust_main/Billing_Discount.pm +++ b/FS/FS/cust_main/Billing_Discount.pm @@ -90,8 +90,11 @@ sub discount_terms { my @discount_pkgs = $self->_discount_pkgs_and_bill; shift @discount_pkgs; #discard bill; - - map { $terms{$_->months} = 1 } + + # convert @discount_pkgs (the list of packages that have available discounts) + # to a list of distinct term lengths in months, and strip any decimal places + # from the number of months, not that it should have any + map { $terms{sprintf('%.0f', $_->months)} = 1 } grep { $_->months && $_->months > 1 } map { $_->discount } map { $_->part_pkg->part_pkg_discount } |