diff options
author | lpsolit%gmail.com <> | 2008-08-19 23:09:03 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2008-08-19 23:09:03 +0200 |
commit | 9c80dc0d41fcf89640990948e308e683f6d5583f (patch) | |
tree | 8bae90f413477b926c1b7fb03532db7dbf7a0aae | |
parent | c91e89b741081d78d61eed2e2fcfee4d33f73a72 (diff) | |
download | bugzilla-9c80dc0d41fcf89640990948e308e683f6d5583f.tar.gz bugzilla-9c80dc0d41fcf89640990948e308e683f6d5583f.tar.xz |
Bug 241198: Don't display disabled flags with no items in the request queue flag dropdown list - Patch by Frédéric Buclin <LpSolit@gmail.com> r=ghendricks a=LpSolit
-rwxr-xr-x | request.cgi | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/request.cgi b/request.cgi index bc4e2c76e..666b74b17 100755 --- a/request.cgi +++ b/request.cgi @@ -42,7 +42,6 @@ use Bugzilla::Component; # Make sure the user is logged in. my $user = Bugzilla->login(); my $cgi = Bugzilla->cgi; -my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; my $action = $cgi->param('action') || ''; @@ -68,8 +67,7 @@ if ($action eq 'queue') { queue(); } else { - my $flagtypes = $dbh->selectcol_arrayref('SELECT DISTINCT(name) FROM flagtypes - ORDER BY name'); + my $flagtypes = get_flag_types(); my @types = ('all', @$flagtypes); my $vars = {}; @@ -303,8 +301,7 @@ sub queue { # Get a list of request type names to use in the filter form. my @types = ("all"); - my $flagtypes = $dbh->selectcol_arrayref( - "SELECT DISTINCT(name) FROM flagtypes ORDER BY name"); + my $flagtypes = get_flag_types(); push(@types, @$flagtypes); # We move back to the main DB to get the list of products the user can see. @@ -355,3 +352,14 @@ sub validateGroup { return $group; } +# Returns all flag types which have at least one flag of this type. +# If a flag type is inactive but still has flags, we want it. +sub get_flag_types { + my $dbh = Bugzilla->dbh; + my $flag_types = $dbh->selectcol_arrayref('SELECT DISTINCT name + FROM flagtypes + WHERE flagtypes.id IN + (SELECT DISTINCT type_id FROM flags) + ORDER BY name'); + return $flag_types; +} |