Vérif si le fournisseur a ajouter n'est pas deja referencé
This commit is contained in:
parent
9d1b6ece7b
commit
fe78884f9b
@ -375,6 +375,14 @@ class Product
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Function add_fournisseur($user, $id_fourn, $ref_fourn)
|
Function add_fournisseur($user, $id_fourn, $ref_fourn)
|
||||||
|
{
|
||||||
|
$sql = "SELECT count(*) FROM llx_product_fournisseur WHERE fk_product = $this->id AND fk_soc = $id_fourn";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$row = $this->db->fetch_row(0);
|
||||||
|
$this->db->free();
|
||||||
|
if ($row[0] == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "INSERT INTO llx_product_fournisseur ";
|
$sql = "INSERT INTO llx_product_fournisseur ";
|
||||||
@ -391,6 +399,17 @@ class Product
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $this->db->error() . ' in ' . $sql;
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user