Fixed: Avoid space into address string

This commit is contained in:
Laurent Destailleur 2015-01-14 19:17:58 +01:00
parent 4c64b8ceae
commit 68441a563a

View File

@ -800,7 +800,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country else if (in_array($object->country_code,array('ES','TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country
{ {
$ret .= ($ret ? $sep : '' ).$object->zip; $ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ' '.$object->town; $ret .= ($object->town?' '.$object->town:'');
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state && in_array($object->country_code,$countriesusingstate))
{ {
$ret.="\n".$object->state; $ret.="\n".$object->state;
@ -810,14 +810,14 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
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 .= ($ret ? $sep : '' ).$object->zip; $ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ' '.$object->town; $ret .= ($object->town?' '.$object->town:'');
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state && in_array($object->country_code,$countriesusingstate))
{ {
$ret.=", ".$object->state; $ret.=", ".$object->state;
} }
} }
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):''); if ($withcountry) $ret.=($object->country_code?($ret?$sep:'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
return $ret; return $ret;
} }