diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9b2d39c448759860cd442c159ab9c98fcb1a1278..6535cee7c98f54a35fb2f86152f970c55114f91a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -163,7 +163,7 @@ if (empty($reshook)) // Change status of invoice else if ($action == 'reopen' && $user->rights->facture->creer) { $result = $object->fetch($id); - if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced')) { + if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted $result = $object->set_unpaid($user); if ($result > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); @@ -3905,8 +3905,8 @@ else if ($id > 0 || ! empty($ref)) if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) || ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id)) || ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))) - && ($object->statut == 2 || $object->statut == 3) - && $user->rights->facture->creer) // A paid invoice (partially or completely) + && ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data + && $user->rights->facture->creer) // A paid invoice (partially or completely) { if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice {