diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ee200fa1679..77f4cc09b77 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -75,16 +75,21 @@ if (!function_exists('utf8_decode')) { * Return multidir output for an Dolibarr object * * @param CommonObject $object Dolibarr common object + * @param string $module override object element, by example mycompany instead societe * @since Dolibarr V18 * @return string|void */ -function getMultidirOutput($object) +function getMultidirOutput($object, $module = '') { global $conf; if (!is_object($object)) { return; } - $module = $object->element; + if (empty($module) && !empty($object->element)) { + $module = $object->element; + } else { + return; + } return $conf->$module->multidir_output[$object->entity]; } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index c035b190693..cb460cff14a 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1447,7 +1447,7 @@ class pdf_eratosthene extends ModelePDFCommandes protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "PdfOrderTitle") { // phpcs:enable - global $conf, $langs, $hookmanager; + global $conf, $langs, $hookmanager, $mysoc; $ltrdirection = 'L'; if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R'; @@ -1473,8 +1473,8 @@ class pdf_eratosthene extends ModelePDFCommandes if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) { if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (!empty($conf->mycompany->multidir_output[$object->entity])) { - $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty(getMultidirOutput($mysoc, 'mycompany'))) { + $logodir = getMultidirOutput($mysoc, 'mycompany'); } if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1912bd74521..a56fad2c086 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4358,7 +4358,9 @@ class Societe extends CommonObject global $langs; $this->id = 0; + $this->entity = $conf->entity; $this->name = getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); + $this->nom = $this->name; // deprecated $this->address = getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'); $this->zip = getDolGlobalString('MAIN_INFO_SOCIETE_ZIP'); $this->town = getDolGlobalString('MAIN_INFO_SOCIETE_TOWN'); @@ -4368,8 +4370,6 @@ class Societe extends CommonObject $this->note_private = getDolGlobalString('MAIN_INFO_SOCIETE_NOTE'); - $this->nom = $this->name; // deprecated - // We define country_id, country_code and country $country_id = $country_code = $country_label = ''; if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {