]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 322082: Clean up user selection SQL.
authorwurblzap%gmail.com <>
Tue, 3 Jan 2006 16:40:45 +0000 (16:40 +0000)
committerwurblzap%gmail.com <>
Tue, 3 Jan 2006 16:40:45 +0000 (16:40 +0000)
Patch by Marc Schumann <wurblzap@gmail.com>,
r=LpSolit, a=justdave

editusers.cgi

index 40854775fe78928f04078dba62cfdbca04db4077..3e23d0808e1be6c88608139d01496501e6fe2a8c 100755 (executable)
@@ -100,9 +100,15 @@ if ($action eq 'search') {
     } else {
         $visibleGroups = 1;
         if ($grouprestrict eq '1') {
-            $query .= ', user_group_map AS ugm';
+            $query .= qq{, user_group_map AS ugm
+                         WHERE ugm.user_id = profiles.userid
+                           AND ugm.isbless = 0
+                        };
+            $nextCondition = 'AND';
+        }
+        else {
+            $nextCondition = 'WHERE';
         }
-        $nextCondition = 'WHERE';
     }
 
     if (!$visibleGroups) {
@@ -137,9 +143,7 @@ if ($action eq 'search') {
         if ($grouprestrict eq '1') {
             my $grouplist = join(',',
                 @{Bugzilla::User->flatten_group_membership($group->id)});
-            $query .= " $nextCondition profiles.userid = ugm.user_id " .
-                      "AND ugm.group_id IN($grouplist) " .
-                      "AND ugm.isbless = 0";
+            $query .= " $nextCondition ugm.group_id IN($grouplist) ";
         }
         $query .= ' ORDER BY profiles.login_name';