9 <% $location{address1} %> <% $location{address2} %><BR>
10 <% $location{city} %>, <% $location{state} %> <% $location{zip} %><BR>
12 % my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude');
13 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
14 TARGET="_blank">Map service module location</A><BR>
15 % $querystring = "census_year=$year&zip_code=".$cache->get('zip');
16 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
17 TARGET="_blank">Map zip code center</A><BR>
21 <TH style="width:50%">Entered census tract</TH>
22 <TH style="width:50%">Calculated census tract</TH>
25 <TD><% $old_tract %></TD>
27 <TD><FONT COLOR="#ff0000"><% $error %></FONT></TD>
29 <TD><% $new_tract %></TD>
35 onclick="set_censustract('<% $old_tract %>', '<% $year %>', '<% $pre %>')">
36 <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
42 onclick="set_censustract('<% $new_tract %>', '<% $year %>', '<% $pre %>')">
43 <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
48 <TD COLSPAN=2 ALIGN="center">
49 <BUTTON TYPE="button" onclick="submit_abort()">
50 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
54 % } else { # don't show a button to use the calculated value
55 <TD COLSPAN=1 ALIGN="center">
56 <BUTTON TYPE="button" onclick="submit_abort()">
57 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
65 local $SIG{__DIE__}; #disable Mason error trap
69 my $conf = new FS::Conf;
71 warn $cgi->param('q') if $DEBUG;
73 my $q = decode_json($cgi->param('q'))
74 or die "bad argument '".$cgi->param('q')."'";
76 my $pre = $q->{prefix} || '';
78 map { $_ => $q->{$pre.$_} }
79 qw( company address1 address2 city state zip country latitude longitude )
82 my $old_tract = $q->{$pre.'censustract'};
83 my $cache = eval { FS::GeocodeCache->new(%location) };
84 $cache->set_censustract;
85 my $year = FS::Conf->new->config('census_year');
86 my $new_tract = $cache->get('censustract');
87 my $error = $cache->get('censustract_error');
89 warn Dumper($cache) if $DEBUG;