diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search.pm b/mozilla/webtools/bugzilla/Bugzilla/Search.pm index 78d6526bafe..ec31912ac27 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Search.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Search.pm @@ -813,9 +813,22 @@ sub init { $suppseen{$str} = 1; } } - my $query = ("SELECT DISTINCT " . join(', ', @fields) . + my $query = ("SELECT DISTINCT " . + " COUNT(ugmap.group_id) AS cntuseringroups, " . + " COUNT(bgmap.group_id) AS cntbugingroups, " . + join(', ', @fields) . " FROM $suppstring" . - " WHERE " . join(' AND ', (@wherepart, @andlist))); + " LEFT JOIN bug_group_map AS bgmap " . + " ON bgmap.bug_id = bugs.bug_id " . + " LEFT JOIN user_group_map AS ugmap " . + " ON bgmap.group_id = ugmap.group_id " . + " AND ugmap.user_id = $::userid" . + " AND ugmap.isbless = 0" . + " WHERE " . join(' AND ', (@wherepart, @andlist)) . + " GROUP BY bugs.bug_id " . + " HAVING cntuseringroups = cntbugingroups" . + " " + ); if ($debug) { print "

" . value_quote($query) . "

\n"; diff --git a/mozilla/webtools/bugzilla/buglist.cgi b/mozilla/webtools/bugzilla/buglist.cgi index ca19f10197a..f6b79237cc7 100755 --- a/mozilla/webtools/bugzilla/buglist.cgi +++ b/mozilla/webtools/bugzilla/buglist.cgi @@ -211,9 +211,9 @@ sub GetGroupsByUserId { SendSQL(" SELECT groups.id, name, description, isactive FROM groups, user_group_map - WHERE user_id = $userid AND isbless = 0 + WHERE user_id = $userid AND NOT isbless AND user_group_map.group_id = groups.id - AND isbuggroup = 1 + AND isbuggroup ORDER BY description "); my @groups; @@ -606,6 +606,9 @@ my @bugs; # the list of records while (my @row = FetchSQLData()) { my $bug = {}; # a record + # discard the first 2 fields - they are counters for filtering + shift @row; + shift @row; # Slurp the row of data into the record. foreach my $column (@selectcolumns) {