diff options
author | Mark Wells <mark@freeside.biz> | 2014-12-02 15:43:34 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-12-02 15:43:34 -0800 |
commit | 801cd481b579d387dbe21266c717ef5d0b9aa422 (patch) | |
tree | ce468c4d188e1b7eb016f8050034496ede9031f2 | |
parent | c8f626eb6f664d9359d859dd03e8439504c4005d (diff) |
when address standardization returns a censustract, don't try to look it up through FFIEC also, #32459
-rw-r--r-- | httemplate/edit/cust_main/bottomfixup.js | 11 | ||||
-rw-r--r-- | httemplate/elements/location.html | 52 | ||||
-rw-r--r-- | httemplate/elements/standardize_locations.js | 5 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-address_standardize.html | 4 |
4 files changed, 42 insertions, 30 deletions
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 8aef1e72c..6a9deb92a 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -100,14 +100,13 @@ function copyelement(from, to) { //alert(from + " (" + from.type + "): " + to.name + " => " + to.value); } -% # the value in pre+'censustract' is the confirmed censustract; if it's set, -% # and the user hasn't changed it manually, skip this +% # the value in pre+'censustract' is the confirmed censustract (either from +% # the previous saved record, or from address standardization (if the backend +% # supports it), or from an aborted previous submit. only need to reconfirm +% # if it's empty. function confirm_censustract(pre) { var cf = document.CustomerForm; - if ( cf.elements[pre+'censustract'].value == '' || - cf.elements[pre+'enter_censustract'].value != - cf.elements[pre+'censustract'].value ) - { + if ( cf.elements[pre+'censustract'].value == '' ) { var address_info = form_address_info(); address_info[pre+'latitude'] = cf.elements[pre+'latitude'].value; address_info[pre+'longitude'] = cf.elements[pre+'longitude'].value; diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html index 5cdc424a7..214a7d5f2 100644 --- a/httemplate/elements/location.html +++ b/httemplate/elements/location.html @@ -59,12 +59,7 @@ Example: </TR> % } else { - - <INPUT TYPE = "hidden" - NAME = "<%$pre%>locationname" - ID = "<%$pre%>locationname" - VALUE = "<% $object->get('locationname') |h %>" - > + <& hidden.html, field => $pre.'locationname', value => $object->get('locationname') &> % } @@ -102,10 +97,7 @@ Example: % } else { # alternate format - <INPUT TYPE = "hidden" - NAME = "<%$pre%>address2" - VALUE = "<% $object->get('address2') |h %>" - > +<& hidden.html, field => $pre.'address2', value => $object->get('address2') &> <TR> <<%$th%> ALIGN="right">Unit type and #</<%$th%>> @@ -227,14 +219,14 @@ Example: </TR> % } else { % foreach (qw(latitude longitude)) { -<INPUT TYPE="hidden" NAME="<% $_ %>" ID="<% $_ %>" VALUE="<% $object->get($_) |h%>"> +<& hidden.html, field => $pre.$_, value => $object->get($_) &> % } % } -<INPUT TYPE="hidden" NAME="<%$pre%>coord_auto" VALUE="<% $object->coord_auto %>"> - -<INPUT TYPE="hidden" NAME="<%$pre%>geocode" VALUE="<% $object->geocode %>"> -<INPUT TYPE="hidden" NAME="<%$pre%>censustract" VALUE="<% $object->censustract %>"> -<INPUT TYPE="hidden" NAME="<%$pre%>censusyear" VALUE="<% $object->censusyear %>"> +% +% foreach (qw(coord_auto geocode censustract censusyear)) { + <& hidden.html, field => $pre.$_, value => $object->get($_) &> +% } +% % if ( $opt{enable_censustract} ) { <TR> <TD ALIGN="right">Census tract</TD> @@ -259,7 +251,7 @@ Example: </TD> </TR> % } else { - <INPUT TYPE="hidden" ID="<%$pre%>" NAME="<%$pre%>district" VALUE="<% $object->district %>"> + <& hidden.html, field => $pre.'district', value => $object->get('district') &> % } %# For address standardization: @@ -267,11 +259,11 @@ Example: %# to re-standardize % foreach (qw(address1 city state country zip latitude % longitude censustract district addr_clean) ) { -<INPUT TYPE="hidden" NAME="old_<%$pre.$_%>" ID="old_<%$pre.$_%>" VALUE="<% $object->get($_) |h%>"> +<& hidden.html, field => 'old_'.$pre.$_, value => $object->get($_) &> % } %# Placeholders -<INPUT TYPE="hidden" NAME="<%$pre%>cachenum" VALUE=""> -<INPUT TYPE="hidden" NAME="<%$pre%>addr_clean" VALUE=""> +<& hidden.html, field => $pre.'cachenum', value => '' &> +<& hidden.html, field => $pre.'addr_clean', value => '' &> <SCRIPT TYPE="text/javascript"> <&| /elements/onload.js &> @@ -306,6 +298,26 @@ Example: el.attachEvent('onchange', clear_coords); } } + function clear_censustract() { + // if the user manually edits the census tract, clear the 'hard' census + // tract field so that we can re-verify and present a confirmation popup + + // get the ID of the hidden censustract field + var censustract_id = this.id.replace('enter_', ''); + var el = document.getElementById(censustract_id); + if (el) { + el.value = ''; + } + } + var el = document.getElementById('<%$pre%>enter_censustract'); + if (el) { + if ( el.addEventListener ) { + el.addEventListener('change', clear_censustract); + } else if ( el.attachEvent ) { + el.attachEvent('onchange', clear_censustract); + } + } + </&> </SCRIPT> diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js index a4f13d78d..ff7183b26 100644 --- a/httemplate/elements/standardize_locations.js +++ b/httemplate/elements/standardize_locations.js @@ -279,10 +279,7 @@ function setselect(el, value) { function confirm_censustract() { % if ( FS::Conf->new->exists('cust_main-require_censustract') ) { var form = document.<% $formname %>; - // this is the existing/confirmed censustract, not the manually entered one - if ( form.elements['censustract'].value == '' || - form.elements['censustract'].value != - form.elements['enter_censustract'].value ) { + if ( form.elements['censustract'].value == '' ) { var address_info = form_address_info(); address_info['latitude'] = form.elements['latitude'].value; address_info['longitude'] = form.elements['longitude'].value; diff --git a/httemplate/misc/xmlhttp-address_standardize.html b/httemplate/misc/xmlhttp-address_standardize.html index 618265364..d0255a02a 100644 --- a/httemplate/misc/xmlhttp-address_standardize.html +++ b/httemplate/misc/xmlhttp-address_standardize.html @@ -43,6 +43,10 @@ foreach my $pre ( @prefixes ) { last if !$all_same; } + $all_same = 0 if ( length( $old{$pre.'censustract'} ) > 0 && + length( $new{$pre.'censustract'} ) > 0 && + $old{$pre.'censustract'} ne $new{$pre.'censustract'} ); + $all_same = 0 if $new{$pre.'error'}; } |