projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix (part of) 3.x performance regression on customers with tons of invoices, RT#29646...
[freeside.git]
/
FS
/
FS
/
cust_tax_location.pm
diff --git
a/FS/FS/cust_tax_location.pm
b/FS/FS/cust_tax_location.pm
index
7c6989c
..
4293b2c
100644
(file)
--- a/
FS/FS/cust_tax_location.pm
+++ b/
FS/FS/cust_tax_location.pm
@@
-125,19
+125,25
@@
sub check {
;
return $error if $error;
;
return $error if $error;
- #ugh! cch canada weirdness
- if ($self->state eq 'CN') {
+ #ugh! cch canada weirdness
and more
+ if ($self->state eq 'CN'
&& $self->data_vendor eq 'cch-zip'
) {
$error = "Illegal cch canadian zip"
unless $self->zip =~ /^[A-Z]$/;
$error = "Illegal cch canadian zip"
unless $self->zip =~ /^[A-Z]$/;
+ } elsif ($self->state =~ /^E([B-DFGILNPR-UW])$/ && $self->data_vendor eq 'cch-zip' ) {
+ $error = "Illegal cch european zip"
+ unless $self->zip =~ /^E$1$/;
} else {
$error = $self->ut_number('zip', $self->state eq 'CN' ? 'CA' : 'US');
}
return $error if $error;
} else {
$error = $self->ut_number('zip', $self->state eq 'CN' ? 'CA' : 'US');
}
return $error if $error;
- #ugh! cch canada weirdness
+ #ugh! cch canada weirdness
and more
return "must specify either city/county or plus4lo/plus4hi"
unless ( $self->plus4lo && $self->plus4hi ||
return "must specify either city/county or plus4lo/plus4hi"
unless ( $self->plus4lo && $self->plus4hi ||
- ($self->city || $self->state eq 'CN') && $self->county
+ ( $self->city ||
+ $self->state eq 'CN' ||
+ $self->state =~ /^E([B-DFGILNPR-UW])$/
+ ) && $self->county
);
$self->SUPER::check;
);
$self->SUPER::check;
@@
-193,13
+199,15
@@
sub batch_import {
if (exists($hash->{actionflag}) && $hash->{actionflag} eq 'D') {
delete($hash->{actionflag});
if (exists($hash->{actionflag}) && $hash->{actionflag} eq 'D') {
delete($hash->{actionflag});
- my
$cust_tax_location = qsearchs
('cust_tax_location', $hash);
+ my
@cust_tax_location = qsearch
('cust_tax_location', $hash);
return "Can't find cust_tax_location to delete: ".
join(" ", map { "$_ => ". $hash->{$_} } @fields)
return "Can't find cust_tax_location to delete: ".
join(" ", map { "$_ => ". $hash->{$_} } @fields)
- unless
$cust_tax_location
;
+ unless
scalar(@cust_tax_location) || $param->{'delete_only'}
;
- my $error = $cust_tax_location->delete;
- return $error if $error;
+ foreach my $cust_tax_location (@cust_tax_location) {
+ my $error = $cust_tax_location->delete;
+ return $error if $error;
+ }
delete($hash->{$_}) foreach (keys %$hash);
}
delete($hash->{$_}) foreach (keys %$hash);
}
@@
-228,13
+236,15
@@
sub batch_import {
if (exists($hash->{actionflag}) && $hash->{actionflag} eq 'D') {
delete($hash->{actionflag});
if (exists($hash->{actionflag}) && $hash->{actionflag} eq 'D') {
delete($hash->{actionflag});
- my
$cust_tax_location = qsearchs
('cust_tax_location', $hash);
+ my
@cust_tax_location = qsearch
('cust_tax_location', $hash);
return "Can't find cust_tax_location to delete: ".
join(" ", map { "$_ => ". $hash->{$_} } @fields)
return "Can't find cust_tax_location to delete: ".
join(" ", map { "$_ => ". $hash->{$_} } @fields)
- unless
$cust_tax_location
;
+ unless
scalar(@cust_tax_location) || $param->{'delete_only'}
;
- my $error = $cust_tax_location->delete;
- return $error if $error;
+ foreach my $cust_tax_location (@cust_tax_location) {
+ my $error = $cust_tax_location->delete;
+ return $error if $error;
+ }
delete($hash->{$_}) foreach (keys %$hash);
}
delete($hash->{$_}) foreach (keys %$hash);
}
@@
-277,7
+287,7
@@
sub batch_import {
if ( $job ) { # progress bar
if ( time - $min_sec > $last ) {
my $error = $job->update_statustext(
if ( $job ) { # progress bar
if ( time - $min_sec > $last ) {
my $error = $job->update_statustext(
- int( 100 * $imported / $count )
+ int( 100 * $imported / $count )
. ",Importing locations"
);
die $error if $error;
$last = time;
);
die $error if $error;
$last = time;
@@
-292,7
+302,7
@@
sub batch_import {
}
if ( scalar( @columns ) ) {
$dbh->rollback if $oldAutoCommit;
}
if ( scalar( @columns ) ) {
$dbh->rollback if $oldAutoCommit;
- return "Unexpected trailing columns in line (wrong format?): $line";
+ return "Unexpected trailing columns in line (wrong format?)
importing cust_tax_location
: $line";
}
my $error = &{$hook}(\%cust_tax_location);
}
my $error = &{$hook}(\%cust_tax_location);