diff --git a/webtools/bugzilla/query.cgi b/webtools/bugzilla/query.cgi index 23bbf58cca9..ea96e37ee01 100755 --- a/webtools/bugzilla/query.cgi +++ b/webtools/bugzilla/query.cgi @@ -20,6 +20,7 @@ # # Contributor(s): Terry Weissman # David Gardiner +# Matthias Radestock use diagnostics; use strict; @@ -278,16 +279,47 @@ my $emailinput2 = GenerateEmailInput(2); # have access to. remove them from the list. @::product_list = (); +my %component_set; +my %version_set; +my %milestone_set; foreach my $p (@::legal_product) { - if(Param("usebuggroupsentry") - && GroupExists($p) - && !UserInGroup($p)) { - # If we're using bug groups to restrict entry on products, and - # this product has a bug group, and the user is not in that - # group, we don't want to include that product in this list. - next; - } - push @::product_list, $p; + if(Param("usebuggroups") + && GroupExists($p) + && !UserInGroup($p)) { + # If we're using bug groups to restrict entry on products, and + # this product has a bug group, and the user is not in that + # group, we don't want to include that product in this list. + next; + } + push @::product_list, $p; + foreach my $c (@{$::components{$p}}) { + $component_set{$c} = 1; + } + foreach my $v (@{$::versions{$p}}) { + $version_set{$v} = 1; + } + foreach my $m (@{$::target_milestone{$p}}) { + $milestone_set{$m} = 1; + } +} + +@::component_list = (); +@::version_list = (); +@::milestone_list = (); +foreach my $c (@::legal_components) { + if ($component_set{$c}) { + push @::component_list, $c; + } +} +foreach my $v (@::legal_versions) { + if ($version_set{$v}) { + push @::version_list, $v; + } +} +foreach my $m (@::legal_target_milestone) { + if ($milestone_set{$m}) { + push @::milestone_list, $m; + } } # javascript @@ -308,16 +340,16 @@ my $m; my $i = 0; my $j = 0; -foreach $c (@::legal_components) { +foreach $c (@::component_list) { $jscript .= "cpts['$c'] = new Array();\n"; } -foreach $v (@::legal_versions) { +foreach $v (@::version_list) { $jscript .= "vers['$v'] = new Array();\n"; } my $tm; -foreach $tm (@::legal_target_milestone) { +foreach $tm (@::milestone_list) { $jscript .= "tms['$tm'] = new Array();\n"; } @@ -629,13 +661,13 @@ print " "; @@ -643,7 +675,7 @@ if (Param("usetargetmilestone")) { print " "; }