|
From: Benjamin C. <bc...@us...> - 2004-09-04 20:37:53
|
Update of /cvsroot/phpbt/phpbt/inc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17540/inc Modified Files: Tag: htmltemplates functions.php Log Message: Fix from mufasa for bug #1017792 - Assignable users can show up more than once in the list if they belong to more than one assignable group. Index: functions.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/inc/functions.php,v retrieving revision 1.44.2.10 retrieving revision 1.44.2.11 diff -u -r1.44.2.10 -r1.44.2.11 --- functions.php 20 Jul 2004 10:39:35 -0000 1.44.2.10 +++ functions.php 4 Sep 2004 20:37:45 -0000 1.44.2.11 @@ -160,10 +160,11 @@ } break; case 'owner': - $rs = $db->query("select u.user_id, login from ".TBL_AUTH_USER." u, ".TBL_USER_GROUP." ug, ".TBL_AUTH_GROUP." g where u.active > 0 and u.user_id = ug.user_id and ug.group_id = g.group_id and g.assignable > 0 order by login"); + // Added the DISTINCT SQL modifier so we don't get duplicated users in the list. (Because of being in multiple groups with assignable rights.) + $rs = $db->query("select DISTINCT u.user_id, login from ".TBL_AUTH_USER." u, ".TBL_USER_GROUP." ug, ".TBL_AUTH_GROUP." g where u.active > 0 and u.user_id = ug.user_id and ug.group_id = g.group_id and g.assignable > 0 order by login"); while ($rs->fetchInto($row)) { // either singular matches, or array matches are acceptable - if (($selected == $row['user_id']) || in_array($row['user_id'], $selected)) { + if (($selected == $row['user_id']) || (is_array($selected) && in_array($row['user_id'], $selected))) { $sel = ' selected'; } else { $sel = ''; @@ -511,7 +512,9 @@ // Handle a database error function handle_db_error(&$obj) { - define(RAWERROR, false); + if (!defined('RAWERROR')) { + define('RAWERROR', false); + } if (!RAWERROR) { show_text('A database error has occurred'); } else { |