9 % my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude');
10 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
11 TARGET="_blank">Map service module location</A><BR>
12 % $querystring = "census_year=$year&zip_code=".$cache->get('zip');
13 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
14 TARGET="_blank">Map zip code center</A><BR>
18 <TH style="width:50%">Entered census tract</TH>
19 <TH style="width:50%">Calculated census tract</TH>
22 <TD><% $old_tract %></TD>
24 <TD><FONT COLOR="#ff0000"><% $error %></FONT></TD>
26 <TD><% $new_tract %></TD>
32 onclick="set_censustract('<% $old_tract %>', '<% $year %>')">
33 <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
38 onclick="set_censustract('<% $new_tract %>', '<% $year %>')">
39 <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
44 <TD COLSPAN=2 ALIGN="center">
45 <BUTTON TYPE="button" onclick="submit_abort()">
46 <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
53 local $SIG{__DIE__}; #disable Mason error trap
57 my $conf = new FS::Conf;
59 warn $cgi->param('q') if $DEBUG;
61 my $q = decode_json($cgi->param('q'))
62 or die "bad argument '".$cgi->param('q')."'";
64 my $pre = $q->{'same'} ? 'bill_' : 'ship_';
66 map { $_ => $q->{$pre.$_} }
67 qw( company address1 address2 city state zip country latitude longitude )
70 my $old_tract = $q->{$pre.'censustract'};
71 my $cache = eval { FS::GeocodeCache->new(%location) };
72 $cache->set_censustract;
73 my $year = FS::Conf->new->config('census_year');
74 my $new_tract = $cache->get('censustract');
75 my $error = $cache->get('censustract_error');
77 warn Dumper($cache) if $DEBUG;