Fix Wrong error for duplicate ref if barcode enabled but not set.

This commit is contained in:
fappels 2018-06-12 16:38:42 +02:00
parent 31eeaf9914
commit a86c90fed1

View File

@ -1000,7 +1000,7 @@ class Product extends CommonObject
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
$langs->load("errors");
if (empty($conf->barcode->enabled)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref);
if (empty($conf->barcode->enabled) || empty($this->barcode)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref);
else $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists",$this->barcode);
$this->errors[]=$this->error;
$this->db->rollback();