[freeside-commits] branch master updated. 147c94865852a93bf192ef15e931e456d487b69b

Ivan ivan at 420.am
Thu Sep 21 15:52:13 PDT 2017


The branch, master has been updated
       via  147c94865852a93bf192ef15e931e456d487b69b (commit)
      from  0c7672759a3254c4bd7317edb23f40d8880d99d6 (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 147c94865852a93bf192ef15e931e456d487b69b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Sep 21 15:52:11 2017 -0700

    compliance solutions, RT#77676

diff --git a/FS/FS/TaxEngine/compliance_solutions.pm b/FS/FS/TaxEngine/compliance_solutions.pm
index 92ca2ce..c21234e 100644
--- a/FS/FS/TaxEngine/compliance_solutions.pm
+++ b/FS/FS/TaxEngine/compliance_solutions.pm
@@ -263,7 +263,7 @@ sub make_taxlines {
     # create a tax rate location if there isn't one yet
     my $taxname = $tax_data->{descript};
     my $tax_rate = FS::tax_rate->new({
-        data_vendor   => 'compliance solutions',
+        data_vendor   => 'compliance_solutions',
         taxname       => $taxname,
         taxclassnum   => '',
         taxauth       => $tax_data->{'taxauthtype'}, # federal / state / city / district
@@ -277,13 +277,14 @@ sub make_taxlines {
     $tax_rate = $tax_rate->replace_old;
 
     my $tax_rate_location = FS::tax_rate_location->new({
-        data_vendor => 'compliance solutions',
+        data_vendor => 'compliance_solutions',
+        geocode     => $tax_data->{'geocode'},
         state       => $tax_data->{'state'},
         country     => $tax_data->{'country'},
-        geocode     => $tax_data->{'geocode'},
     });
     $error = $tax_rate_location->find_or_insert;
-    die "error inserting tax_rate_location record: $error\n"
+    die 'error inserting tax_rate_location record for '.  $tax_data->{state}.
+        '/'. $tax_data->{country}. ' ('. $tax_data->{'geocode'}. "): $error\n"
       if $error;
     $tax_rate_location = $tax_rate_location->replace_old;
 
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 6edec90..0069e20 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -497,6 +497,10 @@ sub upgrade_data {
     #mark certain taxes as system-maintained,
     # and fix whitespace
     'cust_main_county' => [],
+
+    #'compliance solutions' -> 'compliance_solutions'
+    'tax_rate' => [],
+    'tax_rate_location' => [],
   ;
 
   \%hash;
diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm
index 5416ff5..8bc0c6e 100644
--- a/FS/FS/tax_rate.pm
+++ b/FS/FS/tax_rate.pm
@@ -2335,7 +2335,15 @@ EOF
 
 }
 
+sub _upgrade_data {
+  my $class = shift;
 
+  my $sql = "UPDATE tax_rate SET data_vendor = 'compliance_solutions' WHERE data_vendor = 'compliance solutions'";
+
+  my $sth = dbh->prepare($sql) or die $DBI::errstr;
+  $sth->execute() or die $sth->errstr;
+  
+}
 
 =back
 
diff --git a/FS/FS/tax_rate_location.pm b/FS/FS/tax_rate_location.pm
index d9646e4..0377a7d 100644
--- a/FS/FS/tax_rate_location.pm
+++ b/FS/FS/tax_rate_location.pm
@@ -118,10 +118,14 @@ sub check {
   ;
   return $error if $error;
 
+  my @unique = qw( data_vendor geocode );
+  push @unique, qw( state country )
+    if $self->data_vendor eq 'compliance_solutions';
+
   my $t;
   $t = qsearchs( 'tax_rate_location',
                  { disabled => '',
-                   ( map { $_ => $self->$_ } qw( data_vendor geocode ) ),
+                   ( map { $_ => $self->$_ } @unique ),
                  },
                )
     unless $self->disabled;
@@ -392,6 +396,16 @@ sub batch_import {
 
 }
 
+sub _upgrade_data {
+  my $class = shift;
+
+  my $sql = "UPDATE tax_rate_location SET data_vendor = 'compliance_solutions' WHERE data_vendor = 'compliance solutions'";
+
+  my $sth = dbh->prepare($sql) or die $DBI::errstr;
+  $sth->execute() or die $sth->errstr;
+  
+}
+
 =head1 BUGS
 
 Currently somewhat specific to CCH supplied data.

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

Summary of changes:
 FS/FS/TaxEngine/compliance_solutions.pm |    9 +++++----
 FS/FS/Upgrade.pm                        |    4 ++++
 FS/FS/tax_rate.pm                       |    8 ++++++++
 FS/FS/tax_rate_location.pm              |   16 +++++++++++++++-
 4 files changed, 32 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list