From f330c5ad3263bb16094c9f3dc68a84e5c5517355 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Mar 2018 10:52:10 +0100 Subject: [PATCH] Fix: better compatibility --- htdocs/user/class/user.class.php | 21 ++------------------- htdocs/user/home.php | 21 ++------------------- htdocs/user/index.php | 21 ++------------------- 3 files changed, 6 insertions(+), 57 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a32ec07b648..bf9ff370e11 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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); diff --git a/htdocs/user/home.php b/htdocs/user/home.php index d8659a5e93c..ac14f6b0243 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -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); diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 4cf5969668e..4d83903d0aa 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -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).")";