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} %> <% $location{address2} %><BR>
17 <% $location{city} %>, <% $location{state} %> <% $location{zip} %><BR>
19 % my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude');
20 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
21 TARGET="_blank">Map service module location</A><BR>
22 % $querystring = "census_year=$year&zip_code=".$cache->get('zip');
23 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
24 TARGET="_blank">Map zip code center</A><BR>
28 <TH style="width:50%">Entered census tract</TH>
29 <TH style="width:50%">Calculated census tract</TH>
32 <TD><% $old_tract %></TD>
34 <TD><FONT COLOR="#ff0000"><% $error %></FONT></TD>
36 <TD><% $new_tract %></TD>
42 onclick="set_censustract('<% $old_tract %>', '<% $year %>', '<% $pre %>')">
43 <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
49 onclick="set_censustract('<% $new_tract %>', '<% $year %>', '<% $pre %>')">
50 <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
55 <TD COLSPAN=2 ALIGN="center">
56 <BUTTON TYPE="button" onclick="submit_abort()">
57 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
61 % } else { # don't show a button to use the calculated value
62 <TD COLSPAN=1 ALIGN="center">
63 <BUTTON TYPE="button" onclick="submit_abort()">
64 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
72 local $SIG{__DIE__}; #disable Mason error trap
76 my $conf = new FS::Conf;
78 warn $cgi->param('q') if $DEBUG;
80 my $q = decode_json($cgi->param('q'))
81 or die "bad argument '".$cgi->param('q')."'";
83 my $pre = $q->{prefix} || '';
85 map { $_ => $q->{$pre.$_} }
86 qw( company address1 address2 city state zip country latitude longitude )
89 my $old_tract = $q->{$pre.'censustract'};
90 my $cache = eval { FS::GeocodeCache->new(%location) };
91 $cache->set_censustract;
92 my $year = FS::Conf->new->config('census_year');
93 my $new_tract = $cache->get('censustract');
94 my $error = $cache->get('censustract_error');
96 warn Dumper($cache) if $DEBUG;