From: ivan Date: Tue, 19 Jul 2011 21:27:07 +0000 (+0000) Subject: fix geocode guessing w/a 5 digit zip, RT#13595 X-Git-Tag: freeside_2_1_3~65 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=f460000a78d4e74881051e1999197ddab3b1b81d fix geocode guessing w/a 5 digit zip, RT#13595 --- diff --git a/FS/FS/geocode_Mixin.pm b/FS/FS/geocode_Mixin.pm index c153914f0..1e92ddc8b 100644 --- a/FS/FS/geocode_Mixin.pm +++ b/FS/FS/geocode_Mixin.pm @@ -133,7 +133,8 @@ sub geocode { $zip ||= ''; $plus4 ||= ''; #CCH specific location stuff - my $extra_sql = "AND plus4lo <= '$plus4' AND plus4hi >= '$plus4'"; + my $extra_sql = $plus4 ? "AND plus4lo <= '$plus4' AND plus4hi >= '$plus4'" + : ''; my @cust_tax_location = qsearch( { @@ -146,6 +147,11 @@ sub geocode { $geocode = $cust_tax_location[0]->geocode if scalar(@cust_tax_location); + warn "WARNING: customer ". $self->custnum. + ": multiple locations for zip ". $self->get("${prefix}zip"). + "; using arbitrary geocode $geocode\n" + if scalar(@cust_tax_location) > 1; + $geocode; }