X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_location.pm;fp=FS%2FFS%2Fcust_location.pm;h=73821cc146c93b5523f216ac8bc8c5e6b86644b1;hp=21bf92feba0e75dcb246dc7faf57ca7b21483910;hb=c564754d5f17c616782fb27432e6b056bd8fa00d;hpb=1fc8addc56f8daf12397da568eb1ac1b27fd3984 diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index 21bf92feb..73821cc14 100644 --- a/FS/FS/cust_location.pm +++ b/FS/FS/cust_location.pm @@ -252,7 +252,7 @@ sub insert { } if ( $self->censustract ) { - $self->set('censusyear' => $conf->config('census_year') || 2012); + $self->set('censusyear' => $conf->config('census_legacy') || 2020); } my $oldAutoCommit = $FS::UID::AutoCommit; @@ -419,10 +419,13 @@ sub check { ; return $error if $error; if ( $self->censustract ne '' ) { - $self->censustract =~ /^\s*(\d{9})\.?(\d{2})\s*$/ - or return "Illegal census tract: ". $self->censustract; - - $self->censustract("$1.$2"); + if ( $self->censustract =~ /^\s*(\d{9})\.?(\d{2})\s*$/ ) { #old + $self->censustract("$1.$2"); + } elsif ($self->censustract =~ /^\s*(\d{15})\s*$/ ) { #new + $self->censustract($1); + } else { + return "Illegal census tract: ". $self->censustract; + } } #yikes... this is ancient, pre-dates cust_location and will be harder to @@ -879,7 +882,7 @@ sub process_censustract_update { qsearchs( 'cust_location', { locationnum => $locationnum }) or die "locationnum '$locationnum' not found!\n"; - my $new_year = $conf->config('census_year') or return; + my $new_year = $conf->config('census_legacy') || 2020; my $loc = FS::GeocodeCache->new( $cust_location->location_hash ); $loc->set_censustract; my $error = $loc->get('censustract_error');