projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stop incrementing usage for CF accounts
[freeside.git]
/
FS
/
FS
/
tax_rate_location.pm
diff --git
a/FS/FS/tax_rate_location.pm
b/FS/FS/tax_rate_location.pm
index
0377a7d
..
e338591
100644
(file)
--- a/
FS/FS/tax_rate_location.pm
+++ b/
FS/FS/tax_rate_location.pm
@@
-111,6
+111,7
@@
sub check {
$self->ut_numbern('taxratelocationnum')
|| $self->ut_textn('data_vendor')
|| $self->ut_alpha('geocode')
$self->ut_numbern('taxratelocationnum')
|| $self->ut_textn('data_vendor')
|| $self->ut_alpha('geocode')
+ || $self->ut_textn('district')
|| $self->ut_textn('city')
|| $self->ut_textn('county')
|| $self->ut_textn('state')
|| $self->ut_textn('city')
|| $self->ut_textn('county')
|| $self->ut_textn('state')
@@
-118,20
+119,12
@@
sub check {
;
return $error if $error;
;
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->$_ } @unique ),
- },
- )
+ my $t = '';
+ $t = $self->existing_search
unless $self->disabled;
$t = $self->by_key( $self->taxratelocationnum )
unless $self->disabled;
$t = $self->by_key( $self->taxratelocationnum )
- if
( !$t && $self->taxratelocationnum )
;
+ if
!$t && $self->taxratelocationnum
;
return "geocode ". $self->geocode. " already in use for this vendor"
if ( $t && $t->taxratelocationnum != $self->taxratelocationnum );
return "geocode ". $self->geocode. " already in use for this vendor"
if ( $t && $t->taxratelocationnum != $self->taxratelocationnum );
@@
-157,11
+150,7
@@
record.
sub find_or_insert {
my $self = shift;
sub find_or_insert {
my $self = shift;
- my $existing = qsearchs('tax_rate_location', {
- disabled => '',
- data_vendor => $self->data_vendor,
- geocode => $self->geocode
- });
+ my $existing = $self->existing_search;
if ($existing) {
my $update = 0;
foreach (qw(city county state country)) {
if ($existing) {
my $update = 0;
foreach (qw(city county state country)) {
@@
-180,6
+169,16
@@
sub find_or_insert {
}
}
}
}
+sub existing_search {
+ my $self = shift;
+
+ qsearchs( 'tax_rate_location',
+ { disabled => '',
+ map { $_ => $self->$_ } qw( data_vendor geocode )
+ }
+ );
+}
+
=back
=head1 CLASS METHODS
=back
=head1 CLASS METHODS
@@
-397,13
+396,14
@@
sub batch_import {
}
sub _upgrade_data {
}
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;
-
+#actually no, we want to leave those records behind now that they're giving us
+# geo_state etc.
+# 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
}
=head1 BUGS