2
0
forked from Wavyzz/dolibarr

fix warning

This commit is contained in:
Laurent Destailleur
2020-12-05 13:48:51 +01:00
parent 333449ca50
commit 5860bf69ce

View File

@@ -1888,8 +1888,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address); $ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address);
} }
// Zip/Town/State // Zip/Town/State
if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) // US: title firstname name \n address lines \n town, state, zip \n country if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !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] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town; $ret .= ($ret ? $sep : '').$town;
if ($object->state) if ($object->state)
@@ -1897,8 +1896,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret .= ($ret ? ", " : '').$object->state; $ret .= ($ret ? ", " : '').$object->state;
} }
if ($object->zip) $ret .= ($ret ? ", " : '').$object->zip; if ($object->zip) $ret .= ($ret ? ", " : '').$object->zip;
} elseif (in_array($object->country_code, array('GB', 'UK'))) // UK: title firstname name \n address lines \n town state \n zip \n country } 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
{
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town; $ret .= ($ret ? $sep : '').$town;
if ($object->state) if ($object->state)
@@ -1906,8 +1904,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret .= ($ret ? ", " : '').$object->state; $ret .= ($ret ? ", " : '').$object->state;
} }
if ($object->zip) $ret .= ($ret ? $sep : '').$object->zip; if ($object->zip) $ret .= ($ret ? $sep : '').$object->zip;
} elseif (in_array($object->country_code, array('ES', 'TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country } elseif (isset($object->country_code) && 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;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
@@ -1915,14 +1912,12 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
{ {
$ret .= "\n".$object->state; $ret .= "\n".$object->state;
} }
} elseif (in_array($object->country_code, array('IT'))) // IT: tile firstname name\n address lines \n zip (Code Departement) \n country } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
{
$ret .= ($ret ? $sep : '').$object->zip; $ret .= ($ret ? $sep : '').$object->zip;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
$ret .= ($object->state_code ? (' '.($object->state_code)) : ''); $ret .= ($object->state_code ? (' '.($object->state_code)) : '');
} 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
{
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : ''; $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
$ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : ''); $ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : '');
@@ -1932,10 +1927,9 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
} }
} }
if (!is_object($outputlangs)) $outputlangs = $langs; if (!is_object($outputlangs)) $outputlangs = $langs;
if ($withcountry) if ($withcountry) {
{
$langs->load("dict"); $langs->load("dict");
$ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : ''); $ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
} }
return $ret; return $ret;