diff options
author | Mark Wells <mark@freeside.biz> | 2015-12-04 16:45:29 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-12-04 16:48:10 -0800 |
commit | b663d0e826c248c218dc9365d4e2d74db2648e48 (patch) | |
tree | e0c1e0043b097c590f13d5754881b50c36d120b6 /FS/FS/part_pkg/discount_Mixin.pm | |
parent | d2916480d64ae7b0b86bd73feabc1c5a45b664f7 (diff) |
correctly handle percentage discounts with duration less than package billing cycle, #39165, from #19173
Diffstat (limited to 'FS/FS/part_pkg/discount_Mixin.pm')
-rw-r--r-- | FS/FS/part_pkg/discount_Mixin.pm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm index 4c8675346..801737b04 100644 --- a/FS/FS/part_pkg/discount_Mixin.pm +++ b/FS/FS/part_pkg/discount_Mixin.pm @@ -142,11 +142,12 @@ sub calc_discount { } else { # we are calculating a recurring fee discount. estimate the recurring - # fee: - # XXX it would be more accurate for calc_recur to just _tell us_ what - # it's going to charge + # fee. Note we use $months here rather than $chg_months so that if the + # remaining discount amount is for less time than the package period, + # the "estimated recurring fee" is only for as long as the discount + # lasts. - my $recur_charge = $br * $chg_months / $self->freq; + my $recur_charge = $br * $months / $self->freq; # round this, because the real recur charge is rounded $recur_charge = sprintf('%.2f', $recur_charge); @@ -233,7 +234,6 @@ sub calc_discount { 'pkgdiscountnum' => $cust_pkg_discount->pkgdiscountnum, 'amount' => $amount, 'months' => $months, - # 'setuprecur' is implied by the cust_pkg_discount link }; push @{ $param->{'discounts'} }, $cust_bill_pkg_discount; $tot_discount += $amount; |