diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 81a51983daf..93f401e8d81 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1087,8 +1087,18 @@ class Form
// On recherche les societes
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
- $sql.= " FROM ".MAIN_DB_PREFIX ."societe as s";
+
+ if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
+ $sql .= " ,s.address, s.zip, s.town";
+ $sql .= " , dictp.code as country_code";
+ }
+
+ $sql.= " FROM (".MAIN_DB_PREFIX ."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql.= " )";
+ if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
+ $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid=s.fk_pays";
+ }
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
if (! empty($user->socid)) $sql.= " AND s.rowid = ".$user->socid;
if ($filter) $sql.= " AND (".$filter.")";
@@ -1177,6 +1187,13 @@ class Form
if ($obj->client || $obj->fournisseur) $label.=')';
}
+ if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
+ $label.='-'.$obj->address.'-'. $obj->zip.' '. $obj->town;
+ if (!empty($obj->country_code)) {
+ $label.= ' '. $langs->trans('Country'.$obj->country_code);
+ }
+ }
+
if (empty($outputmode))
{
if (in_array($obj->rowid,$selected))
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 91781ccf326..41554cfd45d 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1179,6 +1179,7 @@ BrowserIsKO=You are using the %s web browser. This browser is known to be a bad
XDebugInstalled=XDebug is loaded.
XCacheInstalled=XCache is loaded.
AddRefInList=Display Customer/Supplier ref. info list (select list or combobox) and most of hyperlink.
Third Parties will appear with a name format of "CC12345 - SC45678 - The Big Company corp." instead of "The Big Company corp".
+AddAdressInList=Display Customer/Supplier adress info list (select list or combobox)
Third Parties will appear with a name format of "The Big Company corp. - 21 jump street 123456 Big town - USA" instead of "The Big Company corp".
AskForPreferredShippingMethod=Ask for preferred sending method for Third Parties.
FieldEdition=Edition of field %s
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index ecbefe2cb1d..ac9e26f6a9d 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -769,6 +769,24 @@ else
print '';
print '';
+print '