[freeside-commits] branch FREESIDE_4_BRANCH updated. cfbcb8867b15c66c279816bce91a69c5ee9b2710
Mark Wells
mark at 420.am
Fri Oct 30 23:55:26 PDT 2015
The branch, FREESIDE_4_BRANCH has been updated
via cfbcb8867b15c66c279816bce91a69c5ee9b2710 (commit)
from ce3cc284f71f2439f473c22c6d160ac45ea3b94a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cfbcb8867b15c66c279816bce91a69c5ee9b2710
Author: Mark Wells <mark at freeside.biz>
Date: Fri Oct 30 22:38:01 2015 -0700
allow separate address standardization of billing and service addresses, #38646
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index 1a01daa..b824fb2 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -129,7 +129,7 @@ function confirm_standardize(arg) {
function() {
overlib( OLresponseAJAX, CAPTION, 'Address standardization', STICKY,
AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH,
- 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399',
+ 650, HEIGHT, 368, BGCOLOR, '#333399', CGCOLOR, '#333399',
TEXTSIZE, 3 );
}, 0);
@@ -141,10 +141,15 @@ function replace_address() {
var newaddr = returned['new'];
var cf = document.<% $formname %>;
+ var crf = document.forms['confirm_replace_form'];
% foreach my $pre (@prefixes) {
var clean = newaddr['<% $pre %>addr_clean'] == 'Y';
+ var replace = true; // auto_standardize_address won't load the form, so just do it
+ if ( crf && crf['<% $pre %>replace'] ) {
+ replace = crf['<% $pre %>replace'].value == 'Y';
+ }
var error = newaddr['<% $pre %>error'];
- if ( clean ) {
+ if ( clean && replace ) {
% foreach my $field (qw(address1 address2 state zip addr_clean ),($conf->exists('cust_main-no_city_in_address') ? () : 'city')) {
cf.elements['<% $pre %><% $field %>'].value = newaddr['<% $pre %><% $field %>'];
% } #foreach $field
@@ -154,7 +159,12 @@ function replace_address() {
cf.elements['<% $pre %>longitude'].value = newaddr['<% $pre %>longitude'];
}
% if ( $withcensus ) {
- if ( clean && newaddr['<% $pre %>censustract'] ) {
+ var census_replace = true;
+ if ( crf && crf['census_replace'] ) {
+ census_replace = crf['census_replace'].value == 'Y';
+ }
+
+ if ( clean && census_replace && newaddr['<% $pre %>censustract'] ) {
cf.elements['<% $pre %>censustract'].value = newaddr['<% $pre %>censustract'];
}
% } #if $withcensus
diff --git a/httemplate/misc/confirm-address_standardize.html b/httemplate/misc/confirm-address_standardize.html
index 2eae011..0a05c70 100644
--- a/httemplate/misc/confirm-address_standardize.html
+++ b/httemplate/misc/confirm-address_standardize.html
@@ -1,8 +1,15 @@
<STYLE type="text/css">
-th { line-height: 150% }
+th { line-height: 150%;
+ width: 45%;
+}
+.td_radio {
+ width: 5%;
+ vertical-align: middle;
+ text-align: center;
+}
</STYLE>
<CENTER><BR><B>
-% if ( $new{bill_error} or $new{ship_error} ) {
+% if ( $is_error ) {
Address standardization error
% }
% else {
@@ -10,24 +17,26 @@ Confirm address standardization
% }
</B><BR><BR>
+<FORM ID="confirm_replace_form">
<TABLE WIDTH="100%">
-% my @prefixes = ('');
-% if ( $old{same} ) {
-% @prefixes = ('bill_');
-% } elsif ( $old{billship} ) {
-% @prefixes = ('bill_', 'ship_');
-% }
% for my $pre (@prefixes) {
% my $name = $pre eq 'bill_' ? 'billing' : 'service';
+% my $rows = 5;
% if ( $new{$pre.'error'} ) {
<TR>
- <TH>Entered <%$name%> address</TH>
+ <TD ROWSPAN=<% $rows %> CLASS="td_radio">
+ <INPUT TYPE="radio" NAME="<% $pre %>replace" VALUE="" CHECKED="Y">
+ </TD>
+ <TH>Entered <%$name%> address
+ </TH>
+ <TH></TH>
+ <TD CLASS="td_radio"></TD>
</TR>
-% if ( $old{$pre.'company'} ) {
<TR>
+% if ( $old{$pre.'company'} ) {
<TD><% $old{$pre.'company'} %></TD>
- </TR>
% }
+ </TR>
<TR>
<TD><% $old{$pre.'address1'} %></TD>
<TD ROWSPAN=3><FONT COLOR="#ff0000"><B><% $new{$pre.'error'} %></B></FONT></TD>
@@ -39,9 +48,16 @@ Confirm address standardization
<TD><% $old{$pre.'city'} %>, <% $old{$pre.'state'} %> <% $old{$pre.'zip'} %></TD>
</TR>
% } else { # not an error
+% $rows++ if !$new{$pre.'addr_clean'};
<TR>
+ <TD ROWSPAN=<% $rows %> CLASS="td_radio">
+ <INPUT TYPE="radio" NAME="<% $pre %>replace" VALUE="">
+ </TD>
<TH>Entered <%$name%> address</TH>
<TH>Standardized <%$name%> address</TH>
+ <TD ROWSPAN=<% $rows %> CLASS="td_radio">
+ <INPUT TYPE="radio" NAME="<% $pre %>replace" VALUE="Y" CHECKED="Y">
+ </TD>
</TR>
% if ( !$new{$pre.'addr_clean'} ) {
<TR>
@@ -75,11 +91,16 @@ Confirm address standardization
%# only do this part if address standardization provided a censustract
% my $pre = $old{same} ? 'bill_' : 'ship_';
% my $censustract = $new{$pre.'censustract'};
-% my $census_error = $new{$pre.'census_error'};
% if ( $censustract ) {
<TR>
+ <TD ROWSPAN=2 CLASS="td_radio">
+ <INPUT TYPE="radio" NAME="census_replace" VALUE="" <% $census_error ? 'CHECKED="Y"' : '' %>>
+ </TD>
<TH>Entered census tract</TH>
<TH>Calculated census tract</TH>
+ <TD ROWSPAN=2 CLASS="td_radio">
+ <INPUT TYPE="radio" NAME="census_replace" VALUE="Y" <% $census_error ? '' : 'CHECKED="Y"' %>>
+ </TD>
</TR>
<TR>
<TD><% $old{$pre.'censustract'} %></TD>
@@ -93,35 +114,21 @@ Confirm address standardization
</TR>
% } #if censustract
-% if ( grep {$new{$_.'error'}} @prefixes ) {
<TR>
+ <TD> </TD>
<TD ALIGN="center">
- <BUTTON TYPE="button" STYLE="width:205px" onclick="confirm_manual_address();">
- <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered <%$addresses%>
+ <BUTTON TYPE="button" STYLE="width:205px" onclick="replace_address();">
+ <IMG SRC="<%$p%>images/<% $is_error ? 'error.png' : 'tick.png' %>"
+ ALT=""> Use selected <%$addresses%>
</BUTTON></TD>
<TD ALIGN="center">
<BUTTON TYPE="button" STYLE="width:205px" onclick="submit_abort();">
<IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
</BUTTON></TD>
+ <TD> </TD>
</TR>
-% } else {
- <TR>
- <TD ALIGN="center">
- <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">
- <BUTTON TYPE="button" STYLE="width:205px" onclick="replace_address();">
- <IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized <%$addresses%>
- </BUTTON></TD>
- </TR>
- <TR ALIGN="center"><TD COLSPAN=2>
- <BUTTON TYPE="button" STYLE="width:205px" onclick="submit_abort();">
- <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
- </BUTTON>
- </TD></TR>
</TABLE>
-% } # !error
+</FORM>
<%init>
# slightly weird interface...
@@ -132,4 +139,14 @@ 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>
-----------------------------------------------------------------------
Summary of changes:
httemplate/elements/standardize_locations.js | 16 ++++-
httemplate/misc/confirm-address_standardize.html | 81 +++++++++++++---------
2 files changed, 62 insertions(+), 35 deletions(-)
More information about the freeside-commits
mailing list