[freeside-commits] branch FREESIDE_4_BRANCH updated. 230206b7fb2be0f68648b1cf5ef529fc4ab77f6c

Mark Wells mark at 420.am
Wed Nov 16 14:12:08 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  230206b7fb2be0f68648b1cf5ef529fc4ab77f6c (commit)
       via  1be5a5bf99a52edd36ea8bade4786b9d082f557d (commit)
      from  4c4689fcc39ce5829a48aec2cd60bf4efdc827bc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 230206b7fb2be0f68648b1cf5ef529fc4ab77f6c
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Nov 16 14:08:09 2016 -0800

    fix warning

diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index 92490bb..6b3d6ca 100644
--- a/FS/FS/Misc/Geo.pm
+++ b/FS/FS/Misc/Geo.pm
@@ -210,13 +210,13 @@ sub wa_sales {
         if ( lc($text) eq 'location code' ) {
           $p->get_tag('td'); # skip to the next column
           undef $u;
-          $u = $p->get_token until $u->[0] eq 'T'; # and then skip non-text
+          $u = $p->get_token until ($u->[0] || '') eq 'T'; # and then skip non-text
           $return->{'district'} = $u->[1];
         }
         elsif ( lc($text) eq 'total tax rate' ) {
           $p->get_tag('td');
           undef $u;
-          $u = $p->get_token until $u->[0] eq 'T';
+          $u = $p->get_token until ($u->[0] || '') eq 'T';
           $return->{'tax'} = $u->[1];
         }
       } # get_token

commit 1be5a5bf99a52edd36ea8bade4786b9d082f557d
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Nov 16 14:07:57 2016 -0800

    lock table for tax district updates, #73185

diff --git a/FS/FS/Cron/tax_rate_update.pm b/FS/FS/Cron/tax_rate_update.pm
index 2c021b8..b6ac63c 100755
--- a/FS/FS/Cron/tax_rate_update.pm
+++ b/FS/FS/Cron/tax_rate_update.pm
@@ -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;
diff --git a/FS/FS/geocode_Mixin.pm b/FS/FS/geocode_Mixin.pm
index 46f8128..ef16e74 100644
--- a/FS/FS/geocode_Mixin.pm
+++ b/FS/FS/geocode_Mixin.pm
@@ -260,6 +260,7 @@ sub process_district_update {
   die $@ if $@;
   die "$class has no location data" if !$class->can('location_hash');
 
+  my $error;
   my $conf = FS::Conf->new;
   my $method = $conf->config('tax_district_method')
     or return; #nothing to do if null
@@ -269,9 +270,11 @@ sub process_district_update {
   my $tax_info = get_district({ $self->location_hash }, $method);
   return unless $tax_info;
 
-  $self->set('district', $tax_info->{'district'} );
-  my $error = $self->replace;
-  die $error if $error;
+  if ($self->district ne $tax_info->{'district'}) {
+    $self->set('district', $tax_info->{'district'} );
+    $error = $self->replace;
+    die $error if $error;
+  }
 
   my %hash = map { $_ => uc( $tax_info->{$_} ) } 
     qw( district city county state country );
@@ -281,6 +284,9 @@ sub process_district_update {
   my $taxname = $conf->config('tax_district_taxname');
   # there must be exactly one cust_main_county for each district+taxclass.
   # do NOT exclude taxes that are zero.
+
+  # mutex here so that concurrent queue jobs can't make duplicates.
+  FS::cust_main_county->lock_table;
   foreach my $taxclass (@classes) {
     my @existing = qsearch('cust_main_county', {
       %hash,
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index 35a2098..b8a8fbd 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -316,7 +316,7 @@ print "\n" if $DRY_RUN;
 
 if ( $dbh->{Driver}->{Name} =~ /^mysql/i && ! $opt_s ) {
 
-  foreach my $table (qw( svc_acct svc_phone )) {
+  foreach my $table (qw( svc_acct svc_phone cust_main_county )) {
 
     my $sth = $dbh->prepare(
       "SELECT COUNT(*) FROM duplicate_lock WHERE lockname = '$table'"

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Cron/tax_rate_update.pm |    1 +
 FS/FS/Misc/Geo.pm             |    4 ++--
 FS/FS/geocode_Mixin.pm        |   12 +++++++++---
 FS/bin/freeside-upgrade       |    2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list