FIX wrong users count in multicompany transverse mode
This commit is contained in:
parent
52419f28c5
commit
8c95ada9fd
@ -3298,14 +3298,21 @@ class User extends CommonObject
|
||||
public function load_state_board()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$this->nb = array();
|
||||
|
||||
$sql = "SELECT count(u.rowid) as nb";
|
||||
$sql = "SELECT DISTINCT count(u.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.statut > 0";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql .= " WHERE ug.entity IN (".getEntity('usergroup').")";
|
||||
$sql .= " AND ug.fk_user = u.rowid ";
|
||||
} else {
|
||||
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||
}
|
||||
$sql .= " AND u.statut > 0";
|
||||
//$sql.= " AND employee != 0";
|
||||
$sql .= " AND u.entity IN (".getEntity('user').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user