]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 290366: JavaScript error in productmenu.js from editflagtypes.cgi and request...
authorlpsolit%gmail.com <>
Mon, 22 Aug 2005 03:05:39 +0000 (03:05 +0000)
committerlpsolit%gmail.com <>
Mon, 22 Aug 2005 03:05:39 +0000 (03:05 +0000)
productmenu.js

index e633ab3279d844c62fac8428a9f126f27500a840..90bb18195df15b8e9aec030c5be62dca853934a9 100644 (file)
@@ -181,6 +181,12 @@ function selectProduct( f , productfield, componentfield, blank ) {
         return;
     }
 
+    // Do nothing if no products are defined (this avoids the
+    // "a has no properties" error from merge_arrays function)
+    if (f[productfield].length == blank ? 1 : 0) {
+        return;
+    }
+
     // if this is the first load and nothing is selected, no need to
     // merge and sort all components; perl gives it to us sorted.
 
@@ -219,7 +225,8 @@ function selectProduct( f , productfield, componentfield, blank ) {
         for ( var i = blank ? 1 : 0 ; i < f[productfield].length ; i++ ) {
             sel[sel.length] = f[productfield].options[i].value;
         }
-        single = 0;
+        // If there is only one product, then only one product can be selected
+        single = ( sel.length == 1 );
     } else {
 
         for ( i = blank ? 1 : 0 ; i < f[productfield].length ; i++ ) {