diff options
author | Mark Wells <mark@freeside.biz> | 2013-06-20 15:40:12 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-06-20 15:40:12 -0700 |
commit | 5c45c12a64be3e67f8ba82b5a69cc08d5756cef2 (patch) | |
tree | cd2701fdddd3b14a752fc71e4bfe69ddd2e629ae | |
parent | b5c544bc1897ef759e5d198aff3bf173247de1bf (diff) |
ezlocate: accept non-postal standardized address as a fallback, #23679
-rw-r--r-- | FS/FS/Misc/Geo.pm | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm index 53efb3686..a93d98f93 100644 --- a/FS/FS/Misc/Geo.pm +++ b/FS/FS/Misc/Geo.pm @@ -383,19 +383,31 @@ sub standardize_ezlocate { die $ezlocate_error{$match->{MAT_STAT}}."\n" unless $match->{MAT_STAT} =~ /^B\d$/; - { - address1 => $match->{STD_ADDR}, + my %result = ( + address1 => $match->{MAT_ADDR}, address2 => $location->{address2}, - city => $match->{STD_CITY}, - state => $match->{STD_ST}, + city => $match->{MAT_CITY}, + state => $match->{MAT_ST}, country => $location->{country}, - zip => $match->{STD_ZIP}.'-'.$match->{STD_P4}, + zip => $match->{MAT_ZIP}, latitude => $match->{MAT_LAT}, longitude => $match->{MAT_LON}, censustract => $match->{FIPS_ST}.$match->{FIPS_CTY}. sprintf('%07.2f',$match->{CEN_TRCT}), addr_clean => 'Y', - }; + ); + if ( $match->{STD_ADDR} ) { + # then they have a postal standardized address for us + %result = ( %result, + address1 => $match->{STD_ADDR}, + address2 => $location->{address2}, + city => $match->{STD_CITY}, + state => $match->{STD_ST}, + zip => $match->{STD_ZIP}.'-'.$match->{STD_P4}, + ); + } + + \%result; } =back |