Gestion de la référence vide interdite
This commit is contained in:
parent
7e03483539
commit
935b717c66
@ -69,7 +69,10 @@ class Product
|
|||||||
var $multilangs=array();
|
var $multilangs=array();
|
||||||
|
|
||||||
var $typeprodserv;
|
var $typeprodserv;
|
||||||
|
//! Intitule de l'erreur
|
||||||
var $error;
|
var $error;
|
||||||
|
//! Numero de l'erreur
|
||||||
|
var $errno = 0;
|
||||||
//! Canevas a utiliser si le produit n'est pas un produit generique
|
//! Canevas a utiliser si le produit n'est pas un produit generique
|
||||||
var $canvas;
|
var $canvas;
|
||||||
//! Nombre de piece en commande, non expedie
|
//! Nombre de piece en commande, non expedie
|
||||||
@ -148,6 +151,8 @@ class Product
|
|||||||
|
|
||||||
dolibarr_syslog("Product::Create ref=".$this->ref." Categorie : ".$this->catid);
|
dolibarr_syslog("Product::Create ref=".$this->ref." Categorie : ".$this->catid);
|
||||||
|
|
||||||
|
if (strlen($this->ref) > 0)
|
||||||
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
@ -207,7 +212,8 @@ class Product
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Produit existe deja
|
// Produit existe deja
|
||||||
$this->error=$langs->trans("ErrorProductAlreadyExists");
|
$this->error=$langs->trans("ErrorProductAlreadyExists", $this->ref);
|
||||||
|
$this->errno = 257;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -215,6 +221,14 @@ class Product
|
|||||||
|
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Produit existe deja
|
||||||
|
$this->error=$langs->trans("ErrorProductBadRefOrLabel");
|
||||||
|
$this->errno = 257;
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2401,5 +2415,9 @@ class Product
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assign_smarty_values(&$smarty)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user