Skip to content
Snippets Groups Projects
Commit 778e581a authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: avoid warning on permission if there is only admin users

parent bd4f91d7
No related branches found
No related tags found
No related merge requests found
......@@ -207,8 +207,19 @@ if ($action == 'set' && $user->admin)
//var_dump($resarray);exit;
if ($resarray['nbperms'] > 0)
{
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
setEventMessages($msg, null, 'warnings');
$tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
$resqltmp=$db->query($tmpsql);
if ($resqltmp)
{
$obj=$db->fetch_object($resqltmp);
//var_dump($obj->nb);exit;
if ($obj && $obj->nb > 1)
{
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
setEventMessages($msg, null, 'warnings');
}
}
else dol_print_error($db);
}
}
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment