From 68441a563acee476f1e01b9230432849293bbf71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 14 Jan 2015 19:17:58 +0100 Subject: [PATCH] Fixed: Avoid space into address string --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dcb76a10cd7..3ec602c9d2b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 { $ret .= ($ret ? $sep : '' ).$object->zip; - $ret .= ' '.$object->town; + $ret .= ($object->town?' '.$object->town:''); if ($object->state && in_array($object->country_code,$countriesusingstate)) { $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 { $ret .= ($ret ? $sep : '' ).$object->zip; - $ret .= ' '.$object->town; + $ret .= ($object->town?' '.$object->town:''); if ($object->state && in_array($object->country_code,$countriesusingstate)) { $ret.=", ".$object->state; } } 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; }