From 98550895c14615062ba0b03199a58144796829de Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 24 Mar 2012 16:35:26 -0700 Subject: [PATCH] fix flat-rate discounts when charging zero months, #17043 --- FS/FS/part_pkg/discount_Mixin.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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, -- 2.11.0