FIX try to use WHERE EXISTS instead DISTINCT
This commit is contained in:
parent
7fd1051efc
commit
5726b40a10
@ -395,7 +395,7 @@ class FormOther
|
|||||||
if ($showempty) $out.='<option value="0"> </option>';
|
if ($showempty) $out.='<option value="0"> </option>';
|
||||||
|
|
||||||
// Get list of users allowed to be viewed
|
// Get list of users allowed to be viewed
|
||||||
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
|
$sql_usr = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.statut, u.login";
|
||||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
|
|
||||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||||
@ -428,9 +428,7 @@ class FormOther
|
|||||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||||
$sql_usr.= " WHERE u2.entity IS NOT NULL"; // Show all users
|
$sql_usr.= " WHERE u2.entity IS NOT NULL"; // Show all users
|
||||||
} else {
|
} else {
|
||||||
$sql_usr.= ",".MAIN_DB_PREFIX."usergroup_user as ug2";
|
$sql_usr.= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('user').") )";
|
||||||
$sql_usr.= " WHERE ug2.fk_user = u2.rowid";
|
|
||||||
$sql_usr.= " AND ug2.entity IN (".getEntity('user').")";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user