From 778e581aca95af64b5ccc017072fb708b3189253 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Jun 2017 22:13:00 +0200 Subject: [PATCH] Fix: avoid warning on permission if there is only admin users --- htdocs/admin/modules.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 23d87791103..a59d6fca3bb 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -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:''));