bugfix
This commit is contained in:
parent
737107b588
commit
6d581771ff
@ -258,11 +258,16 @@ class Product
|
|||||||
$sql = "SELECT COUNT(*)";
|
$sql = "SELECT COUNT(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as p, ".MAIN_DB_PREFIX."commandedet as c";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as p, ".MAIN_DB_PREFIX."commandedet as c";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as f, ".MAIN_DB_PREFIX."contratdet as ct";
|
$sql.= ", ".MAIN_DB_PREFIX."facturedet as f, ".MAIN_DB_PREFIX."contratdet as ct";
|
||||||
$sql.= " WHERE p.fk_product = ".$id." AND c.fk_product = ".$id." AND f.fk_product = ".$id." AND ct.fkproduct = ".$id;
|
$sql.= " WHERE p.fk_product = ".$id." OR c.fk_product = ".$id." OR f.fk_product = ".$id." OR ct.fk_product = ".$id;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql == 0)
|
if ($resql)
|
||||||
{
|
{
|
||||||
return 0;
|
$row = $this->db->fetch_row($resql);
|
||||||
|
$nbuse = $row[0];
|
||||||
|
}
|
||||||
|
if ($nbuse == 0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -270,6 +275,7 @@ class Product
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Suppression du produit en base si pas utilisé
|
* \brief Suppression du produit en base si pas utilisé
|
||||||
* \param id id du produit
|
* \param id id du produit
|
||||||
|
|||||||
@ -745,8 +745,7 @@ if ($_GET["action"] == '')
|
|||||||
print '<a class="tabAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("CreateCopy").'</a>';
|
print '<a class="tabAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("CreateCopy").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$product = new Product($db);
|
$prod_use = $product->verif_prod_use($product->id);
|
||||||
$prod_use = $product->verif_prod_use($id);
|
|
||||||
|
|
||||||
if ($user->rights->produit->supprimer && $prod_use == 0)
|
if ($user->rights->produit->supprimer && $prod_use == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user