facture/card.php: avoid validating invoices with date anterior to last invoice date

This commit is contained in:
Thomas Negre
2022-03-01 17:18:29 +01:00
parent eda9622c9c
commit 7c866ce6a2

View File

@@ -302,6 +302,15 @@ if (empty($reshook)) {
// Validation
$object->fetch($id);
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
$last_of_type = $object->willBeLastOfSameType();
if (empty($object->date_validation) && !$last_of_type[0]) {
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref , dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit;
}
}
// On verifie signe facture
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
// Si avoir, le signe doit etre negatif