Bug fix to #73185, discovered via #71513
[freeside.git] / FS / FS / Cron / tax_rate_update.pm
index 2c021b8..fec696f 100755 (executable)
@@ -31,7 +31,7 @@ sub tax_rate_update {
   my %opt = @_;
 
   my $oldAutoCommit = $FS::UID::AutoCommit;
-  $FS::UID::AutoCommit = 0;
+  local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
 
   my $conf = FS::Conf->new;
@@ -40,6 +40,7 @@ sub tax_rate_update {
 
   my $taxname = $conf->config('tax_district_taxname') || '';
 
+  FS::cust_main_county->lock_table;
   if ($method eq 'wa_sales') {
     # download the update file
     my $now = DateTime->now;