From 7a93c11ae0e2473918397646bdccbe09ab7256cd Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 15 Dec 2020 22:01:33 +0100 Subject: [PATCH 1/3] 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'); From b80bd8d1f8af4ced9e3c978ed41f5dbc605169b0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 15 Dec 2020 22:03:15 +0100 Subject: [PATCH 2/3] FIX : dupliacete customer or supplier code must be error dipslayed with new code proposed --- htdocs/societe/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 56793184f65..93e0196f1ae 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -634,18 +634,22 @@ if (empty($reshook)) } else { - 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 + if ($result==-3 && in_array('ErrorCustomerCodeAlreadyUsed', $object->errors)) { $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 + if ($result==-3 && in_array('ErrorSupplierCodeAlreadyUsed',$object->errors)) { $duplicate_code_error = true; $object->code_fournisseur = null; } + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $duplicate_code_error = true; + } + setEventMessages($object->error, $object->errors, 'errors'); $error++; } From 9ca2e98a662a16bf57fb51f62729c1e6e4bca443 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 15 Dec 2020 21:12:52 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 93e0196f1ae..d79a5c1a9e0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -640,7 +640,7 @@ if (empty($reshook)) $object->code_client = null; } - if ($result==-3 && in_array('ErrorSupplierCodeAlreadyUsed',$object->errors)) + if ($result==-3 && in_array('ErrorSupplierCodeAlreadyUsed', $object->errors)) { $duplicate_code_error = true; $object->code_fournisseur = null;