From 7a93c11ae0e2473918397646bdccbe09ab7256cd Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 15 Dec 2020 22:01:33 +0100 Subject: [PATCH] FIX : dupliacete customer or supplier code must be error dipslayed with new code proposed --- htdocs/societe/card.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b8af6777daa..56793184f65 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -634,11 +634,16 @@ if (empty($reshook)) } else { - if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS' || ($result==-3 && in_array('ErrorCustomerCodeAlreadyUsed', $object->errors))) // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case + { + $duplicate_code_error = true; + $object->code_client = null; + } + + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS' || ($result==-3 && in_array('ErrorSupplierCodeAlreadyUsed',$object->errors))) // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case { $duplicate_code_error = true; $object->code_fournisseur = null; - $object->code_client = null; } setEventMessages($object->error, $object->errors, 'errors');