Skip to content
Snippets Groups Projects
Commit 09013c7e authored by Sof's avatar Sof
Browse files

FIX : Let ability to use IDPROF verifications even if new entry is "private"

We do not check for duplicate or empty id_prof fields while inserting a new entry when verifications options are set to "ON" in the third party configuration panel.
parent 122a7c19
No related branches found
No related tags found
No related merge requests found
......@@ -242,30 +242,34 @@ if (empty($reshook))
}
// Check for duplicate or mandatory prof id
for ($i = 1; $i < 5; $i++)
// Only for companies
if (!($object->particulier || $private))
{
$slabel="idprof".$i;
$_POST[$slabel]=trim($_POST[$slabel]);
$vallabel=$_POST[$slabel];
if ($vallabel && $object->id_prof_verifiable($i))
{
if($object->id_prof_exists($i,$vallabel,$object->id))
for ($i = 1; $i < 5; $i++)
{
$slabel="idprof".$i;
$_POST[$slabel]=trim($_POST[$slabel]);
$vallabel=$_POST[$slabel];
if ($vallabel && $object->id_prof_verifiable($i))
{
if($object->id_prof_exists($i,$vallabel,$object->id))
{
$langs->load("errors");
$error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel);
$action = (($action=='add'||$action=='create')?'create':'edit');
}
}
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
{
$langs->load("errors");
$error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel);
$action = (($action=='add'||$action=='create')?'create':'edit');
$error++;
$errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code));
$action = (($action=='add'||$action=='create')?'create':'edit');
}
}
$idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY';
if (! $vallabel && ! empty($conf->global->$idprof_mandatory))
{
$langs->load("errors");
$error++;
$errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code));
$action = (($action=='add'||$action=='create')?'create':'edit');
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment