added refund reasons to main menu
[freeside.git] / httemplate / elements / tr-select-cust-part_pkg.html
index b9dc5a7..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' ],
@@ -11,7 +9,7 @@
       var optionName = new Option(text, value, false, false);
       optionName.setAttribute('data-can_discount',   can_discount);
       optionName.setAttribute('data-can_start_date', can_start_date);
-      optionName.setAttribute('data-start_date',     start_date);
+      optionName.setAttribute('data-start_date',     start_date || '');
       var length = what.length;
       what.options[length] = optionName;
     }
@@ -20,7 +18,7 @@
 
       what.form.pkgpart.disabled = 'disabled'; //disable part_pkg dropdown
       var submitButton = what.form.submitButton; // || what.form.submit;
-      if ( submitButton ) {
+      if ( submitButton && <% $opt{'curr_value'} ? 0 : 1 %> ) {
         submitButton.disabled = true; //disable the submit button
       }
       var discountnum = what.form.discountnum;
@@ -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) {
 
@@ -51,6 +49,9 @@
         }
 
         what.form.pkgpart.disabled = ''; //re-enable part_pkg dropdown
+%       if ( $opt{'curr_value'} ) {
+        what.form.pkgpart.value = <% $opt{'curr_value'} %>;
+%       }
 
       }
 
                   );
     }
 
-    window.onload = function() {
+    <&| /elements/onload.js &>
       classnum_changed(document.getElementById('classnum'));
-    }
+    </&>
 
   </SCRIPT>
 
+% if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) {
   <TR>
     <TH ALIGN="right"><% mt('Package Class') |h %></TH>
     <TD COLSPAN=7>
@@ -78,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>