[freeside-commits] branch master updated. adc62b5c44f6e6fddda75aff0d594d7a7d95a403

Mark Wells mark at 420.am
Thu Oct 24 00:01:46 PDT 2013


The branch, master has been updated
       via  adc62b5c44f6e6fddda75aff0d594d7a7d95a403 (commit)
      from  c78ac03d2e45a2979523d8c8999ab8714a58941f (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 adc62b5c44f6e6fddda75aff0d594d7a7d95a403
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Oct 24 00:00:14 2013 -0700

    fix CCH geocode lookup and display with 3.x-style locations, #25547

diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index ad774d8..debd9e7 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -202,23 +202,32 @@ function post_standardization() {
 
   var cf = document.<% $formname %>;
 
-  if ( new String(cf.elements['<% $taxpre %>zip'].value).length < 10 )
+  var prefix = '<% $taxpre %>';
+  // fix edge case with cust_main
+  if ( cf.elements['same']
+    && cf.elements['same'].checked
+    && prefix == 'ship_' ) {
+
+    prefix = 'bill_';
+  }
+
+  if ( new String(cf.elements[prefix + 'zip'].value).length < 10 )
   {
 
-    var country_el = cf.elements['<% $taxpre %>country'];
+    var country_el = cf.elements[prefix + 'country'];
     var country = country_el.options[ country_el.selectedIndex ].value;
-    var geocode = cf.elements['<% $taxpre %>geocode'].value;
+    var geocode = cf.elements[prefix + 'geocode'].value;
 
     if ( country == 'CA' || country == 'US' ) {
 
-      var state_el = cf.elements['<% $taxpre %>state'];
+      var state_el = cf.elements[prefix + 'state'];
       var state = state_el.options[ state_el.selectedIndex ].value;
 
       var url = "<% $p %>/misc/choose_tax_location.html" +
                   "?data_vendor=cch-zip" + 
-                  ";city="     + cf.elements['<% $taxpre %>city'].value +
+                  ";city="     + cf.elements[prefix + 'city'].value +
                   ";state="    + state + 
-                  ";zip="      + cf.elements['<% $taxpre %>zip'].value +
+                  ";zip="      + cf.elements[prefix + 'zip'].value +
                   ";country="  + country +
                   ";geocode="  + geocode +
                   ";formname=" + '<% $formname %>' +
@@ -229,14 +238,14 @@ function post_standardization() {
 
     } else {
 
-      cf.elements['<% $taxpre %>geocode'].value = 'DEFAULT';
+      cf.elements[prefix + 'geocode'].value = 'DEFAULT';
       <% $post_geocode %>;
 
     }
 
   } else {
 
-    cf.elements['<% $taxpre %>geocode'].value = '';
+    cf.elements[prefix + 'geocode'].value = '';
     <% $post_geocode %>;
 
   }
@@ -255,13 +264,19 @@ function update_geocode() {
   set_geocode = function (what) {
 
     var cf = document.<% $formname %>;
+    var prefix = '<% $taxpre %>';
+    if ( cf.elements['same']
+      && cf.elements['same'].checked
+      && prefix == 'ship_' ) {
+      prefix = 'bill_';
+    }
 
     //alert(what.options[what.selectedIndex].value);
     var argsHash = eval('(' + what.options[what.selectedIndex].value + ')');
-    cf.elements['<% $taxpre %>city'].value     = argsHash['city'];
-    setselect(cf.elements['<% $taxpre %>state'], argsHash['state']);
-    cf.elements['<% $taxpre %>zip'].value      = argsHash['zip'];
-    cf.elements['<% $taxpre %>geocode'].value  = argsHash['geocode'];
+    cf.elements[prefix + 'city'].value     = argsHash['city'];
+    setselect(cf.elements[prefix + 'state'], argsHash['state']);
+    cf.elements[prefix + 'zip'].value      = argsHash['zip'];
+    cf.elements[prefix + 'geocode'].value  = argsHash['geocode'];
     <% $post_geocode %>;
 
   }
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index e286305..e0dd7b9 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -221,7 +221,10 @@
 % if ( $conf->exists('enable_taxproducts') ) {
 <TR>
   <TD ALIGN="right"><% mt('Tax location') |h %></TD>
-  <TD BGCOLOR="#ffffff"><% $cust_main->geocode('cch') %></TD>
+% my $tax_location = $conf->exists('tax-ship_address')
+%                    ? $cust_main->ship_location
+%                    : $cust_main->bill_location;
+  <TD BGCOLOR="#ffffff"><% $tax_location->geocode('cch') %></TD>
 </TR>
 % }
 <TR>

-----------------------------------------------------------------------

Summary of changes:
 httemplate/elements/standardize_locations.js |   39 ++++++++++++++++++--------
 httemplate/view/cust_main/billing.html       |    5 ++-
 2 files changed, 31 insertions(+), 13 deletions(-)




More information about the freeside-commits mailing list