Fix: better compatibility

This commit is contained in:
Regis Houssin
2018-03-23 10:52:10 +01:00
parent 715852569b
commit f330c5ad32
3 changed files with 6 additions and 57 deletions

View File

@@ -2761,28 +2761,11 @@ class User extends CommonObject
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printUserListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
/*
if (! empty($conf->multicompany->enabled)) {
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (! empty($user->admin) && empty($user->entity)) {
if ($conf->entity == 1) {
$sql.= " WHERE u.entity IS NOT NULL";
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
} else {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('user').")";
}
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
if ($reshook > 0) {
$sql.=$hookmanager->resPrint;
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
*/
if ($filter) $sql.=" AND ".$filter;
dol_syslog(get_class($this)."::get_full_tree get user list", LOG_DEBUG);

View File

@@ -108,28 +108,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printUserListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
/*
if (! empty($conf->multicompany->enabled)) {
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (! empty($user->admin) && empty($user->entity)) {
if ($conf->entity == 1) {
$sql.= " WHERE u.entity IS NOT NULL";
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
} else {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('user').")";
}
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
if ($reshook > 0) {
$sql.=$hookmanager->resPrint;
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
*/
if (!empty($socid)) $sql.= " AND u.fk_soc = ".$socid;
$sql.= $db->order("u.datec","DESC");
$sql.= $db->plimit($max);

View File

@@ -194,28 +194,11 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printUserListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
/*
if (! empty($conf->multicompany->enabled)) {
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (! empty($user->admin) && empty($user->entity)) {
if ($conf->entity == 1) {
$sql.= " WHERE u.entity IS NOT NULL";
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
} else {
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ug.fk_user = u.rowid";
$sql.= " AND ug.entity IN (".getEntity('user').")";
}
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
if ($reshook > 0) {
$sql.=$hookmanager->resPrint;
} else {
$sql.= " WHERE u.entity IN (".getEntity('user').")";
}
*/
if ($socid > 0) $sql.= " AND u.fk_soc = ".$socid;
//if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
if ($search_supervisor > 0) $sql.= " AND u.fk_user IN (".$db->escape($search_supervisor).")";