summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/cust_bill.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 1801b125f..e1281e372 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -1327,6 +1327,9 @@ sub batch_card {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
+ $dbh->do("LOCK TABLE pay_batch IN SHARE ROW EXCLUSIVE MODE")
+ or return "Cannot lock pay_batch: " . $dbh->errstr;
+
my $pay_batch = qsearchs('pay_batch', {'status' => 'O'});
unless ( $pay_batch ) {