Do not create invoice if required extrafields are empty
This commit is contained in:
parent
c431fc716f
commit
371b40cc76
@ -659,7 +659,8 @@ else if ($action == 'add' && $user->rights->facture->creer)
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
if($ret < 0)
|
||||
$error++;
|
||||
|
||||
// Replacement invoice
|
||||
if ($_POST['type'] == 1)
|
||||
@ -1858,24 +1859,28 @@ if ($action == 'update_extras')
|
||||
// Fill array 'array_options' with data from add form
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
if($ret < 0)
|
||||
$error++;
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('invoicedao'));
|
||||
$parameters=array('id'=>$object->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
if(!$error) {
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// FIXME le hook fait double emploi avec le trigger !!
|
||||
$hookmanager->initHooks(array('invoicedao'));
|
||||
$parameters=array('id'=>$object->id);
|
||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
$result=$object->insertExtraFields();
|
||||
if ($result < 0)
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$error++;
|
||||
$result=$object->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
}
|
||||
else if ($reshook < 0) $error++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user