X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fcust_main%2Fbottomfixup.js;h=5d06f3c0455f4aa6eb8311931a4fd1191a25d5de;hb=6dc850028dbd122e60e2ffd7a5be74451f9c687e;hp=822f98d39ec5e5e57ed5f2e8a76f74863e8e51d3;hpb=55f003404af6a2416571138356d11c5ad3755e58;p=freeside.git diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 822f98d39..5d06f3c04 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -1,5 +1,6 @@ function bottomfixup(what) { +%# ../cust_main.cgi var layervars = new Array( 'payauto', 'payinfo', 'payinfo1', 'payinfo2', 'paytype', @@ -196,6 +197,7 @@ function post_standardization() { var country_el = cf.elements['<% $taxpre %>country']; var country = country_el.options[ country_el.selectedIndex ].value; + var geocode = cf.elements['geocode'].value; if ( country == 'CA' || country == 'US' ) { @@ -208,6 +210,7 @@ function post_standardization() { ";state=" + state + ";zip=" + cf.elements['<% $taxpre %>zip'].value + ";country=" + country + + ";geocode=" + geocode + ";"; // popup a chooser @@ -222,6 +225,7 @@ function post_standardization() { } else { + cf.elements['geocode'].value = ''; post_geocode(); } @@ -242,7 +246,7 @@ function post_geocode() { var cf = document.CustomerForm; var state_el = cf.elements['ship_state']; var census_data = new Array( - 'year', '2008', // from config value? + 'year', <% $conf->config('census_year') || '2009' %>, 'address', cf.elements['ship_address1'].value, 'city', cf.elements['ship_city'].value, 'state', state_el.options[ state_el.selectedIndex ].value, @@ -296,44 +300,59 @@ function update_censustract(arg) { var tractcode = argsHash['tractcode']; var error = argsHash['error']; + var newcensus = + new String(statecode) + + new String(countycode) + + new String(tractcode).replace(/\s$/, ''); // JSON 1 workaround + set_censustract = function () { - cf.elements['censustract'].value = - document.forms.popupcensustract.elements.censustract.value; + cf.elements['censustract'].value = newcensus cf.submit(); } - if (error) { + if (error || cf.elements['censustract'].value != newcensus) { // popup an entry dialog + if (error) { newcensus = error; } + newcensus.replace(/.*ndefined.*/, 'Not found'); + var choose_censustract = - '

Enter census tract

' + - '
' + + '

Confirm censustract
' + + 'Map service module location
' + + 'Map zip code center

' + ''; choose_censustract = choose_censustract + - '' + - '' + - '' + - ''; - - choose_censustract = choose_censustract + - '' + + '' + + '' + + ''; + + choose_censustract = choose_censustract + + '' + + '' + - '
Census Tract:
  
' + - '' + - '' + + '
Entered census tractCalculated census tract
' + cf.elements['censustract'].value + + '' + newcensus + '
  
' + + '' + + '' + + '' + + '
' + '
'; + + '
'; - overlib( choose_censustract, CAPTION, 'Choose a census tract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + overlib( choose_censustract, CAPTION, 'Confirm censustract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); - setTimeout("document.forms.popupcensustract.elements.censustract.focus()",1); } else { - cf.elements['censustract'].value = - new String(statecode) + - new String(countycode) + - new String(tractcode); cf.submit(); }