Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-11-18 13:12:12 +01:00
commit 0dbacab68f
9 changed files with 78 additions and 30 deletions

View File

@ -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)
/**

View File

@ -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 {

View File

@ -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 .= '<option value="'.$obj->rowid.'"';
if ($disabled) $out .= ' disabled';
$out .= ' 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.')';
$out .= '</option>';
@ -1521,7 +1544,7 @@ class Form
$out .= '<option value="'.$obj->rowid.'"';
if ($disabled) $out .= ' disabled';
$out .= '>';
$out .= $contactstatic->getFullName($langs);
$out .= $contactstatic->getFullName($langs) . $extendedInfos;
if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')';
$out .= '</option>';
@ -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.')';
}

View File

@ -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));
}
}
/**

View File

@ -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);
}
}

View File

@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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;

View File

@ -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.<br>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)<br>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)<br>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)

View File

@ -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.<br>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 ladresse du client/fournisseur (liste de sélection ou liste déroulante) <br> 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 lemail (ou les telephones si non définie) et la ville du contact (liste de sélection ou liste déroulante) <br> 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)

View File

@ -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 '</a></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td width="80%">' . $langs->trans("AddEmailPhoneTownInContactList") . '</td>';
print '<td>&nbsp</td>';
print '<td class="center">';
if (!empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
print '<a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setaddemailphonetownincontactlist&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setaddemailphonetownincontactlist&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
}
print '</a></td>';
print '</tr>';
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 '<tr class="oddeven">';