Fix: get_full_tree must follow same filter rule thant list of users

This commit is contained in:
Laurent Destailleur 2014-05-30 12:43:07 +02:00
parent 3c4dfba99e
commit 449678d687

View File

@ -2235,8 +2235,14 @@ class User extends CommonObject
// Init $this->users array
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity))))
{
$sql.= " WHERE u.entity IS NOT NULL";
}
else
{
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
}
dol_syslog(get_class($this)."::get_full_tree get user list sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)