[freeside-commits] branch master updated. 5ad226c0ff7759184ea26d66292ccebd2ec00af7
Mark Wells
mark at 420.am
Tue Nov 20 16:12:07 PST 2012
The branch, master has been updated
via 5ad226c0ff7759184ea26d66292ccebd2ec00af7 (commit)
from 044e4ea5533f1c14697b7ad408dc0cf0e0327abb (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 5ad226c0ff7759184ea26d66292ccebd2ec00af7
Author: Mark Wells <mark at freeside.biz>
Date: Tue Nov 20 16:11:50 2012 -0800
fix a confusing standardization behavior, #13763
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index d9c1df7..15c5761 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -1,3 +1,9 @@
+function status_message(text, caption) {
+ text = '<P STYLE="position:absolute; top:50%; margin-top:-1em; width:100%; text-align:center"><B><FONT SIZE="+1">' + text + '</FONT></B></P>';
+ caption = caption || 'Please wait...';
+ overlib(text, WIDTH, 444, HEIGHT, 168, CAPTION, caption, STICKY, AUTOSTATUSCAP, CLOSECLICK, MIDX, 0, MIDY, 0);
+}
+
function form_address_info() {
var cf = document.<% $formname %>;
@@ -87,8 +93,7 @@ function standardize_locations() {
% if ( $conf->config('address_standardize_method') ) {
if ( changed ) {
- var startup_msg = '<P STYLE="position:absolute; top:50%; margin-top:-1em; width:100%; text-align:center"><B><FONT SIZE="+1">Verifying address...</FONT></B></P>';
- overlib(startup_msg, WIDTH, 444, HEIGHT, 168, CAPTION, 'Please wait...', STICKY, AUTOSTATUSCAP, CLOSECLICK, MIDX, 0, MIDY, 0);
+ status_message('Verifying address...');
address_standardize(JSON.stringify(address_info), confirm_standardize);
}
else {
@@ -116,8 +121,14 @@ function confirm_standardize(arg) {
replace_address(); // with the contents of returned['new']
- }
- else {
+ } else if ( returned['all_same'] ) {
+
+ // then all entered address fields are correct
+ // but we still need to set the lat/long fields and addr_clean
+ status_message('Verified');
+ replace_address();
+
+ } else {
var querystring = encodeURIComponent( JSON.stringify(returned) );
// confirmation popup: knows to call replace_address(),
diff --git a/httemplate/misc/xmlhttp-address_standardize.html b/httemplate/misc/xmlhttp-address_standardize.html
index 1620642..9880571 100644
--- a/httemplate/misc/xmlhttp-address_standardize.html
+++ b/httemplate/misc/xmlhttp-address_standardize.html
@@ -24,6 +24,7 @@ if ($old{onlyship}) {
} else {
@prefixes = ('bill_', 'ship_');
}
+my $all_same = 1;
foreach my $pre ( @prefixes ) {
my $location = {
@@ -38,8 +39,13 @@ foreach my $pre ( @prefixes ) {
foreach ( keys(%$cache) ) {
$new{$pre.$_} = $cache->get($_);
}
+
+ foreach ( qw(address1 address2 city state zip country) ) {
+ $all_same = 0 if ( $new{$pre.$_} ne $old{$pre.$_} );
+ last if !$all_same;
+ }
}
-my $return = { old => \%old, new => \%new };
+my $return = { old => \%old, new => \%new, all_same => $all_same };
warn "result:\n".encode_json($return) if $DEBUG;
</%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/elements/standardize_locations.js | 19 +++++++++++++++----
httemplate/misc/xmlhttp-address_standardize.html | 8 +++++++-
2 files changed, 22 insertions(+), 5 deletions(-)
More information about the freeside-commits
mailing list