X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Fconfirm-censustract.html;h=0f115e5d7c8c79fbd9b3eaade4b01c7a5139e360;hp=6a11617e71ec25cca878524ab9e7923d4b3f1b65;hb=HEAD;hpb=2bb7db96a07599e980323c1b6b23a8c79cc17a9a diff --git a/httemplate/misc/confirm-censustract.html b/httemplate/misc/confirm-censustract.html index 6a11617e7..02847f869 100644 --- a/httemplate/misc/confirm-censustract.html +++ b/httemplate/misc/confirm-censustract.html @@ -1,3 +1,10 @@ +% if ( !$error and !$new_tract ) { +% # then set_censustract returned nothing +% # because it's not relevant for this address +% # so output nothing (forces confirm_censustract() to continue) +% $m->clear_buffer; +% $m->abort; +% }

% if ( $error ) { Census tract error @@ -6,13 +13,23 @@ Census tract error Confirm census tract % }
-% my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude'); -Map service module location
-% $querystring = "census_year=$year&zip_code=".$cache->get('zip'); -Map zip code center
+<% $location{address1} |h %> <% $location{address2} |h %>
+<% $location{city} |h %>, <% $location{state} |h %> <% $location{zip} |h %>
+
+% my $address1 = $location{address1}; +% $address1 =~ s/(apt|ste|suite|unit)[\s\d]\w*\s*$//i; +% my $querystring = "census_year=$year&address=$address1, $location{address2}, $location{city}, $location{state}"; +Map service location
+% $querystring = "census_year=$year&pre=$pre&zip_code=" . $cache->get('zip'); +Map zip code center

+ @@ -21,33 +38,55 @@ Confirm census tract % if ( $error ) { - + % } else { - + % }
Entered census tract
<% $old_tract %><% $error %>
<% $error %>
<% $new_tract %>
<% $new_tract %>
- + +
+
+ <%init> local $SIG{__DIE__}; #disable Mason error trap @@ -61,7 +100,7 @@ warn $cgi->param('q') if $DEBUG; my $q = decode_json($cgi->param('q')) or die "bad argument '".$cgi->param('q')."'"; -my $pre = $q->{'same'} ? 'bill_' : 'ship_'; +my $pre = $q->{prefix} || ''; my %location = ( map { $_ => $q->{$pre.$_} } qw( company address1 address2 city state zip country latitude longitude ) @@ -70,7 +109,7 @@ my %location = ( my $old_tract = $q->{$pre.'censustract'}; my $cache = eval { FS::GeocodeCache->new(%location) }; $cache->set_censustract; -my $year = FS::Conf->new->config('census_year'); +my $year = FS::Conf->new->config('census_legacy') || '2020'; my $new_tract = $cache->get('censustract'); my $error = $cache->get('censustract_error');