X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMisc%2FGeo.pm;h=a93d98f931a1816da89b7229500b0239ca708df4;hb=59ca3e541bcc1ffe75d0ad70c410f30e35bcf90b;hp=6bc71fc84551eeac346e008091eea9b557bd97a2;hpb=468c9e660eb0edb2033f0f8dbb4458f20280082c;p=freeside.git diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm index 6bc71fc84..a93d98f93 100644 --- a/FS/FS/Misc/Geo.pm +++ b/FS/FS/Misc/Geo.pm @@ -9,6 +9,7 @@ use HTTP::Request::Common qw( GET POST ); use HTML::TokeParser; use URI::Escape 3.31; use Data::Dumper; +use FS::Conf; FS::UID->install_callback( sub { $conf = new FS::Conf; @@ -80,7 +81,7 @@ sub get_censustract_ffiec { my($zip5, $zip4) = split('-',$location->{zip}); - $year ||= '2011'; #2012 per http://transition.fcc.gov/form477/techfaqs.html soon/now? + $year ||= '2012'; my @ffiec_args = ( __VIEWSTATE => $viewstate, __EVENTVALIDATION => $eventvalidation, @@ -137,10 +138,10 @@ sub get_censustract_ffiec { $return->{'statecode'} . $return->{'countycode'} . $return->{'tractcode'}; } -sub get_district_methods { - '' => '', - 'wa_sales' => 'Washington sales tax', -}; +#sub get_district_methods { +# '' => '', +# 'wa_sales' => 'Washington sales tax', +#}; =item get_district LOCATION METHOD @@ -362,7 +363,7 @@ sub standardize_ezlocate { #} $class = 'Geo::EZLocate'; # use our own library - eval "use $class"; + eval "use $class 0.02"; #Geo::EZLocate 0.02 for error handling die $@ if $@; my $userid = $conf->config('ezlocate-userid') @@ -382,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('%04.2f',$match->{CEN_TRCT}), + 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