diff options
| author | Mark Wells <mark@freeside.biz> | 2012-03-24 16:34:49 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2012-03-24 16:34:49 -0700 |
| commit | 2ee2d0cf73e191a4fd276675eff543675a0c9676 (patch) | |
| tree | c3b500ce96ab86b8bd2a537bd95eaf643d7fad70 | |
| parent | 7fd2b8885728374bbee5459fadd2f712bd4d9ec0 (diff) | |
fix flat-rate discounts when charging zero months, #17043
| -rw-r--r-- | FS/FS/part_pkg/discount_Mixin.pm | 4 |
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 7de3bfe42..7c53a8c4c 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, |
