summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-06-27 21:27:36 +0000
committerivan <ivan>2011-06-27 21:27:36 +0000
commite11e74e2b4680166624d06a13280342770664c4c (patch)
treef27043d1d7d0e1c345056ef27d4e33adabd45122
parent800a40a5154eaee7880f8a2afa3484ec97f5c121 (diff)
fix over-discounting resulting in an error, RT#13450
-rw-r--r--FS/FS/part_pkg/discount_Mixin.pm3
1 files changed, 2 insertions, 1 deletions
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)