fix misfire of USPS address correction on non-new locations, RT#12183
authorivan <ivan>
Mon, 11 Apr 2011 01:24:50 +0000 (01:24 +0000)
committerivan <ivan>
Mon, 11 Apr 2011 01:24:50 +0000 (01:24 +0000)
httemplate/elements/tr-select-cust_location.html
httemplate/misc/order_pkg.html

index 6de0346..49478f2 100644 (file)
@@ -145,7 +145,10 @@ Example:
 <TR>
   <<%$th%> ALIGN="right"><% $opt{'label'} || 'Service&nbsp;location' %></<%$th%>>
   <TD COLSPAN=7>
-    <SELECT NAME="locationnum" onChange="locationnum_changed(this);">
+    <SELECT NAME     = "locationnum"
+            ID       = "locationnum"
+            onChange = "locationnum_changed(this);"
+    >
       <OPTION VALUE=""><% $opt{'empty_label'} || '(default service address)' |h %>
 %     my @locations = $cust_main ? $cust_main->cust_location : ();
 %     push @locations, $cust_location
index b232deb..92ec095 100644 (file)
 %>
 
 <BR>
-<INPUT NAME="submitButton" TYPE="button" VALUE="Order Package" onClick = "this.disabled=true; standardize_locations();" <% $pkgpart ? '' : 'DISABLED' %>>
+<INPUT NAME="submitButton" TYPE="button" VALUE="Order Package" onClick = "this.disabled=true; standardize_new_location();" <% $pkgpart ? '' : 'DISABLED' %>>
+
+<SCRIPT TYPE="text/javascript">
+
+  function standardize_new_location() {
+    var form = document.OrderPkgForm;
+    var loc = form.locationnum;
+    if (loc.type = 'select-one' && loc.options[loc.selectedIndex].value == -1) {
+      standardize_locations();
+    } else {
+      form.submit();
+    }
+  }
+
+</SCRIPT>
+
 
 </FORM>
 </BODY>