Skip to content
Snippets Groups Projects
Commit fa73dbe8 authored by Alexis Algoud's avatar Alexis Algoud
Browse files

FIX #5128 if create method return duplicated code error

not use GETPOST in order to get a new code
parent b6700c70
No related branches found
No related tags found
No related merge requests found
...@@ -432,3 +432,4 @@ MergeThirdparties=Merge third parties ...@@ -432,3 +432,4 @@ MergeThirdparties=Merge third parties
ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one. ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one.
ThirdpartiesMergeSuccess=Thirdparties have been merged ThirdpartiesMergeSuccess=Thirdparties have been merged
ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted. ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted.
NewCustomerSupplierCodeProposed=New customer or supplier proposed on duplicate code
...@@ -505,6 +505,13 @@ if (empty($reshook)) ...@@ -505,6 +505,13 @@ if (empty($reshook))
} }
else else
{ {
if($result == -3) {
$duplicate_code_error = true;
$object->code_fournisseur = null;
$object->code_client = null;
}
$error=$object->error; $errors=$object->errors; $error=$object->error; $errors=$object->errors;
} }
...@@ -794,8 +801,14 @@ else ...@@ -794,8 +801,14 @@ else
$object->particulier = $private; $object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm'); $object->prefix_comm = GETPOST('prefix_comm');
$object->client = GETPOST('client')?GETPOST('client'):$object->client; $object->client = GETPOST('client')?GETPOST('client'):$object->client;
if(empty($duplicate_code_error)) {
$object->code_client = GETPOST('code_client', 'alpha'); $object->code_client = GETPOST('code_client', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur;
} else {
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings');
}
$object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha');
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment