diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9eb66fa0745..0ac16532246 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -873,8 +873,11 @@ abstract class CommonObject $out .= img_picto($langs->trans("Address"), 'map-marker-alt'); $out .= ' '; } - $out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); - $outdone++; + $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); + if ($address) { + $out .= $address; + $outdone++; + } $outdone++; // List of extra languages @@ -900,6 +903,7 @@ abstract class CommonObject // If there is extra languages foreach ($arrayoflangcode as $extralangcode) { $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright"'); + // This also call dol_format_address() $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode); $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); } @@ -908,7 +912,8 @@ abstract class CommonObject } } - if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress + // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress + if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 && $this->region) { $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state; @@ -918,6 +923,10 @@ abstract class CommonObject $outdone++; } + if ($outdone) { + $out = '