From c471f6b90072bbcf95dfaccfada7f43cab789dcb Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 19 Mar 2025 16:04:50 +0100 Subject: [PATCH] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/document.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/document.php b/htdocs/document.php index 4459fede63e..b1fd01ab77e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -213,14 +213,14 @@ if (!empty($hashp)) { $original_file = (($tmp[1] ? $tmp[1] . '/' : '') . $ecmfile->filename); // this is relative to module dir } - $entity = $ecmfile->entity; - if (isModEnabled('multicompany') && !empty($ecmfile->src_object_type) && $ecmfile->src_object_id > 0) { - $object = fetchObjectByElement($ecmfile->src_object_id, $ecmfile->src_object_type); - if (is_object($object) && $object->id > 0) { - $entity = $object->entity; - } - } - + $entity = $ecmfile->entity; + if (isModEnabled('multicompany') && !empty($ecmfile->src_object_type) && $ecmfile->src_object_id > 0) { + $object = fetchObjectByElement($ecmfile->src_object_id, $ecmfile->src_object_type); + if (is_object($object) && $object->id > 0) { + $entity = $object->entity; + } + } + if ($entity != $conf->entity) { $conf->entity = $entity; $conf->setValues($db);