Fix: Ne plante plus sur les permissions si un module a été effacé sans avoir été désactivé.
This commit is contained in:
parent
e9a8c4b189
commit
914e32fc57
@ -98,54 +98,61 @@ $sql.=" ORDER BY r.id, r.module";
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=True;
|
$var=True;
|
||||||
$old = "";
|
$old = "";
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$var=!$var;
|
|
||||||
|
|
||||||
if ($old <> $obj->module)
|
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||||
{
|
if (! $modules[$obj->module])
|
||||||
// Rupture détectée, on récupère objMod
|
{
|
||||||
$objMod=$modules[$obj->module];
|
$i++;
|
||||||
$picto=($objMod->picto?$objMod->picto:'generic');
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
if ($old <> $obj->module)
|
||||||
print '<td>'.$langs->trans("Module").'</td>';
|
{
|
||||||
print '<td>'.$langs->trans("Permission").'</td>';
|
// Rupture détectée, on récupère objMod
|
||||||
print '<td align="center">'.$langs->trans("Default").'</td>';
|
$objMod=$modules[$obj->module];
|
||||||
print '<td align="center"> </td>';
|
$picto=($objMod->picto?$objMod->picto:'generic');
|
||||||
print "</tr>\n";
|
|
||||||
$old = $obj->module;
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr '. $bc[$var].'>';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Module").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Permission").'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans("Default").'</td>';
|
||||||
|
print '<td align="center"> </td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
$old = $obj->module;
|
||||||
|
}
|
||||||
|
|
||||||
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
$var=!$var;
|
||||||
|
print '<tr '. $bc[$var].'>';
|
||||||
|
|
||||||
$perm_libelle=(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle);
|
print '<td>'.img_object('',$picto).' '.$objMod->getName();
|
||||||
print '<td>'.$perm_libelle. '</td>';
|
|
||||||
|
|
||||||
print '<td align="center">';
|
$perm_libelle=(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle);
|
||||||
if ($obj->bydefault == 1)
|
print '<td>'.$perm_libelle. '</td>';
|
||||||
{
|
|
||||||
|
|
||||||
print img_tick();
|
print '<td align="center">';
|
||||||
print '</td><td>';
|
if ($obj->bydefault == 1)
|
||||||
print '<a href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
{
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print ' ';
|
|
||||||
print '</td><td>';
|
|
||||||
print '<a href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr>';
|
print img_tick();
|
||||||
$i++;
|
print '</td><td>';
|
||||||
|
print '<a href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
print '</td><td>';
|
||||||
|
print '<a href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -171,6 +171,14 @@ if ($_GET["id"])
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
|
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||||
|
if (! $modules[$obj->module])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($oldmod <> $obj->module)
|
if ($oldmod <> $obj->module)
|
||||||
{
|
{
|
||||||
$oldmod = $obj->module;
|
$oldmod = $obj->module;
|
||||||
|
|||||||
@ -211,6 +211,14 @@ if ($_GET["id"])
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
|
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||||
|
if (! $modules[$obj->module])
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($oldmod <> $obj->module)
|
if ($oldmod <> $obj->module)
|
||||||
{
|
{
|
||||||
$oldmod = $obj->module;
|
$oldmod = $obj->module;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user