compliance solutions, RT#77676
[freeside.git] / FS / FS / tax_rate_location.pm
index d9646e4..0377a7d 100644 (file)
@@ -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.