projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
continue prorate cleanup, #10630
[freeside.git]
/
FS
/
FS
/
part_pkg
/
prorate_Mixin.pm
diff --git
a/FS/FS/part_pkg/prorate_Mixin.pm
b/FS/FS/part_pkg/prorate_Mixin.pm
index
1aa2f2c
..
29409fa
100644
(file)
--- a/
FS/FS/part_pkg/prorate_Mixin.pm
+++ b/
FS/FS/part_pkg/prorate_Mixin.pm
@@
-23,14
+23,14
@@
sub calc_recur {
...
if( conditions that trigger prorate ) {
# sets $$sdate and $param->{'months'}, returns the prorated charge
...
if( conditions that trigger prorate ) {
# sets $$sdate and $param->{'months'}, returns the prorated charge
- $charges = $self->calc_prorate($cust_pkg, $sdate, $param);
+ $charges = $self->calc_prorate($cust_pkg, $sdate, $param
, $cutoff_day
);
}
...
}
=head METHODS
}
...
}
=head METHODS
-=item calc_prorate CUST_PKG SDATE DETAILS PARAM
+=item calc_prorate CUST_PKG SDATE DETAILS PARAM
CUTOFF_DAY
Takes all the arguments of calc_recur. Calculates a prorated charge from
the $sdate to the cutoff day for this package definition, and sets the $sdate
Takes all the arguments of calc_recur. Calculates a prorated charge from
the $sdate to the cutoff day for this package definition, and sets the $sdate
@@
-48,21
+48,20
@@
day arrives.
=cut
sub calc_prorate {
=cut
sub calc_prorate {
- my $self = shift;
- my ($cust_pkg, $sdate, $details, $param) = @_;
- my $cutoff_day = $self->cutoff_day($cust_pkg) or return; #die?
+ my ($self, $cust_pkg, $sdate, $details, $param, $cutoff_day) = @_;
+ die "no cutoff_day" unless $cutoff_day;
my $charge = $self->base_recur($cust_pkg, $sdate) || 0;
my $charge = $self->base_recur($cust_pkg, $sdate) || 0;
- if ( $cutoff_day ) {
+
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.
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.
- if ( $self->option('prorate_defer_bill')
+ if ( $self->option('prorate_defer_bill'
,1
)
and ! $cust_pkg->getfield('last_bill')
and $cust_pkg->setup ) {
and ! $cust_pkg->getfield('last_bill')
and $cust_pkg->setup ) {
- warn "[calc_prorate] #".$cust_pkg->pkgnum.": running deferred setup\n";
+
#
warn "[calc_prorate] #".$cust_pkg->pkgnum.": running deferred setup\n";
$param->{'setup_fee'} = $self->calc_setup($cust_pkg, $$sdate, $details);
$mnow = $cust_pkg->setup;
}
$param->{'setup_fee'} = $self->calc_setup($cust_pkg, $$sdate, $details);
$mnow = $cust_pkg->setup;
}
@@
-86,7
+85,7
@@
sub calc_prorate {
$param->{'months'} = $months;
$charge = sprintf('%.2f', $permonth * $months);
$param->{'months'} = $months;
$charge = sprintf('%.2f', $permonth * $months);
- }
+
return $charge;
}
return $charge;
}