From a359c7a681dfa27c3d57969ea02cdabd13e4b259 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Wed, 3 Nov 2021 14:22:08 +0100 Subject: [PATCH 1/3] Handle case where credit note has no source invoice --- htdocs/fourn/facture/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) mode change 100644 => 100755 htdocs/fourn/facture/card.php diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php old mode 100644 new mode 100755 index ee1f768b60b..5de5942a542 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2721,8 +2721,12 @@ if ($action == 'create') { } if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { $facusing = new FactureFournisseur($db); - $facusing->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; + if ($object->fk_facture_source > 0) { + $facusing->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; + } else { + print ' ('.$langs->transnoentities("NoInvoiceToCorrect").')'; + } } $facidavoir = $object->getListIdAvoirFromInvoice(); From 02200b98103803826a1b6737bd6bc355ce77b8e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Nov 2021 13:10:44 +0100 Subject: [PATCH 2/3] Update card.php --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 5de5942a542..c986bdd56db 100755 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2725,7 +2725,7 @@ if ($action == 'create') { $facusing->fetch($object->fk_facture_source); print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; } else { - print ' ('.$langs->transnoentities("NoInvoiceToCorrect").')'; + print ' ('.$langs->transnoentities("CorrectInvoiceNotFound").')'; } } From bc7b035846a33b21000614751b33c413408bd646 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Nov 2021 13:11:54 +0100 Subject: [PATCH 3/3] Update card.php --- htdocs/fourn/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c986bdd56db..da8672c9518 100755 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1,4 +1,4 @@ - * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles @@ -2725,7 +2725,7 @@ if ($action == 'create') { $facusing->fetch($object->fk_facture_source); print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')'; } else { - print ' ('.$langs->transnoentities("CorrectInvoiceNotFound").')'; + print ' ('.$langs->transnoentities("CorrectedInvoiceNotFound").')'; } }