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
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if($ret < 0)
|
||||||
|
$error++;
|
||||||
|
|
||||||
// Replacement invoice
|
// Replacement invoice
|
||||||
if ($_POST['type'] == 1)
|
if ($_POST['type'] == 1)
|
||||||
@ -1858,24 +1859,28 @@ if ($action == 'update_extras')
|
|||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if($ret < 0)
|
||||||
|
$error++;
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
if(!$error) {
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
// Actions on extra fields (by external module or standard code)
|
||||||
$hookmanager->initHooks(array('invoicedao'));
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$parameters=array('id'=>$object->id);
|
$hookmanager->initHooks(array('invoicedao'));
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$parameters=array('id'=>$object->id);
|
||||||
if (empty($reshook))
|
$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
|
|
||||||
{
|
{
|
||||||
$result=$object->insertExtraFields();
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$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