X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMisc%2FGeo.pm;h=5d6f33cb728cf4c155c8aa32da9695f47daee650;hb=226ebde26712fb03cb768235038a2d7c4f0a4fbf;hp=acfeabf3b5da086eecf136c6bc87709b0f06cb3e;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm index acfeabf3b..5d6f33cb7 100644 --- a/FS/FS/Misc/Geo.pm +++ b/FS/FS/Misc/Geo.pm @@ -7,7 +7,7 @@ use LWP::UserAgent; use HTTP::Request; use HTTP::Request::Common qw( GET POST ); use HTML::TokeParser; -use URI::Escape; +use URI::Escape 3.31; use Data::Dumper; $DEBUG = 0; @@ -36,7 +36,7 @@ sub get_censustract { warn Dumper($location, $year) if $DEBUG; - my $url='http://www.ffiec.gov/Geocode/default.aspx'; + my $url = 'http://www.ffiec.gov/Geocode/default.aspx'; my $return = {}; my $error = ''; @@ -75,14 +75,11 @@ sub get_censustract { my($zip5, $zip4) = split('-',$location->{zip}); - $year ||= '2011'; - #ugh workaround a mess at ffiec - $year = " $year" if $year ne '2011'; + $year ||= '2011'; #2012 per http://transition.fcc.gov/form477/techfaqs.html soon/now? my @ffiec_args = ( __VIEWSTATE => $viewstate, __EVENTVALIDATION => $eventvalidation, ddlbYear => $year, - ddlbYear => '2011', #' 2009', txtAddress => $location->{address1}, txtCity => $location->{city}, ddlbState => $location->{state}, @@ -117,7 +114,10 @@ sub get_censustract { $return->{lc($1)} = $p->get_trimmed_text("/span"); } - $error = "No census tract found" unless $return->{tractcode}; + unless ( $return->{tractcode} ) { + warn "$error: $content ". Dumper($return) if $DEBUG; + $error = "No census tract found"; + } $return->{tractcode} .= ' ' unless $error || $JSON::VERSION >= 2; #broken JSON 1 workaround