X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftax_rate_location.pm;h=218ed977b2d809915b07475efe36c1db53913af1;hb=b6a644c59f47d0a890c2f3122d362a72958fbc58;hp=65bef7bf798a31627fe7e72a754a220e2a1f42df;hpb=794a4505360fec404e2b9d5c6daf79f750186bfe;p=freeside.git diff --git a/FS/FS/tax_rate_location.pm b/FS/FS/tax_rate_location.pm index 65bef7bf7..218ed977b 100644 --- a/FS/FS/tax_rate_location.pm +++ b/FS/FS/tax_rate_location.pm @@ -3,6 +3,7 @@ package FS::tax_rate_location; use strict; use base qw( FS::Record ); use FS::Record qw( qsearch qsearchs dbh ); +use FS::Misc qw( csv_from_fixed ); =head1 NAME @@ -124,11 +125,18 @@ sub check { ; return $error if $error; - my $t = qsearchs( 'tax_rate_location', - { map { $_ => $self->$_ } qw( data_vendor geocode ) }, - ); + my $t; + $t = qsearchs( 'tax_rate_location', + { disabled => '', + ( map { $_ => $self->$_ } qw( data_vendor geocode ) ), + }, + ) + unless $self->disabled; - return "geocode already in use for this vendor" + $t = $self->by_key( $self->taxratelocationnum ) + if ( !$t && $self->taxratelocationnum ); + + return "geocode ". $self->geocode. " already in use for this vendor" if ( $t && $t->taxratelocationnum != $self->taxratelocationnum ); return "may only be disabled" @@ -193,7 +201,7 @@ sub batch_import { if (exists($hash->{'actionflag'}) && $hash->{'actionflag'} eq 'D') { delete($hash->{actionflag}); - $hash->{deleted} = ''; + $hash->{disabled} = ''; my $tax_rate_location = qsearchs('tax_rate_location', $hash); return "Can't find tax_rate_location to delete: ". join(" ", map { "$_ => ". $hash->{$_} } @fields) @@ -278,7 +286,7 @@ sub batch_import { if ( $error ) { $dbh->rollback if $oldAutoCommit; - return "can't insert tax_rate for $line: $error"; + return "can't insert tax_rate_location for $line: $error"; } }