[freeside-commits] freeside/FS/FS/Cron bill.pm,1.2.2.2,1.2.2.3
Ivan,,,
ivan at wavetail.420.am
Fri Jul 13 16:52:33 PDT 2007
Update of /home/cvs/cvsroot/freeside/FS/FS/Cron
In directory wavetail:/tmp/cvs-serv6059/FS/FS/Cron
Modified Files:
Tag: FREESIDE_1_7_BRANCH
bill.pm
Log Message:
fix race condition where ->apply_payments_and_credits could double-apply in rare cases
Index: bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Cron/bill.pm,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -d -r1.2.2.2 -r1.2.2.3
--- bill.pm 26 Jun 2007 15:36:48 -0000 1.2.2.2
+++ bill.pm 13 Jul 2007 23:52:31 -0000 1.2.2.3
@@ -80,14 +80,16 @@
my($cust_main,%saw);
foreach $cust_main ( @cust_main ) {
+
+ my $custnum = $cust_main->custnum;
# $^T not $time because -d is for pre-printing invoices
foreach my $cust_pkg (
grep { $_->expire && $_->expire <= $^T } $cust_main->ncancelled_pkgs
) {
my $error = $cust_pkg->cancel;
- warn "Error cancelling expired pkg ". $cust_pkg->pkgnum. " for custnum ".
- $cust_main->custnum. ": $error"
+ warn "Error cancelling expired pkg ". $cust_pkg->pkgnum.
+ " for custnum $custnum: $error"
if $error;
}
# $^T not $time because -d is for pre-printing invoices
@@ -101,8 +103,7 @@
) {
my $error = $cust_pkg->suspend;
warn "Error suspending package ". $cust_pkg->pkgnum.
- " for custnum ". $cust_main->custnum.
- ": $error"
+ " for custnum $custnum: $error"
if $error;
}
@@ -110,14 +111,16 @@
'invoice_time' => $invoice_time,
'resetup' => $opt{'s'},
);
- warn "Error billing, custnum ". $cust_main->custnum. ": $error" if $error;
+ warn "Error billing, custnum $custnum: $error" if $error;
- $cust_main->apply_payments_and_credits;
+ $error = $cust_main->apply_payments_and_credits;
+ warn "Error applying payments and credits, custnum $custnum: $error"
+ if $error;
$error = $cust_main->collect( 'invoice_time' => $time,
'freq' => $opt{'freq'},
);
- warn "Error collecting, custnum". $cust_main->custnum. ": $error" if $error;
+ warn "Error collecting, custnum $custnum: $error" if $error;
}
More information about the freeside-commits
mailing list