X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FGeocodeCache.pm;h=430a90fd73d90e3bcf43c7e4a268ef64e60a137c;hb=c564754d5f17c616782fb27432e6b056bd8fa00d;hp=7829c4df203e0f83b44c68ad54789802e2d22ccc;hpb=1fc8addc56f8daf12397da568eb1ac1b27fd3984;p=freeside.git diff --git a/FS/FS/GeocodeCache.pm b/FS/FS/GeocodeCache.pm index 7829c4df2..430a90fd7 100644 --- a/FS/FS/GeocodeCache.pm +++ b/FS/FS/GeocodeCache.pm @@ -117,16 +117,15 @@ the only one is 'ffiec'. sub set_censustract { my $self = shift; - if ( $self->get('censustract') =~ /^\d{9}\.\d{2}$/ ) { + if ( $self->get('censustract') =~ /^\d{9}(\.\d{2}|\d{6})$/ ) { return $self->get('censustract'); } - my $censusyear = $conf->config('census_year'); - return if !$censusyear; - my $method = 'ffiec'; - # configurable censustract-only lookup goes here if it's ever needed. + my $year = $conf->config('census_legacy') || 2020; + my $method = ($year==2020) ? 'uscensus' : 'ffiec'; + $method = "get_censustract_$method"; - my $censustract = eval { FS::Misc::Geo->$method($self, $censusyear) }; + my $censustract = eval { FS::Misc::Geo->$method($self, $year) }; $self->set("censustract_error", $@); $self->set("censustract", $censustract); }