summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2011-01-08 01:40:32 +0000
committermark <mark>2011-01-08 01:40:32 +0000
commit2eaadb3479c1ccf1a0c3e2fd9247ba8af5fdd563 (patch)
tree8f781d8c7b3e8d852e93466e8bc2e10c2ec0b5b6
parentfc0c27ec52341eaa28986d07743d78c35b28bf1f (diff)
fix introrate/prorate interaction, RT#11018
-rw-r--r--FS/FS/part_pkg/flat.pm6
-rw-r--r--FS/FS/part_pkg/prorate_Mixin.pm2
-rw-r--r--FS/FS/part_pkg/subscription.pm2
3 files changed, 5 insertions, 5 deletions
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index b5e0fa023..f9d1b4e19 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -107,7 +107,7 @@ sub calc_recur {
return 0
if $self->option('recur_temporality', 1) eq 'preceding' && $last_bill == 0;
- my $charge = $self->base_recur($cust_pkg);
+ my $charge = $self->base_recur($cust_pkg, $sdate);
if ( $self->option('sync_bill_date',1) ) {
my $next_bill = $cust_pkg->cust_main->next_bill_date;
if ( defined($next_bill) ) {
@@ -127,7 +127,7 @@ sub calc_recur {
}
sub base_recur {
- my($self, $cust_pkg) = @_;
+ my($self, $cust_pkg, $sdate) = @_;
$self->option('recur_fee', 1) || 0;
}
@@ -151,7 +151,7 @@ sub calc_remain {
my $next_bill = $cust_pkg->getfield('bill') || 0;
- return 0 if ! $self->base_recur($cust_pkg)
+ return 0 if ! $self->base_recur($cust_pkg, \$time)
|| ! $next_bill
|| $next_bill < $time;
diff --git a/FS/FS/part_pkg/prorate_Mixin.pm b/FS/FS/part_pkg/prorate_Mixin.pm
index 3f3d86f75..139568de4 100644
--- a/FS/FS/part_pkg/prorate_Mixin.pm
+++ b/FS/FS/part_pkg/prorate_Mixin.pm
@@ -49,7 +49,7 @@ sub calc_prorate {
my $self = shift;
my ($cust_pkg, $sdate, $details, $param, $cutoff_day) = @_;
- my $charge = $self->option('recur_fee',1) || 0;
+ my $charge = $self->base_recur($cust_pkg, $sdate) || 0;
if($cutoff_day) {
# only works for freq >= 1 month; probably can't be fixed
my $mnow = $$sdate;
diff --git a/FS/FS/part_pkg/subscription.pm b/FS/FS/part_pkg/subscription.pm
index 3c5f96b89..bf88f516f 100644
--- a/FS/FS/part_pkg/subscription.pm
+++ b/FS/FS/part_pkg/subscription.pm
@@ -98,7 +98,7 @@ sub calc_recur {
$$sdate = timelocal(0,0,0,$cutoff_day,$mon,$year);
- my $br = $self->base_recur($cust_pkg);
+ my $br = $self->base_recur($cust_pkg, $sdate);
my $discount = $self->calc_discount($cust_pkg, $sdate, $details, $param);