projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git]
/
FS
/
FS
/
part_pkg
/
discount_Mixin.pm
diff --git
a/FS/FS/part_pkg/discount_Mixin.pm
b/FS/FS/part_pkg/discount_Mixin.pm
index
dcca343
..
801737b
100644
(file)
--- a/
FS/FS/part_pkg/discount_Mixin.pm
+++ b/
FS/FS/part_pkg/discount_Mixin.pm
@@
-4,6
+4,7
@@
use strict;
use vars qw( %info );
use Time::Local qw( timelocal );
use List::Util qw( min );
use vars qw( %info );
use Time::Local qw( timelocal );
use List::Util qw( min );
+use FS::Record qw( qsearchs );
use FS::cust_pkg;
use FS::cust_bill_pkg_discount;
use FS::cust_pkg;
use FS::cust_bill_pkg_discount;
@@
-141,11
+142,12
@@
sub calc_discount {
} else {
# we are calculating a recurring fee discount. estimate the recurring
} 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);
# round this, because the real recur charge is rounded
$recur_charge = sprintf('%.2f', $recur_charge);
@@
-232,7
+234,6
@@
sub calc_discount {
'pkgdiscountnum' => $cust_pkg_discount->pkgdiscountnum,
'amount' => $amount,
'months' => $months,
'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;
};
push @{ $param->{'discounts'} }, $cust_bill_pkg_discount;
$tot_discount += $amount;