Skip to content

Commit

Permalink
Merge branch '3.9' of https://github.com/Dolibarr/dolibarr into 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-maxime committed Jun 15, 2016
2 parents f51386c + 4c922f0 commit af5a75c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
27 changes: 14 additions & 13 deletions htdocs/compta/facture.php
Expand Up @@ -392,21 +392,22 @@

// 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);
Expand Down
23 changes: 13 additions & 10 deletions htdocs/societe/soc.php
Expand Up @@ -396,7 +396,7 @@
// 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]);
Expand All @@ -411,15 +411,18 @@
}
}

$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');
}
}
}
}
}
Expand Down

0 comments on commit af5a75c

Please sign in to comment.