summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_main
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-06-17 17:44:23 -0700
committerMark Wells <mark@freeside.biz>2015-06-17 17:44:23 -0700
commitc6ab4d567c978cbe616c8cb5201c61bde212b3a0 (patch)
tree4db34c54c4545649c8179ee69fbf9cc4c64da673 /httemplate/edit/cust_main
parentaaeaf74ce3d3ceb731633a054d56a7f916ff2721 (diff)
fix interaction of agent choice, agent-ship_address, and "same" checkbox, #21327 and #27545
Diffstat (limited to 'httemplate/edit/cust_main')
-rw-r--r--httemplate/edit/cust_main/basics.html20
1 files changed, 18 insertions, 2 deletions
diff --git a/httemplate/edit/cust_main/basics.html b/httemplate/edit/cust_main/basics.html
index e484c732d..e16aafafc 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>