mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Merge remote-tracking branch 'origin/3.8' into develop
Conflicts: ChangeLog htdocs/comm/propal/class/propal.class.php htdocs/compta/facture/admin/facture_cust_extrafields.php htdocs/compta/facture/admin/facturedet_cust_extrafields.php htdocs/compta/facture/class/facture.class.php htdocs/contrat/card.php
This commit is contained in:
@@ -2194,25 +2194,27 @@ class User extends CommonObject
|
||||
/**
|
||||
* Return number of existing users
|
||||
*
|
||||
* @param string $limitTo Limit to 'active' or 'superadmin' users
|
||||
* @param bool $all Return for all entities
|
||||
* @param string $limitTo Limit to '' or 'active'
|
||||
* @param string $option 'superadmin' = return for entity 0 only
|
||||
* @param int $admin Filter on admin tag
|
||||
* @return int Number of users
|
||||
*/
|
||||
function getNbOfUsers($limitTo='active', $all=false)
|
||||
function getNbOfUsers($limitTo, $option='', $admin=-1)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT count(rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user";
|
||||
if ($limitTo == 'superadmin')
|
||||
if ($option == 'superadmin')
|
||||
{
|
||||
$sql.= " WHERE entity = 0";
|
||||
if ($admin >= 0) $sql.= " AND admin = ".$admin;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($all) $sql.= " WHERE entity > 0"; // all users except superadmins
|
||||
else $sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.=" WHERE entity IN (".getEntity('user',0).")";
|
||||
if ($limitTo == 'active') $sql.= " AND statut = 1";
|
||||
if ($admin >= 0) $sql.= " AND admin = ".$admin;
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@@ -2226,7 +2228,7 @@ class User extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2355,7 +2357,7 @@ class User extends CommonObject
|
||||
$this->load_parentof();
|
||||
|
||||
// Init $this->users array
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.statut, u.entity"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.entity"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && (! empty($conf->multicompany->transverse_mode) || (! empty($user->admin) && empty($user->entity))))
|
||||
{
|
||||
@@ -2385,6 +2387,7 @@ class User extends CommonObject
|
||||
$this->users[$obj->rowid]['entity'] = $obj->entity;
|
||||
$this->users[$obj->rowid]['email'] = $obj->email;
|
||||
$this->users[$obj->rowid]['gender'] = $obj->gender;
|
||||
$this->users[$obj->rowid]['admin'] = $obj->admin;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user