Add $array_to_check for property in invoice instead of thirdparty

This commit is contained in:
Laurent Destailleur 2019-05-20 13:02:33 +02:00
parent 91dd8a71d3
commit 83c369cc0f

View File

@ -477,7 +477,7 @@ if (empty($reshook))
// Check parameters
// Check for mandatory fields defined into setup
// Check for mandatory fields in thirdparty (defined into setup)
$array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL');
foreach($array_to_check as $key)
{
@ -518,6 +518,23 @@ if (empty($reshook))
}
}
// Check for mandatory fields in invoice
$array_to_check=array('REF_CUSTOMER'=>'RefCustomer');
foreach($array_to_check as $key => $val)
{
$keymin=strtolower($key);
$vallabel=$object->$keymin;
// Check for mandatory
$keymandatory ='INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION';
if (! $vallabel && ! empty($conf->global->$keymandatory))
{
$langs->load("errors");
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
}
}
// Check for warehouse
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
{