FIX Option MAIN_FORCE_STATE_INTO_ADDRESS and SOCIETE_DISABLE_STATE
This commit is contained in:
parent
54a4570b5f
commit
355f091246
@ -447,7 +447,7 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
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;
|
$contactid=0;
|
||||||
$thirdpartyid=0;
|
$thirdpartyid=0;
|
||||||
@ -484,10 +484,10 @@ abstract class CommonObject
|
|||||||
$outdone++;
|
$outdone++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
|
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)
|
&& empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
|
||||||
{
|
{
|
||||||
$out.=($outdone?'<br>':'').$this->state;
|
$out.=($outdone?' - ':'').$this->state;
|
||||||
$outdone++;
|
$outdone++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1001,7 +1001,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
|
|||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$ret='';
|
$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
|
// Address
|
||||||
$ret .= $object->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
|
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;
|
$ret .= ($ret ? $sep : '' ).$object->town;
|
||||||
if ($object->state && in_array($object->country_code,$countriesusingstate))
|
if ($object->state)
|
||||||
{
|
{
|
||||||
$ret.=", ".$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
|
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;
|
$ret .= ($ret ? $sep : '' ).$object->town;
|
||||||
if ($object->state && in_array($object->country_code,$countriesusingstate))
|
if ($object->state)
|
||||||
{
|
{
|
||||||
$ret.=", ".$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 .= ($ret ? $sep : '' ).$object->zip;
|
||||||
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
|
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
|
||||||
if ($object->state && in_array($object->country_code,$countriesusingstate))
|
if ($object->state)
|
||||||
{
|
{
|
||||||
$ret.="\n".$object->state;
|
$ret.="\n".$object->state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else // Other: title firstname name \n address lines \n zip town \n country
|
else // Other: title firstname name \n address lines \n zip town \n country
|
||||||
{
|
{
|
||||||
$ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';
|
$ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user