From 9e3497cff33916fbf01d45c38cb92726dfb859fb Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 19 Feb 2013 16:02:58 +0100 Subject: [PATCH] New: Add ES formated address country rule --- htdocs/core/lib/functions.lib.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 352e5d1384e..36cf943c51b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -673,7 +673,7 @@ function dol_get_fiche_end($notab=0) function dol_format_address($object) { $ret=''; - $countriesusingstate=array('US','IN','GB'); + $countriesusingstate=array('US','IN','GB','ES'); // Address $ret .= $object->address; @@ -696,6 +696,16 @@ function dol_format_address($object) } if ($object->zip) $ret .= ($ret ? "\n" : '' ).$object->zip; } + else if (in_array($object->country_code,array('ES'))) // title firstname name \n address lines \n zip town \n state \n country + { + $ret .= ($ret ? "\n" : '' ).$object->zip; + $ret .= ' '.$object->town; + if ($object->state && in_array($object->country_code,$countriesusingstate)) + { + $ret.="\n".$object->state; + } + } + else // Other: title firstname name \n address lines \n zip town \n country { $ret .= ($ret ? "\n" : '' ).$object->zip;