Merge pull request #2351 from mrsof/develop
FIX : Let ability to use IDPROF verifications even if new entry is "priv...
This commit is contained in:
commit
e7a82c89e6
@ -242,30 +242,34 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for duplicate or mandatory prof id
|
// Check for duplicate or mandatory prof id
|
||||||
for ($i = 1; $i < 5; $i++)
|
// Only for companies
|
||||||
|
if (!($object->particulier || $private))
|
||||||
{
|
{
|
||||||
$slabel="idprof".$i;
|
for ($i = 1; $i < 5; $i++)
|
||||||
$_POST[$slabel]=trim($_POST[$slabel]);
|
{
|
||||||
$vallabel=$_POST[$slabel];
|
$slabel="idprof".$i;
|
||||||
if ($vallabel && $object->id_prof_verifiable($i))
|
$_POST[$slabel]=trim($_POST[$slabel]);
|
||||||
{
|
$vallabel=$_POST[$slabel];
|
||||||
if($object->id_prof_exists($i,$vallabel,$object->id))
|
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");
|
$langs->load("errors");
|
||||||
$error++; $errors[] = $langs->transcountry('ProfId'.$i, $object->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel);
|
$error++;
|
||||||
$action = (($action=='add'||$action=='create')?'create':'edit');
|
$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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user