Fix: Gestion erreur sur création produit en double
This commit is contained in:
parent
5874fafb34
commit
b0a5267fab
@ -114,6 +114,7 @@ class Product
|
|||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
$this->ref = trim(sanitize_string($this->ref));
|
$this->ref = trim(sanitize_string($this->ref));
|
||||||
|
|
||||||
@ -175,13 +176,15 @@ class Product
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error()." - ".$sql;
|
$this->error=$this->db->error()." - sql=".$sql;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Produit existe deja
|
||||||
|
$this->error=$langs->trans("ErrorProductAlreadyExists");
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user