From 42292b1e5813f6e9657f08137dffc68a3c810b01 Mon Sep 17 00:00:00 2001 From: Rob Van Dam Date: Thu, 6 Aug 2015 16:56:15 -0600 Subject: [PATCH] Renamed $br to $br_permonth to clarify value is base_recur_permonth, NOT base_recur --- FS/FS/part_pkg/discount_Mixin.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/FS/FS/part_pkg/discount_Mixin.pm b/FS/FS/part_pkg/discount_Mixin.pm index 31802758c..47cb2516b 100644 --- a/FS/FS/part_pkg/discount_Mixin.pm +++ b/FS/FS/part_pkg/discount_Mixin.pm @@ -40,8 +40,8 @@ sub calc_discount { my($self, $cust_pkg, $sdate, $details, $param ) = @_; my $conf = new FS::Conf; - my $br = $self->base_recur_permonth($cust_pkg, $sdate); - $br += $param->{'override_charges'} if $param->{'override_charges'}; + my $br_permonth = $self->base_recur_permonth($cust_pkg, $sdate); + $br_permonth += $param->{'override_charges'} if $param->{'override_charges'}; my $tot_discount = 0; #UI enforces just 1 for now, will need ordering when they can be stacked @@ -83,7 +83,7 @@ sub calc_discount { my $amount = 0; $amount += $discount->amount if $cust_pkg->pkgpart == $param->{'real_pkgpart'}; - $amount += sprintf('%.2f', $discount->percent * $br / 100 ); + $amount += sprintf('%.2f', $discount->percent * $br_permonth / 100 ); my $chg_months = defined($param->{'months'}) ? $param->{'months'} : $cust_pkg->part_pkg->freq; @@ -133,7 +133,7 @@ sub calc_discount { }; } - $amount = min($amount, $br); + $amount = min($amount, $br_permonth); $amount *= $months; } @@ -147,9 +147,9 @@ sub calc_discount { && !defined $param->{'setup_charge'} ) { - $discount_left = $br - $amount; + $discount_left = $br_permonth - $amount; if ( $discount_left < 0 ) { - $amount = $br; + $amount = $br_permonth; $param->{'discount_left_setup'}{$discount->discountnum} = 0 - $discount_left; } @@ -188,7 +188,7 @@ sub calc_discount { #} #push @$details, $d; - #push @$details, sprintf( $format, $money_char, $br ); + #push @$details, sprintf( $format, $money_char, $br_permonth ); } -- 2.11.0