This commit is contained in:
Maxime Kohlhaas 2016-06-15 18:25:45 +02:00
commit af5a75c39b
2 changed files with 27 additions and 23 deletions

View File

@ -392,21 +392,22 @@ if (empty($reshook))
// Check parameters
// Check for mandatory prof id
for($i = 1; $i < 6; $i ++)
// Check for mandatory prof id (but only if country is than than ours)
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id)
{
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
$idprof = 'idprof' . $i;
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
{
if (! $error)
$langs->load("errors");
$error ++;
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
}
for ($i = 1; $i <= 6; $i++)
{
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
$idprof = 'idprof' . $i;
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
{
if (! $error) $langs->load("errors");
$error++;
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
}
}
}
$qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2);

View File

@ -396,7 +396,7 @@ if (empty($reshook))
// Only for companies
if (!($object->particulier || $private))
{
for ($i = 1; $i < 5; $i++)
for ($i = 1; $i <= 6; $i++)
{
$slabel="idprof".$i;
$_POST[$slabel]=trim($_POST[$slabel]);
@ -411,15 +411,18 @@ if (empty($reshook))
}
}
$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');
}
// Check for mandatory prof id (but only if country is than than ours)
if ($mysoc->country_id > 0 && $object->country_id == $mysoc->country_id)
{
$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');
}
}
}
}
}