diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3f6c9d956a5..cf3d8bbd82c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -182,10 +182,13 @@ class Commande extends CommonOrder /** * @var int Date expected for delivery - * @deprecated + * @deprecated Use delivery_date instead. */ - public $date_livraison; // deprecated; Use delivery_date instead. + public $date_livraison; + /** + * @var int Date expected for delivery + */ public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) /** diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e17bfbc55d4..c01a1dd6ed0 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2038,7 +2038,7 @@ class ExtraFields $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); } elseif (in_array($key_type, array('html'))) { - $value_key = GETPOST("options_".$key, 'alpha'); + $value_key = GETPOST("options_".$key, 'restricthtml'); } elseif (in_array($key_type, array('text'))) { $value_key = GETPOST("options_".$key, 'alphanohtml'); } else { 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/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 995ee525d7a..1adb078dc36 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6660,6 +6660,14 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object } } } + if (!empty($conf->global->ODT_ENABLE_ALL_TAGS_IN_SUBSTITUTIONS)) { + // to list all tags in odt template + $tags = ''; + foreach ($substitutionarray as $key => $value) { + $tags .= '{' . $key . '} => ' . $value ."\n"; + } + $substitutionarray = array_merge($substitutionarray, array('__ALL_TAGS__' => $tags)); + } } /** diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index cfa8c75ec11..6d2f2772610 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -322,11 +322,6 @@ class doc_generic_member_odt extends ModelePDFMember $tmparray = array_merge($array_member, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); - $tags = ''; - foreach ($tmparray as $key => $value) { - $tags .= '{' . $key . '} => ' . $value ."\n"; - } - $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); // Call the ODTSubstitution hook $parameters = array( 'file'=>$file, @@ -352,12 +347,10 @@ class doc_generic_member_odt extends ModelePDFMember // Replace labels translated $tmparray = $outputlangs->get_translations_for_substitutions(); - foreach ($tmparray as $key=>$value) - { + foreach ($tmparray as $key=>$value) { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); - } catch (OdfException $e) - { + } catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_WARNING); } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5f2771594de..6ac872d7555 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -121,7 +121,7 @@ class CommandeFournisseur extends CommonOrder public $date_livraison; /** - * Delivery date + * @var int Date expected for delivery */ public $delivery_date; @@ -132,16 +132,6 @@ class CommandeFournisseur extends CommonOrder public $total_ttc; public $source; - /** - * @deprecated - * @see $note_private, $note_public - */ - public $note; - - public $note_private; - public $note_public; - public $model_pdf; - /** * @var int ID */ @@ -3107,8 +3097,11 @@ class CommandeFournisseur extends CommonOrder if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility - if (empty($this->delivery_date)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); - else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day'); + if (empty($this->delivery_date)) { + $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + } else { + $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->delivery_date, 'day'); + } $text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today"); return $text; 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..84c53494ce9 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -198,6 +198,18 @@ 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 +812,20 @@ 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 '';