Do not create invoice if required extrafields are empty

This commit is contained in:
jfefe 2013-07-26 13:22:22 +02:00
parent c431fc716f
commit 371b40cc76

View File

@ -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,7 +1859,10 @@ 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++;
if(!$error) {
// Actions on extra fields (by external module or standard code) // Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !! // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('invoicedao')); $hookmanager->initHooks(array('invoicedao'));
@ -1876,6 +1880,7 @@ if ($action == 'update_extras')
} }
} }
else if ($reshook < 0) $error++; else if ($reshook < 0) $error++;
}
} }