[freeside-commits] freeside/FS/FS/cust_main Billing.pm,1.48,1.49
Mark Wells
mark at wavetail.420.am
Sat Jan 28 15:20:13 PST 2012
Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv27110/FS/FS/cust_main
Modified Files:
Billing.pm
Log Message:
future package unsuspend date, #14144
Index: Billing.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing.pm,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -w -d -r1.48 -r1.49
--- Billing.pm 24 Jan 2012 22:25:13 -0000 1.48
+++ Billing.pm 28 Jan 2012 23:20:10 -0000 1.49
@@ -129,6 +129,14 @@
else { warn $error; }
}
+ $error = $self->unsuspend_resumed_pkgs( day_end( $options{actual_time} ) );
+ if ( $error ) {
+ $error = "Error resuming custnum ".$self->custnum. ": $error";
+ if ( $options{fatal} && $options{fatal} eq 'return' ) { return $error; }
+ elsif ( $options{fatal} ) { die $error; }
+ else { warn $error; }
+ }
+
$job->update_statustext('20,billing packages') if $job;
$error = $self->bill( %options );
if ( $error ) {
@@ -185,7 +193,7 @@
push @errors, 'pkgnum '.$cust_pkg->pkgnum.": $error" if $error;
}
- scalar(@errors) ? join(' / ', @errors) : '';
+ join(' / ', @errors);
}
@@ -227,7 +235,25 @@
push @errors, 'pkgnum '.$cust_pkg->pkgnum.": $error" if $error;
}
- scalar(@errors) ? join(' / ', @errors) : '';
+ join(' / ', @errors);
+
+}
+
+sub unsuspend_resumed_pkgs {
+ my ( $self, $time, %options ) = @_;
+
+ my @unsusp_pkgs = $self->ncancelled_pkgs( {
+ 'extra_sql' => " AND resume IS NOT NULL AND resume > 0 AND resume <= $time "
+ } );
+
+ my @errors = ();
+
+ foreach my $cust_pkg ( @unsusp_pkgs ) {
+ my $error = $cust_pkg->unsuspend( 'time' => $time );
+ push @errors, 'pkgnum '.$cust_pkg->pkgnum.": $error" if $error;
+ }
+
+ join(' / ', @errors);
}
@@ -2168,6 +2194,7 @@
cancel_expired_pkgs
suspend_adjourned_pkgs
+ unsuspend_resumed_pkgs
bill
(do_cust_event pre-bill)
More information about the freeside-commits
mailing list