Fix: Si pas de droits en modif sur produits, alors pas moyen de supprimer une affectation de catégorie

This commit is contained in:
Laurent Destailleur 2006-07-30 13:01:31 +00:00
parent b064e4c272
commit bf0db736ac

View File

@ -62,22 +62,19 @@ $html = new Form($db);
if ($_GET["id"] || $_GET["ref"]) if ($_GET["id"] || $_GET["ref"])
{ {
//on veut supprimer une catégorie //on veut supprimer une catégorie
if ($_REQUEST["cat"]) if ($_REQUEST["removecat"] && $user->rights->produit->creer)
{ {
$cat = new Categorie($db,$_REQUEST["cat"]); $cat = new Categorie($db,$_REQUEST["removecat"]);
$cat->del_product($product); $cat->del_product($product);
} }
//on veut ajouter une catégorie //on veut ajouter une catégorie
if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0) if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0 && $user->rights->produit->creer)
{ {
$cat = new Categorie($db,$_REQUEST["catMere"]); $cat = new Categorie($db,$_REQUEST["catMere"]);
$cat->add_product($product); $cat->add_product($product);
} }
if ( $result )
{
/* /*
* En mode visu * En mode visu
*/ */
@ -250,8 +247,26 @@ if ($_GET["id"] || $_GET["ref"])
foreach ($ways as $way) foreach ($ways as $way)
{ {
$var = ! $var; $var = ! $var;
print "<tr ".$bc[$var]."><td>".$way."</td>"; print "<tr ".$bc[$var].">";
print '<td align="right">'.img_delete($langs->trans("DeleteFromCat"))." <a href= '".DOL_URL_ROOT."/product/categorie.php?id=".$product->id."&amp;cat=".$cat->id."'>".$langs->trans("DeleteFromCat")."</a></td></tr>\n";
// Categorie
print "<td>".$way."</td>";
// Lien supprimer
print '<td align="right">';
if ($user->rights->produit->creer)
{
print "<a href= '".DOL_URL_ROOT."/product/categorie.php?id=".$product->id."&amp;removecat=".$cat->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' ';
print $langs->trans("DeleteFromCat")."</a>";
}
else
{
print '&nbsp;';
}
print "</td>";
print "</tr>\n";
} }
@ -268,8 +283,6 @@ if ($_GET["id"] || $_GET["ref"])
print $langs->trans("ProductHasNoCategory")."<br/>"; print $langs->trans("ProductHasNoCategory")."<br/>";
} }
}
} }
$db->close(); $db->close();