fix package dropdown when there are no package classes, #20686
authorMark Wells <mark@freeside.biz>
Thu, 19 Sep 2013 19:45:53 +0000 (12:45 -0700)
committerMark Wells <mark@freeside.biz>
Thu, 19 Sep 2013 19:45:53 +0000 (12:45 -0700)
httemplate/elements/tr-select-cust-part_pkg.html

index 8431beb..696baff 100644 (file)
@@ -1,5 +1,3 @@
-%if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) {
-
   <& /elements/xmlhttp.html,
                 'url'  => $p.'misc/cust-part_pkg.cgi',
                 'subs' => [ 'get_part_pkg' ],
@@ -28,7 +26,7 @@
         discountnum.disabled = true; //disable discount dropdown
       }
 
-      classnum = what.options[what.selectedIndex].value;
+      classnum = what.value;
 
       function update_part_pkg(part_pkg) {
 
@@ -70,6 +68,7 @@
 
   </SCRIPT>
 
+% if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) {
   <TR>
     <TH ALIGN="right"><% mt('Package Class') |h %></TH>
     <TD COLSPAN=7>
@@ -81,7 +80,9 @@
     </TD>
   </TR>
 
-%}
+% } else { # so that the rest of the page works correctly
+  <INPUT TYPE="hidden" ID="classnum" NAME="classnum" VALUE="-1`">
+% }
 
 <TR>
   <TH ALIGN="right"><% mt('Package') |h %></TH>