Fix auto increment customer code must be done only if error is on
duplicate code
This commit is contained in:
parent
63f614d1d5
commit
27caa586c2
@ -503,10 +503,9 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
|
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name); // duplicate on a field (code or profid or ...)
|
||||||
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->name);
|
|
||||||
$result=-1;
|
$result=-1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -514,8 +514,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so
|
||||||
if($result == -3) {
|
{
|
||||||
$duplicate_code_error = true;
|
$duplicate_code_error = true;
|
||||||
$object->code_fournisseur = null;
|
$object->code_fournisseur = null;
|
||||||
$object->code_client = null;
|
$object->code_client = null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user