Fix: use bad object

This commit is contained in:
Regis Houssin 2011-10-22 19:26:25 +08:00
parent 5a20fa8169
commit 9924b2f17d

View File

@ -147,7 +147,6 @@ foreach ($modulesdir as $dir)
$db->commit(); $db->commit();
// Affiche lignes des permissions // Affiche lignes des permissions
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
@ -159,10 +158,11 @@ $sql.= " ORDER BY r.module, r.id";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$var=True; $var = True;
$old = ""; $oldmod = "";
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $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. // Check if permission we found is inside a module definition. If not, we discard it.
$found=false; $found=false;
foreach($objMod->rights as $key => $val) foreach($modules[$obj->module]->rights as $key => $val)
{ {
$rights_class=$objMod->rights_class; $rights_class=$objMod->rights_class;
if ($val[4] == $obj->perms && (empty($val[5]) || $val[5] == $obj->subperms)) if ($val[4] == $obj->perms && (empty($val[5]) || $val[5] == $obj->subperms))
@ -190,12 +190,13 @@ if ($result)
$i++; $i++;
continue; continue;
} }
// Break found, it's a new module to catch // Break found, it's a new module to catch
if ($old <> $obj->module) if ($oldmod <> $obj->module)
{ {
$objMod=$modules[$obj->module]; $oldmod = $obj->module;
$picto=($objMod->picto?$objMod->picto:'generic'); $objMod = $modules[$obj->module];
$picto = ($objMod->picto?$objMod->picto:'generic');
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
@ -203,7 +204,6 @@ if ($result)
print '<td align="center">'.$langs->trans("Default").'</td>'; print '<td align="center">'.$langs->trans("Default").'</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$old = $obj->module;
} }
$var=!$var; $var=!$var;