% if ( $is_error ) { Address standardization error % } % else { Confirm address standardization % }
% for my $pre (@prefixes) { % my $name = $pre eq 'bill_' ? 'billing' : 'service'; % my $rows = 5; % if ( $new{$pre.'error'} ) {
CLASS="td_radio">
Entered <%$name%> address
% if ( $old{$pre.'company'} ) {
<% $old{$pre.'company'} %>
% }
<% $old{$pre.'address1'} %>
<% $new{$pre.'error'} %>
<% $old{$pre.'address2'} %>
<% $old{$pre.'city'} %>, <% $old{$pre.'state'} %> <% $old{$pre.'zip'} %>
% } else { # not an error % $rows++ if !$new{$pre.'addr_clean'};
CLASS="td_radio">
Entered <%$name%> address
Standardized <%$name%> address
CLASS="td_radio">
% if ( !$new{$pre.'addr_clean'} ) {
(unverified)
% }
% if ( $old{$pre.'company'} ) {
<% $old{$pre.'company'} %>
<% $new{$pre.'company'} %>
% }
<% $old{$pre.'address1'} %>
<% $new{$pre.'address1'} %>
<% $old{$pre.'address2'} %>
<% $new{$pre.'address2'} %>
<% $old{$pre.'city'} %>, <% $old{$pre.'state'} %> <% $old{$pre.'zip'} %>
<% $new{$pre.'city'} %>, <% $new{$pre.'state'} %> <% $new{$pre.'zip'} %>
% } # if error % } # for $pre %# only do this part if address standardization provided a censustract % my $pre = $old{same} ? 'bill_' : 'ship_'; % my $censustract = $new{$pre.'censustract'}; % if ( $censustract ) {
>
Entered census tract
Calculated census tract
>
<% $old{$pre.'censustract'} %>
% if ( $census_error ) {
<% $census_error %>
% } else { <% $censustract %> % }
% } #if censustract
Use selected <%$addresses%>
Cancel submission
<%init> # slightly weird interface... my $q = decode_json($cgi->param('q')); #warn Dumper($q); my %old = %{ $q->{old} }; my %new = %{ $q->{new} }; my $addresses = $old{billship} ? 'addresses' : 'address'; my @prefixes = (''); if ( $old{same} ) { @prefixes = ('bill_'); } elsif ( $old{billship} ) { @prefixes = ('bill_', 'ship_'); } my $census_error = $new{'census_error'}; my $is_error = $census_error || grep { $new{$_.'error'} } @prefixes; %init>