Fix add option INVOICE_DISALLOW_REOPEN to lock problematic feature

This commit is contained in:
Laurent Destailleur 2021-04-24 18:43:24 +02:00
parent 28f0c6c7cf
commit 48c26fd614

View File

@ -189,7 +189,7 @@ if (empty($reshook))
$action = '';
}
} // Change status of invoice
elseif ($action == 'reopen' && $usercancreate) {
elseif ($action == 'reopen' && $usercancreate && empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
$result = $object->fetch($id);
if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted