From 0ce1e5c007d84e8931359c54ee8864a387cdba20 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 3 Dec 2019 19:39:32 +0100 Subject: [PATCH 1/3] Fix : Fatal error: Uncaught Error: Class Facture not found --- htdocs/core/lib/pdf.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fea8e204aeb..c2705fdc556 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1231,7 +1231,8 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0) { global $db, $conf, $langs; - + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '')); From 24b5b9bd7295211cfe1130e8c2da997a8f4ce4ac Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 3 Dec 2019 18:42:29 +0000 Subject: [PATCH 2/3] Fixing style errors. --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c2705fdc556..edaac53a167 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1232,7 +1232,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, { global $db, $conf, $langs; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - + $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '')); From 22b17190e8896b309f2d3774121bcae99ecd0a53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Dec 2019 22:26:33 +0100 Subject: [PATCH 3/3] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index edaac53a167..0749d0a7645 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1231,7 +1231,6 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0) { global $db, $conf, $langs; - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); @@ -1283,8 +1282,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; } } - elseif ($object->type == Facture::TYPE_DEPOSIT && $object->element == 'facture') { - $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + elseif ($object->element == 'facture' || $object->element == 'facturefourn') { + if ($object->type == $object::TYPE_DEPOSIT) { + $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); + } } // Description short of product line