[freeside-commits] freeside/FS/FS/part_pkg flat.pm, 1.53, 1.54 prorate_Mixin.pm, 1.5, 1.6
Mark Wells
mark at wavetail.420.am
Tue Nov 9 13:40:21 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS/part_pkg
In directory wavetail.420.am:/tmp/cvs-serv11390
Modified Files:
flat.pm prorate_Mixin.pm
Log Message:
fix sync_bill_date near the end of the month, RT#10503
Index: prorate_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/prorate_Mixin.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- prorate_Mixin.pm 30 Oct 2010 23:22:31 -0000 1.5
+++ prorate_Mixin.pm 9 Nov 2010 21:40:18 -0000 1.6
@@ -33,8 +33,8 @@
=item calc_prorate CUST_PKG
Takes all the arguments of calc_recur, followed by a day of the month
-to prorate to. Calculates a prorated charge from the $sdate to that day,
-and sets the $sdate and $param->{months} accordingly.
+to prorate to (which must be <= 28). Calculates a prorated charge from
+the $sdate to that day, and sets the $sdate and $param->{months} accordingly.
Options:
- recur_fee: The charge to use for a complete billing period.
@@ -60,6 +60,17 @@
}
my $mend;
my $mstart;
+ # if cutoff day > 28, force it to the 1st of next month
+ if ( $cutoff_day > 28 ) {
+ $cutoff_day = 1;
+ # and if we are currently after the 28th, roll the current day
+ # forward to that day
+ if ( $mday > 28 ) {
+ $mday = 1;
+ #set $mnow = $mend so the amount billed will be zero
+ $mnow = timelocal(0,0,0,1,$mon == 11 ? 0 : $mon + 1,$year+($mon==11));
+ }
+ }
if ( $mday >= $cutoff_day ) {
$mend =
timelocal(0,0,0,$cutoff_day,$mon == 11 ? 0 : $mon + 1,$year+($mon==11));
Index: flat.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg/flat.pm,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -w -d -r1.53 -r1.54
--- flat.pm 30 Oct 2010 23:22:31 -0000 1.53
+++ flat.pm 9 Nov 2010 21:40:18 -0000 1.54
@@ -198,7 +198,7 @@
my $charge = $self->base_recur($cust_pkg);
if ( $self->option('sync_bill_date',1) ) {
my $next_bill = $cust_pkg->cust_main->next_bill_date;
- if ( defined($next_bill) and $next_bill != $$sdate ) {
+ if ( defined($next_bill) ) {
my $cutoff_day = (localtime($next_bill))[3];
$charge = $self->calc_prorate(@_, $cutoff_day);
}
More information about the freeside-commits
mailing list