diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5358fa5af52..92f2c55aa73 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2619,7 +2619,9 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs); $action = ''; $reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook>0) { + if (empty($reshook)) { + $linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys + } elseif ($reshook>0) { // The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook. $linkedobjects = $hookmanager->resArray; }