summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/confirm-address_standardize.html9
-rw-r--r--httemplate/misc/confirm-censustract.html78
-rw-r--r--httemplate/misc/xmlhttp-address_standardize.html2
3 files changed, 84 insertions, 5 deletions
diff --git a/httemplate/misc/confirm-address_standardize.html b/httemplate/misc/confirm-address_standardize.html
index 1f94dd917..24363ea4e 100644
--- a/httemplate/misc/confirm-address_standardize.html
+++ b/httemplate/misc/confirm-address_standardize.html
@@ -51,7 +51,7 @@ Confirm address standardization
% }
<TR>
<TD><% $old{$pre.'address1'} %></TD>
- <TD><FONT COLOR="#ff0000"><B><% $new{$pre.'error'} %></B></FONT></TD>
+ <TD ROWSPAN=3><FONT COLOR="#ff0000"><B><% $new{$pre.'error'} %></B></FONT></TD>
</TR>
<TR>
<TD><% $old{$pre.'address2'} %></TD>
@@ -62,7 +62,8 @@ Confirm address standardization
% } #if error
% } # for $pre
-% if ( $old{'ship_censustract'} or $new{'ship_censustract'} ) {
+%# only do this part if address standardization provided a censustract
+% if ( $new{'ship_censustract'} ) {
<TR>
<TH>Entered census tract</TH>
<TH>Calculated census tract</TH>
@@ -82,7 +83,7 @@ Confirm address standardization
% if ( $new{error} or $new{ship_error} ) {
<TR>
<TD ALIGN="center">
- <BUTTON TYPE="button" STYLE="width:205px" onclick="post_standardization();">
+ <BUTTON TYPE="button" STYLE="width:205px" onclick="confirm_manual_address();">
<IMG SRC="<%$p%>images/error.png" ALT=""> Use entered <%$addresses%>
</BUTTON></TD>
<TD ALIGN="center">
@@ -94,7 +95,7 @@ Confirm address standardization
% else {
<TR>
<TD ALIGN="center">
- <BUTTON TYPE="button" STYLE="width:205px" onclick="post_standardization();">
+ <BUTTON TYPE="button" STYLE="width:205px" onclick="confirm_manual_address()();">
<IMG SRC="<%$p%>images/error.png" ALT=""> Use entered <%$addresses%>
</BUTTON></TD>
<TD ALIGN="center">
diff --git a/httemplate/misc/confirm-censustract.html b/httemplate/misc/confirm-censustract.html
new file mode 100644
index 000000000..ae0ae3a6a
--- /dev/null
+++ b/httemplate/misc/confirm-censustract.html
@@ -0,0 +1,78 @@
+<CENTER><BR><B>
+% if ( $error ) {
+Census tract error
+% }
+% else {
+Confirm census tract
+% }
+</B><BR>
+% my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude');
+<A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
+ TARGET="_blank">Map service module location</A><BR>
+% $querystring = "census_year=$year&zip_code=".$cache->get('zip');
+<A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
+ TARGET="_blank">Map zip code center</A><BR>
+<BR>
+<TABLE>
+ <TR>
+ <TH style="width:50%">Entered census tract</TH>
+ <TH style="width:50%">Calculated census tract</TH>
+ </TR>
+ <TR>
+ <TD><% $old_tract %></TD>
+% if ( $error ) {
+ <TD><FONT COLOR="#ff0000"><% $error %></FONT></TD>
+% } else {
+ <TD><% $new_tract %></TD>
+% }
+ </TR>
+ <TR>
+ <TD ALIGN="center">
+ <BUTTON TYPE="button"
+ onclick="set_censustract('<% $old_tract %>', '<% $year %>')">
+ <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
+ </BUTTON>
+ </TD>
+ <TD ALIGN="center">
+ <BUTTON TYPE="button"
+ onclick="set_censustract('<% $new_tract %>', '<% $year %>')">
+ <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
+ </BUTTON>
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN=2 ALIGN="center">
+ <BUTTON TYPE="button" onclick="submit_abort()">
+ <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
+ </BUTTON>
+ </TD>
+ </TR>
+</TABLE></CENTER>
+<%init>
+
+local $SIG{__DIE__}; #disable Mason error trap
+
+my $DEBUG = 0;
+
+my $conf = new FS::Conf;
+
+warn $cgi->param('q') if $DEBUG;
+
+my $q = decode_json($cgi->param('q'))
+ or die "bad argument '".$cgi->param('q')."'";
+
+my %location = (
+ map { $_ => $q->{'ship_'.$_} }
+ qw( company address1 address2 city state zip country latitude longitude )
+);
+
+my $old_tract = $q->{'ship_censustract'};
+my $cache = eval { FS::GeocodeCache->new(%location) };
+$cache->set_censustract;
+my $year = FS::Conf->new->config('census_year');
+my $new_tract = $cache->get('censustract');
+my $error = $cache->get('censustract_error');
+
+warn Dumper($cache) if $DEBUG;
+
+</%init>
diff --git a/httemplate/misc/xmlhttp-address_standardize.html b/httemplate/misc/xmlhttp-address_standardize.html
index c2d6d7a80..f53c35fca 100644
--- a/httemplate/misc/xmlhttp-address_standardize.html
+++ b/httemplate/misc/xmlhttp-address_standardize.html
@@ -25,8 +25,8 @@ foreach my $pre ( '', 'ship_' ) {
};
my $cache = eval { FS::GeocodeCache->standardize($location) };
- $cache->set_censustract if $pre;
$cache->set_coord;
+ # don't do set_censustract here, though censustract may be set by now
foreach ( keys(%$cache) ) {
$new{$pre.$_} = $cache->get($_);