diff options
author | jeff <jeff> | 2009-07-13 16:02:32 +0000 |
---|---|---|
committer | jeff <jeff> | 2009-07-13 16:02:32 +0000 |
commit | b6a644c59f47d0a890c2f3122d362a72958fbc58 (patch) | |
tree | 6e3df8a3f468b636fa73a058890734ff8f303b0d /FS/FS/tax_rate_location.pm | |
parent | 3cb93a3aa0af9f004b7ee122bdf5c1daf5f1289c (diff) |
correct ordering and other bugs in tax updates
Diffstat (limited to 'FS/FS/tax_rate_location.pm')
-rw-r--r-- | FS/FS/tax_rate_location.pm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/FS/FS/tax_rate_location.pm b/FS/FS/tax_rate_location.pm index 0e0dafebb..218ed977b 100644 --- a/FS/FS/tax_rate_location.pm +++ b/FS/FS/tax_rate_location.pm @@ -125,11 +125,18 @@ sub check { ; return $error if $error; - my $t = qsearchs( 'tax_rate_location', - { map { $_ => $self->$_ } qw( data_vendor geocode ) }, - ); - - return "geocode already in use for this vendor" + my $t; + $t = qsearchs( 'tax_rate_location', + { disabled => '', + ( map { $_ => $self->$_ } qw( data_vendor geocode ) ), + }, + ) + unless $self->disabled; + + $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" @@ -194,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) @@ -279,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"; } } |