[freeside-commits] freeside/FS/FS/Cron bill.pm,1.2.2.3,1.2.2.4
Jeff Finucane,420,,
jeff at wavetail.420.am
Mon Jun 30 22:01:30 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/Cron
In directory wavetail.420.am:/tmp/cvs-serv21844/FS/FS/Cron
Modified Files:
Tag: FREESIDE_1_7_BRANCH
bill.pm
Log Message:
correct internal reason searching, prevent interleaved suspend/cancel/expire/adjourn, backporting and refactoring
Index: bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Cron/bill.pm,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -d -r1.2.2.3 -r1.2.2.4
--- bill.pm 13 Jul 2007 23:52:31 -0000 1.2.2.3
+++ bill.pm 1 Jul 2008 05:01:28 -0000 1.2.2.4
@@ -87,7 +87,12 @@
foreach my $cust_pkg (
grep { $_->expire && $_->expire <= $^T } $cust_main->ncancelled_pkgs
) {
- my $error = $cust_pkg->cancel;
+ my $cpr = $cust_pkg->last_cust_pkg_reason('expire');
+ my $error = $cust_pkg->cancel($cpr ? ( 'reason' => $cpr->reasonnum,
+ 'reason_otaker' => $cpr->otaker
+ )
+ : ()
+ );
warn "Error cancelling expired pkg ". $cust_pkg->pkgnum.
" for custnum $custnum: $error"
if $error;
@@ -101,7 +106,13 @@
}
$cust_main->ncancelled_pkgs
) {
- my $error = $cust_pkg->suspend;
+ my $cpr = $cust_pkg->last_cust_pkg_reason('adjourn')
+ if ($cust_pkg->adjourn && $cust_pkg->adjourn < $^T);
+ my $error = $cust_pkg->suspend($cpr ? ( 'reason' => $cpr->reasonnum,
+ 'reason_otaker' => $cpr->otaker
+ )
+ : ()
+ );
warn "Error suspending package ". $cust_pkg->pkgnum.
" for custnum $custnum: $error"
if $error;
More information about the freeside-commits
mailing list