Skip to content
Snippets Groups Projects
Commit fe48342a authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Check for duplicate must ignore spaces before and after

parent 2ffa7366
No related branches found
No related tags found
No related merge requests found
...@@ -198,15 +198,18 @@ if (empty($reshook)) ...@@ -198,15 +198,18 @@ if (empty($reshook))
$action = ($action=='add'?'create':'edit'); $action = ($action=='add'?'create':'edit');
} }
// Check for duplicate prof id
for ($i = 1; $i < 3; $i++) for ($i = 1; $i < 3; $i++)
{ {
$slabel="idprof".$i; $slabel="idprof".$i;
if (($_POST[$slabel] && $object->id_prof_verifiable($i))) $_POST[$slabel]=trim($_POST[$slabel]);
$vallabel=$_POST[$slabel];
if ($vallabel && $object->id_prof_verifiable($i))
{ {
if($object->id_prof_exists($i,$_POST["$slabel"],$object->id)) if($object->id_prof_exists($i,$vallabel,$object->id))
{ {
$langs->load("errors"); $langs->load("errors");
$error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $_POST[$slabel]); $error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel);
$action = ($action=='add'?'create':'edit'); $action = ($action=='add'?'create':'edit');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment