X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_location.pm;h=28278cbb60122c44e05866cd83b0e39a3ac42211;hb=ad95974fd5f5c00d14630fe834c37eb9131c8a20;hp=a2bda7162277ed5ed496ba48c6df9d1eb7ce7d58;hpb=3787b82344ddd6447dc9074e95d7e18bf7148ccf;p=freeside.git diff --git a/FS/FS/cust_location.pm b/FS/FS/cust_location.pm index a2bda7162..28278cbb6 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 @@ -832,7 +835,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');