[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.60, 1.61 prorate.pm, 1.26, 1.27 prorate_Mixin.pm, 1.11, 1.12
Ivan,,,
ivan at wavetail.420.am
Mon Mar 14 17:04:32 PDT 2011
- Previous message: [freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.59, 1.60 prorate.pm, 1.25, 1.26 prorate_Mixin.pm, 1.10, 1.11 recur_Common.pm, 1.9, 1.10
- Next message: [freeside-commits] freeside/httemplate/search cust_bill_pkg.cgi, 1.40, 1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv8558
Modified Files:
flat.pm prorate.pm prorate_Mixin.pm
Log Message:
fix prorates & recurring fees with recur_Common-using packages, RT#11993
Index: prorate_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate_Mixin.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- prorate_Mixin.pm 14 Mar 2011 23:39:14 -0000 1.11
+++ prorate_Mixin.pm 15 Mar 2011 00:04:30 -0000 1.12
@@ -23,14 +23,14 @@
...
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
-=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
@@ -48,12 +48,12 @@
=cut
sub calc_prorate {
- my $self = shift;
- my ($cust_pkg, $sdate, $details, $param) = @_;
- my $cutoff_day = $self->cutoff_day or die "no cutoff_day"; #($cust_pkg)
+ 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;
- if ( $cutoff_day ) {
+
+ #if ( $cutoff_day ) {
my $mnow = $$sdate;
# if this is the first bill but the bill date has been set
@@ -86,19 +86,9 @@
$param->{'months'} = $months;
$charge = sprintf('%.2f', $permonth * $months);
- }
- return $charge;
-}
-
-=item cutoff_day
-
-Returns the value of the "cutoff_day" option, or 1.
-
-=cut
+ #}
-sub cutoff_day {
- my $self = shift;
- $self->option('cutoff_day', 1) || 1;
+ return $charge;
}
=item prorate_setup CUST_PKG SDATE
Index: prorate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -d -r1.26 -r1.27
--- prorate.pm 14 Mar 2011 23:39:14 -0000 1.26
+++ prorate.pm 15 Mar 2011 00:04:30 -0000 1.27
@@ -40,7 +40,8 @@
sub calc_recur {
my $self = shift;
- return $self->calc_prorate(@_) - $self->calc_discount(@_);
+ my $cutoff_day = $self->option('cutoff_day') || 1;
+ return $self->calc_prorate(@_, $cutoff_day) - $self->calc_discount(@_);
}
1;
Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -w -d -r1.60 -r1.61
--- flat.pm 14 Mar 2011 23:39:14 -0000 1.60
+++ flat.pm 15 Mar 2011 00:04:30 -0000 1.61
@@ -126,8 +126,8 @@
if $self->option('recur_temporality', 1) eq 'preceding' && $last_bill == 0;
my $charge = $self->base_recur($cust_pkg, $sdate);
- if ( my $cutoff_day = $self->flat_cutoff_day($cust_pkg) ) {
- $charge = $self->calc_prorate(@_);
+ if ( my $cutoff_day = $self->cutoff_day($cust_pkg) ) {
+ $charge = $self->calc_prorate(@_, $cutoff_day);
}
elsif ( $param->{freq_override} ) {
# XXX not sure if this should be mutually exclusive with sync_bill_date.
@@ -140,7 +140,7 @@
return sprintf('%.2f', $charge - $discount);
}
-sub flat_cutoff_day {
+sub cutoff_day {
my $self = shift;
my $cust_pkg = shift;
if ( $self->option('sync_bill_date',1) ) {
- Previous message: [freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.59, 1.60 prorate.pm, 1.25, 1.26 prorate_Mixin.pm, 1.10, 1.11 recur_Common.pm, 1.9, 1.10
- Next message: [freeside-commits] freeside/httemplate/search cust_bill_pkg.cgi, 1.40, 1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list