projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git]
/
FS
/
FS
/
GeocodeCache.pm
diff --git
a/FS/FS/GeocodeCache.pm
b/FS/FS/GeocodeCache.pm
index
7829c4d
..
9a30f00
100644
(file)
--- a/
FS/FS/GeocodeCache.pm
+++ b/
FS/FS/GeocodeCache.pm
@@
-110,23
+110,23
@@
Look up the censustract, if it's not already filled in, and return it.
On error, sets 'error' and returns nothing.
This uses the "get_censustract_*" methods in L<FS::Misc::Geo>; currently
On error, sets 'error' and returns nothing.
This uses the "get_censustract_*" methods in L<FS::Misc::Geo>; currently
-the only one is 'ffiec'.
+available are 'uscensus' (default) or 'ffiec' (legacy, used if the
+census_legacy configuration option is set).
=cut
sub set_censustract {
my $self = shift;
=cut
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');
}
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";
$method = "get_censustract_$method";
- my $censustract = eval { FS::Misc::Geo->$method($self, $
census
year) };
+ my $censustract = eval { FS::Misc::Geo->$method($self, $year) };
$self->set("censustract_error", $@);
$self->set("censustract", $censustract);
}
$self->set("censustract_error", $@);
$self->set("censustract", $censustract);
}