diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index c08f3522fff..c9ed93052fe 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -147,7 +147,6 @@ foreach ($modulesdir as $dir) $db->commit(); - // Affiche lignes des permissions $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; @@ -159,10 +158,11 @@ $sql.= " ORDER BY r.module, r.id"; $result = $db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; - $var=True; - $old = ""; + $num = $db->num_rows($result); + $i = 0; + $var = True; + $oldmod = ""; + while ($i < $num) { $obj = $db->fetch_object($result); @@ -176,7 +176,7 @@ if ($result) // Check if permission we found is inside a module definition. If not, we discard it. $found=false; - foreach($objMod->rights as $key => $val) + foreach($modules[$obj->module]->rights as $key => $val) { $rights_class=$objMod->rights_class; if ($val[4] == $obj->perms && (empty($val[5]) || $val[5] == $obj->subperms)) @@ -190,12 +190,13 @@ if ($result) $i++; continue; } - + // Break found, it's a new module to catch - if ($old <> $obj->module) + if ($oldmod <> $obj->module) { - $objMod=$modules[$obj->module]; - $picto=($objMod->picto?$objMod->picto:'generic'); + $oldmod = $obj->module; + $objMod = $modules[$obj->module]; + $picto = ($objMod->picto?$objMod->picto:'generic'); print '