summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2012-01-14 23:02:42 +0000
committermark <mark>2012-01-14 23:02:42 +0000
commit84075b42e60c26ede49c9966af232c6308585c2f (patch)
treefe488947edcd99ba6e0a1cc16c1a03bf688ba02c
parent074464a707b2c8b83cc50cd0bb067660ef4d0f9f (diff)
adjust prorate_defer_bill, #16057
-rw-r--r--FS/FS/part_pkg/prorate_Mixin.pm14
1 files changed, 7 insertions, 7 deletions
diff --git a/FS/FS/part_pkg/prorate_Mixin.pm b/FS/FS/part_pkg/prorate_Mixin.pm
index 33879d907..63b63d760 100644
--- a/FS/FS/part_pkg/prorate_Mixin.pm
+++ b/FS/FS/part_pkg/prorate_Mixin.pm
@@ -75,11 +75,14 @@ sub calc_prorate {
my $charge = $self->base_recur($cust_pkg, $sdate) || 0;
+ my $add_period = $self->option('add_full_period',1);
+
my $mnow = $$sdate;
# if this is the first bill but the bill date has been set
# (by prorate_defer_bill), calculate from the setup date,
- # and append the setup fee to @$details.
+ # append the setup fee to @$details, and make sure to bill for
+ # a full period after the bill date.
if ( $self->option('prorate_defer_bill',1)
&& ! $cust_pkg->getfield('last_bill')
&& $cust_pkg->setup
@@ -88,6 +91,7 @@ sub calc_prorate {
#warn "[calc_prorate] #".$cust_pkg->pkgnum.": running deferred setup\n";
$param->{'setup_fee'} = $self->calc_setup($cust_pkg, $$sdate, $details);
$mnow = $cust_pkg->setup;
+ $add_period = 1;
}
my ($mend, $mstart);
@@ -103,12 +107,8 @@ sub calc_prorate {
# or periods up to freq_override if billing for an override interval
if ( ($param->{'freq_override'} || 0) > 1 ) {
$months += $param->{'freq_override'} - 1;
- } elsif ( ( $self->option('add_full_period',1)
- || $self->option('prorate_defer_bill',1) # necessary
- )
- && $months < $self->freq
- )
- {
+ }
+ elsif ( $add_period && $months < $self->freq) {
$months += $self->freq;
$$sdate = $self->add_freq($mstart);
}