diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 11d0737a98c..97dbdb69aec 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1582,15 +1582,18 @@ abstract class CommonDocGenerator $parameters = array( 'curY' => &$curY, - 'columnText' => $columnText, + 'columnText' => &$columnText, 'colKey' => $colKey, 'pdf' => &$pdf, ); $reshook = $hookmanager->executeHooks('printStdColumnContent', $parameters, $this); // Note that $action and $object may have been modified by hook + if ($reshook > 0 && isset($hookmanager->resArray['columnText'])) { + $columnText = $hookmanager->resArray['columnText']; + } if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (!$reshook) { + if (!$reshook || $reshook > 0) { if (empty($columnText)) { return 0; } diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 67ec7d96e3d..8da7b5c233a 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -648,6 +648,11 @@ class pdf_octopus extends ModelePDFFactures $pagenb = $pageposbeforeprintlines; for ($i = 0; $i < $nblines; $i++) { + $parameters = array('i' => $i, 'object' => $object); // Ajoute 'object' ici + $reshook = $hookmanager->executeHooks('beforePrintPDFline', $parameters, $this, $action); + if ($reshook > 0 && !empty($hookmanager->resArray['object'])) { + $object = $hookmanager->resArray['object']; + } $linePosition = $i + 1; $curY = $nexY;