[freeside-commits] branch FREESIDE_4_BRANCH updated. 7516543c5faa680e7fd8e672ef2b5e3d3b97995a

Mark Wells mark at 420.am
Wed Jun 17 17:45:21 PDT 2015


The branch, FREESIDE_4_BRANCH has been updated
       via  7516543c5faa680e7fd8e672ef2b5e3d3b97995a (commit)
      from  4a54f823c77ae779f5a3d76f814036cc54ce18f1 (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 7516543c5faa680e7fd8e672ef2b5e3d3b97995a
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Jun 17 17:45:15 2015 -0700

    fix interaction of agent choice, agent-ship_address, and "same" checkbox, #21327 and #27545

diff --git a/httemplate/edit/cust_main/basics.html b/httemplate/edit/cust_main/basics.html
index e484c73..e16aafa 100644
--- a/httemplate/edit/cust_main/basics.html
+++ b/httemplate/edit/cust_main/basics.html
@@ -56,6 +56,7 @@
 %   # unlock/lock service location
 
     var f = what.form;
+    var was_same = f['same'].checked;
     if ( ship_locked_agents[agentnum] ) {
 %     # For this agent, the service location (except address2)
 %     # should be locked to the agent's location.
@@ -72,16 +73,25 @@
 %     # disabled, then they contain some agent's address, which is 
 %     # no longer meaningful.  So set them back to the customer's 
 %     # current location.
+      var is_same = true;
       for(var i=0; i<ship_fields.length; i++) {
         x = ship_fields[i];
         if ( f['ship_'+x].disabled )  {
           f['ship_'+x].value  = f['old_ship_'+x].value;
         }
         f['ship_'+x].disabled = false;
+        if ( f['bill_'+x].value != f['ship_'+x].value ) {
+          is_same = false;
+        }
       }
+%     # if the customer's current location has the same bill and ship 
+%     # address, then check the box
+      f['same'].checked = is_same;
       f['same'].disabled = false;
     }
-    samechanged(f['same']);
+    if (f['same'].checked != was_same) {
+      samechanged(f['same']);
+    }
 
 %   # update sales dropdown
     salesnum_agentnum_changed(what);
@@ -91,7 +101,13 @@
   <&| /elements/onload.js &>
   rescom_changed(document.getElementById('residential_commercial_Residential'));
   agent_changed(document.getElementById('agentnum'));
-  samechanged(document.getElementById('same'));
+
+  if ( $('#same').prop('checked') ) {
+    $('#div_ship_location').hide();
+  } else {
+    $('#div_ship_location').show();
+  }
+
   </&>
  
 </SCRIPT>
diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html
index a7803c8..90f2026 100644
--- a/httemplate/elements/location.html
+++ b/httemplate/elements/location.html
@@ -262,8 +262,9 @@ Example:
 %# For address standardization:
 %# keep a clean copy of the address so we know if we need
 %# to re-standardize
-% foreach (qw(address1 city state country zip latitude
-%             longitude censustract district addr_clean) ) {
+% foreach (qw(locationname address1 city state country zip latitude
+%             longitude censustract district addr_clean
+%             ) ) {
 <& hidden.html, field => 'old_'.$pre.$_, value => $object->get($_) &>
 % }
 %# Placeholders

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

Summary of changes:
 httemplate/edit/cust_main/basics.html |   20 ++++++++++++++++++--
 httemplate/elements/location.html     |    5 +++--
 2 files changed, 21 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list