diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 092216e531f..cac64ea14ad 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1464,9 +1464,10 @@ class Form // We search third parties $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste"; + if (!empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) $sql.= ", sp.email, sp.phone, sp.phone_perso, sp.phone_mobile, sp.town AS contact_town, s.town AS company_town"; if ($showsoc > 0) $sql .= " , s.nom as company"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; - if ($showsoc > 0) $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=sp.fk_soc"; + if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=sp.fk_soc"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; if ($socid > 0 || $socid == -1) $sql .= " AND sp.fk_soc=".$socid; if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql .= " AND sp.statut <> 0"; @@ -1499,6 +1500,28 @@ class Form { $obj = $this->db->fetch_object($resql); + // Set email (or phones) and town extended infos + $extendedInfos = ''; + if (!empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) { + $extendedInfos = array(); + $email = trim($obj->email); + if (!empty($email)) $extendedInfos[] = $email; + else { + $phone = trim($obj->phone); + $phone_perso = trim($obj->phone_perso); + $phone_mobile = trim($obj->phone_mobile); + if (!empty($phone)) $extendedInfos[] = $phone; + if (!empty($phone_perso)) $extendedInfos[] = $phone_perso; + if (!empty($phone_mobile)) $extendedInfos[] = $phone_mobile; + } + $contact_town = trim($obj->contact_town); + $company_town = trim($obj->company_town); + if (!empty($contact_town)) $extendedInfos[] = $contact_town; + elseif (!empty($company_town)) $extendedInfos[] = $company_town; + $extendedInfos = implode(' - ', $extendedInfos); + if (!empty($extendedInfos)) $extendedInfos = ' - ' . $extendedInfos; + } + $contactstatic->id = $obj->rowid; $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; @@ -1513,7 +1536,7 @@ class Form $out .= ''; @@ -1521,7 +1544,7 @@ class Form $out .= ''; @@ -1529,7 +1552,7 @@ class Form } else { if (in_array($obj->rowid, $selected)) { - $out .= $contactstatic->getFullName($langs); + $out .= $contactstatic->getFullName($langs) . $extendedInfos; if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')'; if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')'; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ac3fb07e796..dd8e6fe6538 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1314,6 +1314,7 @@ PHPModuleLoaded=PHP component %s is loaded PreloadOPCode=Preloaded OPCode is used AddRefInList=Display Customer/Vendor 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/Vendor 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". +AddEmailPhoneTownInContactList=Display Contact email (or phones if not defined) and town info list (select list or combobox)
Contacts will appear with a name format of "Dupond Durand - dupond.durand@email.com - Paris" or "Dupond Durand - 06 07 59 65 66 - Paris" instead of "Dupond Durand". AskForPreferredShippingMethod=Ask for preferred shipping method for Third Parties. FieldEdition=Edition of field %s FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d7842084c17..ffe9e6992b2 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1276,6 +1276,7 @@ PHPModuleLoaded=Le composant PHP %s est chargé PreloadOPCode=Le code OP préchargé est utilisé AddRefInList=Afficher les références client/fournisseur dans les listes (listes déroulantes ou à autocomplétion) et les libellés des liens clicables.
Les tiers apparaîtront alors sous la forme "CC12345 - SC45678 - La big company coorp", au lieu de "La big company coorp". AddAdressInList=Affiche les informations sur l’adresse du client/fournisseur (liste de sélection ou liste déroulante)
Les tiers apparaîtront avec le format de nom suivant: "The Big Company corp. - 21, rue du saut 123456 Big town - USA" au lieu de "The Big Company corp". +AddEmailPhoneTownInContactList=Affiche les informations sur l’email (ou les telephones si non définie) et la ville du contact (liste de sélection ou liste déroulante)
Les contacts apparaîtront avec le format de nom suivant: "Dupond Durand - dupond.durand@email.com - Paris" ou "Dupond Durand - 06 07 59 65 66 - Paris" au lieu de "Dupond Durand". AskForPreferredShippingMethod=Demander la méthode d'expédition préférée pour les Tiers FieldEdition=Édition du champ %s FillThisOnlyIfRequired=Exemple: +2 (ne remplir que si un décalage d'heure est constaté dans l'export) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 4a9c40acd11..73f75ac4698 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -198,6 +198,21 @@ if ($action == "setaddadressinlist") { } } +//Activate Set email phone town in contact list +if ($action=="setaddemailphonetownincontactlist") { + $val = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "CONTACT_SHOW_EMAIL_PHONE_TOWN_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'); @@ -800,6 +815,23 @@ if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) print ''; print ''; +print ''; +print ''.$langs->trans("AddEmailPhoneTownInContactList").''; +print ' '; +print ''; +if (!empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) +{ + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); +} +else +{ + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); +} +print ''; +print ''; + if (!empty($conf->expedition->enabled)) { if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal) print '';