Fix: wrong user count
This commit is contained in:
parent
da995f248b
commit
b77a2255a0
@ -1984,10 +1984,10 @@ class User extends CommonObject
|
||||
* Return number of existing users
|
||||
*
|
||||
* @param string $limitTo Limit to 'active' or 'superadmin' users
|
||||
* @param int $all Return for all entities
|
||||
* @param bool $all Return for all entities
|
||||
* @return int Number of users
|
||||
*/
|
||||
function getNbOfUsers($limitTo='',$all=0)
|
||||
function getNbOfUsers($limitTo='active', $all=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1999,7 +1999,7 @@ class User extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($all) $sql.= " WHERE entity IS NOT NULL"; // all users except superadmin
|
||||
if ($all) $sql.= " WHERE entity > 0"; // all users except superadmins
|
||||
else $sql.= " WHERE entity = ".$conf->entity;
|
||||
if ($limitTo == 'active') $sql.= " AND statut = 1";
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser)
|
||||
|
||||
if (!empty($conf->file->main_limit_users))
|
||||
{
|
||||
$nb = $edituser->getNbOfUsers("active",1);
|
||||
$nb = $edituser->getNbOfUsers("active");
|
||||
if ($nb >= $conf->file->main_limit_users)
|
||||
{
|
||||
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>';
|
||||
@ -177,7 +177,7 @@ if ($action == 'add' && $canadduser)
|
||||
|
||||
if (! empty($conf->file->main_limit_users)) // If option to limit users is set
|
||||
{
|
||||
$nb = $edituser->getNbOfUsers("active",1);
|
||||
$nb = $edituser->getNbOfUsers("active");
|
||||
if ($nb >= $conf->file->main_limit_users)
|
||||
{
|
||||
$message='<div class="error">'.$langs->trans("YourQuotaOfUsersIsReached").'</div>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user