From: ivan Date: Mon, 27 Jun 2011 21:27:35 +0000 (+0000) Subject: fix over-discounting resulting in an error, RT#13450 X-Git-Tag: freeside_2_3_0~61 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=2a4b095a488228d7c53201031ad67677c9c11390 fix over-discounting resulting in an error, RT#13450 --- diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm index a789ab309..87ec3a708 100644 --- a/FS/FS/part_pkg/discount_Mixin.pm +++ b/FS/FS/part_pkg/discount_Mixin.pm @@ -130,11 +130,12 @@ sub calc_discount { && ! defined $param->{'setup_charge'}); die "error discounting: $error" if $error; + $amount = min($amount, $br); $amount *= $months; $amount = sprintf('%.2f', $amount); next unless $amount > 0; - + # transfer remainder of discount, if any, to setup if ( $discount->setup && $discount->amount && (!$discount->months || $discount->months != 1)