From 1e78c4c4182906599b464360aa40517d8324b776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Jan 2017 14:54:06 +0100 Subject: [PATCH] FIX Change the customer code only if error on duplicate --- htdocs/societe/soc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index f3f87ba6f79..d3c8240417f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -509,8 +509,8 @@ if (empty($reshook)) } else { - - if($result == -3) { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so + { $duplicate_code_error = true; $object->code_fournisseur = null; $object->code_client = null;