1 % if ( !$error and !$new_tract ) {
2 % # then set_censustract returned nothing
3 % # because it's not relevant for this address
4 % # so output nothing (forces confirm_censustract() to continue)
16 <% $location{address1} |h %> <% $location{address2} |h %><BR>
17 <% $location{city} |h %>, <% $location{state} |h %> <% $location{zip} |h %><BR>
19 % my $querystring = "census_year=$year&address=$location{address1}, $location{address2}, $location{city}, $location{state}";
20 <A HREF="<%$p%>misc/openmap.html?<% $querystring %>"
21 TARGET="_blank">Map service module location</A><BR>
22 % $querystring = "census_year=$year&pre=$pre&zip_code=" . $cache->get('zip');
23 <A HREF="<%$p%>misc/openmap.html?<% $querystring %>"
24 TARGET="_blank">Map zip code center</A><BR>
26 <input type="hidden" id="new_tract" name="new_tract" value="<%$new_tract%>">
29 <TH style="width:50%">Entered census tract</TH>
30 <TH style="width:50%">Calculated census tract</TH>
33 <TD><% $old_tract %></TD>
35 <TD><div id='newcensustract'><FONT COLOR="#ff0000"><% $error %></FONT></div></TD>
37 <TD><div id='newcensustract'><% $new_tract %></div></TD>
43 onclick="set_censustract('<% $old_tract %>', '<% $year %>', '<% $pre %>')">
44 <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
48 <div id="setnewtractdiv"
49 % if ( $error ) { ## do not display this block if error finding track.
53 <BUTTON TYPE="button" id="setnewtract"
54 onclick="set_censustract(getElementById('new_tract').value, '<% $year %>', '<% $pre %>')">
55 <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
58 <div id='cancelsubmissiontop'
59 % if ( !$error ) { ## do not display this block if there is no error finding a track.
63 <BUTTON TYPE="button" onclick="submit_abort()">
64 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
70 <TD COLSPAN=2 ALIGN="center">
71 <div id='cancelsubmissionbottom'
72 % if ( $error ) { ## do not display this block if error finding track.
76 <BUTTON TYPE="button" onclick="submit_abort()">
77 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
86 local $SIG{__DIE__}; #disable Mason error trap
90 my $conf = new FS::Conf;
92 warn $cgi->param('q') if $DEBUG;
94 my $q = decode_json($cgi->param('q'))
95 or die "bad argument '".$cgi->param('q')."'";
97 my $pre = $q->{prefix} || '';
99 map { $_ => $q->{$pre.$_} }
100 qw( company address1 address2 city state zip country latitude longitude )
103 my $old_tract = $q->{$pre.'censustract'};
104 my $cache = eval { FS::GeocodeCache->new(%location) };
105 $cache->set_censustract;
106 my $year = FS::Conf->new->config('census_year');
107 my $new_tract = $cache->get('censustract');
108 my $error = $cache->get('censustract_error');
110 warn Dumper($cache) if $DEBUG;