try to use function

This commit is contained in:
Frédéric FRANCE 2023-03-08 21:52:50 +01:00
parent a9b9812b7e
commit 145880bc92
3 changed files with 12 additions and 7 deletions

View File

@ -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];
}

View File

@ -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;

View File

@ -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)) {