diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 278a9cbb626..743b26ecc67 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -447,7 +447,7 @@ abstract class CommonObject { global $conf, $langs; - $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); + $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also option MAIN_FORCE_STATE_INTO_ADDRESS $contactid=0; $thirdpartyid=0; @@ -483,11 +483,11 @@ abstract class CommonObject $out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1); $outdone++; $outdone++; } - - if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS) - && ! empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) + + 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 + && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) { - $out.=($outdone?'
':'').$this->state; + $out.=($outdone?' - ':'').$this->state; $outdone++; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 138a3054333..c9917e5852d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1001,7 +1001,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') global $conf,$langs; $ret=''; - $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); + $countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS // Address $ret .= $object->address; @@ -1009,7 +1009,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') if (in_array($object->country_code,array('US','AU')) || ! empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) // US: title firstname name \n address lines \n town, state, zip \n country { $ret .= ($ret ? $sep : '' ).$object->town; - if ($object->state && in_array($object->country_code,$countriesusingstate)) + if ($object->state) { $ret.=", ".$object->state; } @@ -1018,7 +1018,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') else if (in_array($object->country_code,array('GB','UK'))) // UK: title firstname name \n address lines \n town state \n zip \n country { $ret .= ($ret ? $sep : '' ).$object->town; - if ($object->state && in_array($object->country_code,$countriesusingstate)) + if ($object->state) { $ret.=", ".$object->state; } @@ -1028,12 +1028,11 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='') { $ret .= ($ret ? $sep : '' ).$object->zip; $ret .= ($object->town?(($object->zip?' ':'').$object->town):''); - if ($object->state && in_array($object->country_code,$countriesusingstate)) + if ($object->state) { $ret.="\n".$object->state; } } - else // Other: title firstname name \n address lines \n zip town \n country { $ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';