X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fdeploy_zone.pm;h=723b491c852ef47e7f75ec3e4a1cc368cf80684c;hp=71129cf44f8e242004e36f69e2e8978a172f5db3;hb=20961c94ea06ad3aa71fad2bd7f6903f83f02ebc;hpb=cace897d9c5fbe1f80277b0cb14e85c9d2272cf1 diff --git a/FS/FS/deploy_zone.pm b/FS/FS/deploy_zone.pm index 71129cf44..723b491c8 100644 --- a/FS/FS/deploy_zone.pm +++ b/FS/FS/deploy_zone.pm @@ -6,7 +6,7 @@ use FS::Record qw( qsearch qsearchs dbh ); use Storable qw(thaw); use MIME::Base64; -use JSON qw(encode_json decode_json) ; +use Cpanel::JSON::XS; use LWP::UserAgent; use HTTP::Request::Common; @@ -187,8 +187,15 @@ returns the error, otherwise returns false. =cut -# the replace method can be inherited from FS::Record +sub replace { + my $self = shift; + my $old = shift || $self->replace_old; + + $self->expire_date(time) + if $self->disabled eq 'Y' && ! $old->disabled && ! $self->expire_date; + $self->SUPER::replace($old, @_); +} =item check Checks all fields to make sure this is a valid zone record. If there is @@ -383,7 +390,7 @@ sub process_block_lookup { returnGeometry => 'false', orderByFields => 'OID', ); - my $url = 'http://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Tracts_Blocks/MapServer/12/query'; + my $url = 'https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Tracts_Blocks/MapServer/12/query'; my $ua = LWP::UserAgent->new; # first find out how many of these we're dealing with @@ -418,6 +425,7 @@ sub process_block_lookup { die $response->status_line unless $response->is_success; $data = decode_json($response->content); die $data->{error}{message} if $data->{error}; + last unless scalar @{$data->{features}}; #Nothing to insert foreach my $feature (@{ $data->{features} }) { my $geoid = $feature->{attributes}{GEOID}; # the prize