summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-08-22 05:05:39 +0200
committerlpsolit%gmail.com <>2005-08-22 05:05:39 +0200
commit7e7134c7418c3381c4fda14fcceffec0fe2769eb (patch)
treeacf16d229c69f1733e8732d1c85fd0a75f403ffa
parent86876b1472b6bccc1fd37927694637d99220cdb9 (diff)
downloadbugzilla-7e7134c7418c3381c4fda14fcceffec0fe2769eb.tar.gz
bugzilla-7e7134c7418c3381c4fda14fcceffec0fe2769eb.tar.xz
Bug 290366: JavaScript error in productmenu.js from editflagtypes.cgi and request.cgi when only one product defined - Patch by Teemu Mannermaa <wicked@etlicon.fi> r/a=myk
-rw-r--r--productmenu.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/productmenu.js b/productmenu.js
index e633ab327..90bb18195 100644
--- a/productmenu.js
+++ b/productmenu.js
@@ -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++ ) {