diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 28ec44e5f83..036ed896a04 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2223,7 +2223,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $ret = ''; $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR', 'CN'); // See also MAIN_FORCE_STATE_INTO_ADDRESS - + $sep = "\n"; // See format of addresses on https://en.wikipedia.org/wiki/Address // Address if (empty($mode)) { @@ -2233,12 +2233,13 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US', 'CN')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); - $ret .= ($ret ? $sep : '').$town; + $ret .= (($ret && $town) ? $sep : '').$town; + if (!empty($object->state)) { - $ret .= ($ret ? ", " : '').$object->state; + $ret .= ($ret ? ($town ? ", " : $sep) : '').$object->state; } if (!empty($object->zip)) { - $ret .= ($ret ? ", " : '').$object->zip; + $ret .= ($ret ? (($town || $object->state) ? ", " : $sep) : '').$object->zip; } } elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website-website.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_website.sql rename to htdocs/install/mysql/tables/llx_website-website.sql