Handle case where credit note has no source invoice

This commit is contained in:
Vincent Dieltiens 2021-11-03 14:22:08 +01:00
parent 960319fd8a
commit a359c7a681

8
htdocs/fourn/facture/card.php Normal file → Executable file
View File

@ -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();