From 2ee2d0cf73e191a4fd276675eff543675a0c9676 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 24 Mar 2012 16:34:49 -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 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, -- 2.20.1