RT# 73964 - Added biling event action to send an email to phone nunber, and updated...
[freeside.git] / httemplate / misc / confirm-censustract.html
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)
5 % $m->clear_buffer;
6 % $m->abort;
7 % }
8 <CENTER><BR><B>
9 % if ( $error ) {
10 Census tract error
11 % }
12 % else {
13 Confirm census tract
14 % }
15 </B><BR>
16 <% $location{address1} |h %> <% $location{address2} |h %><BR>
17 <% $location{city} |h %>, <% $location{state} |h %> <% $location{zip} |h %><BR>
18 <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>
25 <BR>
26 <TABLE>
27   <TR>
28     <TH style="width:50%">Entered census tract</TH>
29     <TH style="width:50%">Calculated census tract</TH>
30   </TR>
31   <TR>
32     <TD><% $old_tract %></TD>
33 % if ( $error ) {
34     <TD><FONT COLOR="#ff0000"><% $error %></FONT></TD>
35 % } else {
36     <TD><% $new_tract %></TD>
37 % }
38   </TR>
39   <TR>
40     <TD ALIGN="center">
41       <BUTTON TYPE="button"
42               onclick="set_censustract('<% $old_tract %>', '<% $year %>', '<% $pre %>')">
43       <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
44       </BUTTON>
45     </TD>
46 %   if ( !$error ) {
47     <TD ALIGN="center">
48       <BUTTON TYPE="button"
49               onclick="set_censustract('<% $new_tract %>', '<% $year %>', '<% $pre %>')">
50       <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
51       </BUTTON>
52     </TD>
53   </TR>
54   <TR>
55     <TD COLSPAN=2 ALIGN="center">
56       <BUTTON TYPE="button" onclick="submit_abort()">
57       <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
58       </BUTTON>
59     </TD>
60   </TR>
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
65       </BUTTON>
66     </TD>
67   </TR>
68 %   }
69 </TABLE></CENTER>
70 <%init>
71
72 local $SIG{__DIE__}; #disable Mason error trap
73
74 my $DEBUG = 0;
75
76 my $conf = new FS::Conf;
77
78 warn $cgi->param('q') if $DEBUG;
79
80 my $q = decode_json($cgi->param('q'))
81   or die "bad argument '".$cgi->param('q')."'";
82
83 my $pre = $q->{prefix} || '';
84 my %location = (
85   map { $_ => $q->{$pre.$_} }
86     qw( company address1 address2 city state zip country latitude longitude )
87 );
88
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');
95
96 warn Dumper($cache) if $DEBUG;
97
98 </%init>