summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-03-24 16:35:26 -0700
committerMark Wells <mark@freeside.biz>2012-03-24 16:35:26 -0700
commit98550895c14615062ba0b03199a58144796829de (patch)
tree92f4e4b933af7ca434a448dd7d0ac3953037d9a6 /FS
parentdf1375c1ce6c844dd81afb0001bd0a4c1e96ca2f (diff)
fix flat-rate discounts when charging zero months, #17043
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_pkg/discount_Mixin.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm
index 335ff6d0f..1edf258d6 100644
--- a/FS/FS/part_pkg/discount_Mixin.pm
+++ b/FS/FS/part_pkg/discount_Mixin.pm
@@ -84,7 +84,9 @@ sub calc_discount {
$amount += $discount->amount
if $cust_pkg->pkgpart == $param->{'real_pkgpart'};
$amount += sprintf('%.2f', $discount->percent * $br / 100 );
- my $chg_months = $param->{'months'} || $cust_pkg->part_pkg->freq;
+ my $chg_months = defined($param->{'months'}) ?
+ $param->{'months'} :
+ $cust_pkg->part_pkg->freq;
my $months = $discount->months
? min( $chg_months,