From 45a52a955e8ae1afaa4cf6adfcded6c235135f77 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 6 Aug 2018 10:52:10 +0200 Subject: [PATCH 1/2] NEW: Add optoin to display thirdparty adress in combolist --- htdocs/core/class/html.form.class.php | 19 ++++++++++++++++++- htdocs/langs/en_US/admin.lang | 1 + htdocs/societe/admin/societe.php | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) 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 ''; +print ''.$langs->trans("AddAdressInList").''; +print ' '; +print ''; +if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) +{ + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); +} +print ''; +print ''; + print ''; From 847d5bfb92b16d33d49fea8442bdf3f941880544 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 6 Aug 2018 10:55:28 +0200 Subject: [PATCH 2/2] add config --- htdocs/societe/admin/societe.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index ac9e26f6a9d..4eb58b1e99e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -182,6 +182,21 @@ if ($action=="setaddrefinlist") { } } +//Activate Set adress in list +if ($action=="setaddadressinlist") { + $val = GETPOST('value','int'); + $res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val,'yesno',0,'',$conf->entity); + if (! $res > 0) $error++; + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + //Activate Ask For Preferred Shipping Method if ($action=="setaskforshippingmet") { $setaskforshippingmet = GETPOST('value','int');