From 70f1a9d13d63d7e6392fd1392d5a718a6557c6d5 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 15 Feb 2019 11:26:29 +0100 Subject: [PATCH] FIX : we want to be able to reopen fourn credit note --- htdocs/fourn/facture/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bbec3ea6ed6..c6f6d560f34 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3014,8 +3014,13 @@ else print '
'.$langs->trans('Modify').'
'; } + $discount = new DiscountAbsolute($db); + $result = $discount->fetch(0, 0, $object->id); + // Reopen a standard paid invoice - if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT + || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && empty($discount->id))) + && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) { if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer) // Not replaced by another invoice {