This commit was manufactured by cvs2svn to create tag 'freeside_2_1_1'.
[freeside.git] / httemplate / edit / cust_main / bottomfixup.js
index 06e8b13..5d06f3c 100644 (file)
@@ -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',   <% $conf->config('census_year') || '2008' %>,
+    '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,
@@ -311,26 +315,33 @@ function update_censustract(arg) {
   if (error || cf.elements['censustract'].value != newcensus) {
     // popup an entry dialog
 
+    if (error) { newcensus = error; }
+    newcensus.replace(/.*ndefined.*/, 'Not found');
+
     var choose_censustract =
       '<CENTER><BR><B>Confirm censustract</B><BR>' +
       '<A href="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?' +
       'census_year=<% $conf->config('census_year') || '2008' %>' +
       '&latitude=' + cf.elements['latitude'].value +
       '&longitude=' + cf.elements['longitude'].value +
-      '" target="_blank">Map service module location</A><BR><BR>' +
+      '" target="_blank">Map service module location</A><BR>' +
+      '<A href="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?' +
+      'census_year=<% $conf->config('census_year') || '2008' %>' +
+      '&zip_code=' + cf.elements['ship_zip'].value +
+      '" target="_blank">Map zip code center</A><BR><BR>' +
       '<TABLE>';
     
     choose_censustract = choose_censustract + 
-      '<TR><TH>Entered census tract</TH>' +
-        '<TH>Calculated census tract</TH></TR>' +
+      '<TR><TH style="width:50%">Entered census tract</TH>' +
+        '<TH style="width:50%">Calculated census tract</TH></TR>' +
       '<TR><TD>' + cf.elements['censustract'].value +
         '</TD><TD>' + newcensus + '</TD></TR>' +
         '<TR><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>';
 
     choose_censustract = choose_censustract +
-      '<TR><TD>' +
+      '<TR><TD ALIGN="center">' +
         '<BUTTON TYPE="button" onClick="document.CustomerForm.submit();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract </BUTTON>' + 
-      '</TD><TD>' +
+      '</TD><TD ALIGN="center">' +
         '<BUTTON TYPE="button" onClick="set_censustract();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract </BUTTON>' + 
       '</TD></TR>' +
       '<TR><TD COLSPAN=2 ALIGN="center">' +