debug sousproduits

This commit is contained in:
Andre Cianfarani 2006-03-22 06:24:21 +00:00
parent 1249e684f4
commit 6fda3ac741

View File

@ -1108,6 +1108,26 @@ class Product
return -1; return -1;
} }
else else
{
$sql = 'select fk_product_pere from '.MAIN_DB_PREFIX.'product_association';
$sql .= ' WHERE fk_product_pere = "'.$id_fils.'" and fk_product_fils = "'.$id_pere.'"';
if (! $this->db->query($sql))
{
dolibarr_print_error($this->db);
return -1;
}
else
{
$result = $this->db->query($sql) ;
if ($result)
{
$num = $this->db->num_rows($result);
if($num > 0)
{
$this->error="isFatherOfThis";
return -1;
}
else
{ {
$sql = 'insert into '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty)'; $sql = 'insert into '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty)';
$sql .= ' VALUES ("'.$id_pere.'","'.$id_fils.'","'.$qty.'")'; $sql .= ' VALUES ("'.$id_pere.'","'.$id_fils.'","'.$qty.'")';
@ -1122,6 +1142,10 @@ class Product
} }
} }
} }
}
}
}
/** /**
* \brief retire le lien entre un sousproduit et un produit/service * \brief retire le lien entre un sousproduit et un produit/service
* \param id_pere Id du produit auquel ne sera plus lié le produit lié * \param id_pere Id du produit auquel ne sera plus lié le produit lié