fix latitude/longitude w/cust_main-require_censustract, RT#16479
[freeside.git] / httemplate / edit / cust_main / bottomfixup.js
index 9d1f1e1..6b30cbc 100644 (file)
@@ -37,7 +37,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') || '2011' %>,
+    'year',     <% $conf->config('census_year') || '2012' %>,
     'address1', cf.elements['ship_address1'].value,
     'city',     cf.elements['ship_city'].value,
     'state',    state_el.options[ state_el.selectedIndex ].value,
@@ -76,7 +76,7 @@ function update_censustract(arg) {
 
   set_censustract = function () {
 
-    cf.elements['censustract'].value = newcensus
+    cf.elements['censustract'].value = newcensus;
     cf.submit();
 
   }
@@ -87,15 +87,18 @@ function update_censustract(arg) {
     if (error) { newcensus = error; }
     newcensus.replace(/.*ndefined.*/, 'Not found');
 
+    var latitude = cf.elements['latitude' ].value || '<% $company_latitude %>';
+    var longitude= cf.elements['longitude'].value || '<% $company_longitude %>';
+
     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 +
+      'census_year=<% $conf->config('census_year') || '2012' %>' +
+      '&latitude=' + latitude +
+      '&longitude=' + longitude +
       '" target="_blank">Map service module location</A><BR>' +
       '<A href="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?' +
-      'census_year=<% $conf->config('census_year') || '2008' %>' +
+      'census_year=<% $conf->config('census_year') || '2012' %>' +
       '&zip_code=' + cf.elements['ship_zip'].value +
       '" target="_blank">Map zip code center</A><BR><BR>' +
       '<TABLE>';
@@ -154,4 +157,8 @@ function copyelement(from, to) {
 
 my $conf = new FS::Conf;
 
+my $company_latitude  = $conf->config('company_latitude');
+my $company_longitude = $conf->config('company_longitude');
+
+
 </%init>