';
// Transaction reconciliated or edit link
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
@@ -1692,19 +1691,14 @@ if ($resql) {
print '';
}
}
- print '
';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
- print '';
+ print '';
}
print '
';
if (!$i) {
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 9f000786b7f..5d2bb71109b 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -1060,19 +1060,19 @@ if ($action == 'create') {
// IBAN
print '
';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php
index eeeccddd671..edb54631786 100644
--- a/htdocs/contrat/agenda.php
+++ b/htdocs/contrat/agenda.php
@@ -57,8 +57,8 @@ if ($user->socid) {
$result = restrictedArea($user, 'contrat', $id, '');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index b4cf2fc1fbf..953fd0002d2 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -55,8 +55,8 @@ $result = restrictedArea($user, 'contrat', $id);
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index ed980f9e86e..e6446e3585b 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -79,8 +79,8 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en
$optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php
index 31621ba420a..39dfe336a31 100644
--- a/htdocs/contrat/services_list.php
+++ b/htdocs/contrat/services_list.php
@@ -39,8 +39,8 @@ $optioncss = GETPOST('optioncss', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php
index bbbc95a19c5..a5efb52e787 100644
--- a/htdocs/core/ajax/check_notifications.php
+++ b/htdocs/core/ajax/check_notifications.php
@@ -170,8 +170,10 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto
$event['code'] = $obj->code;
$event['label'] = $obj->label;
$event['location'] = $obj->location;
- $event['reminder_date_formated'] = dol_print_date($db->jdate($obj->dateremind), 'standard');
- $event['event_date_start_formated'] = dol_print_date($db->jdate($obj->datep), 'standard');
+ $event['reminder_date_formated_tzserver'] = dol_print_date($db->jdate($obj->dateremind), 'standard', 'tzserver');
+ $event['event_date_start_formated_tzserver'] = dol_print_date($db->jdate($obj->datep), 'standard', 'tzserver');
+ $event['reminder_date_formated'] = dol_print_date($db->jdate($obj->dateremind), 'standard', 'tzuser');
+ $event['event_date_start_formated'] = dol_print_date($db->jdate($obj->datep), 'standard', 'tzuser');
$eventfound[$obj->id_agenda] = $event;
}
diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php
index b9d3494d00b..14862f3cf43 100644
--- a/htdocs/core/boxes/box_produits_alerte_stock.php
+++ b/htdocs/core/boxes/box_produits_alerte_stock.php
@@ -94,12 +94,12 @@ class box_produits_alerte_stock extends ModeleBoxes
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
- $sql .= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
+ $sql .= " AND p.seuil_stock_alerte > 0";
if (empty($user->rights->produit->lire)) {
- $sql .= ' AND p.fk_product_type != 0';
+ $sql .= ' AND p.fk_product_type <> 0';
}
if (empty($user->rights->service->lire)) {
- $sql .= ' AND p.fk_product_type != 1';
+ $sql .= ' AND p.fk_product_type <> 1';
}
// Add where from hooks
if (is_object($hookmanager)) {
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 7de04ab0d14..029ac6cbfc1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3694,23 +3694,23 @@ abstract class CommonObject
/**
* Fetch array of objects linked to current object (object of enabled modules only). Links are loaded into
* this->linkedObjectsIds array +
- * this->linkedObjects array if $loadalsoobjects = 1
+ * this->linkedObjects array if $loadalsoobjects = 1 or $loadalsoobjects = type
* Possible usage for parameters:
* - all parameters empty -> we look all link to current object (current object can be source or target)
- * - source id+type -> will get target list linked to source
- * - target id+type -> will get source list linked to target
- * - source id+type + target type -> will get target list of the type
- * - target id+type + target source -> will get source list of the type
+ * - source id+type -> will get list of targets linked to source
+ * - target id+type -> will get list of sources linked to target
+ * - source id+type + target type -> will get list of targets of the type linked to source
+ * - target id+type + source type -> will get list of sources of the type linked to target
*
- * @param int $sourceid Object source id (if not defined, id of object)
- * @param string $sourcetype Object source type (if not defined, element name of object)
- * @param int $targetid Object target id (if not defined, id of object)
- * @param string $targettype Object target type (if not defined, elemennt name of object)
- * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
- * @param int $alsosametype 0=Return only links to object that differs from source type. 1=Include also link to objects of same type.
- * @param string $orderby SQL 'ORDER BY' clause
- * @param int $loadalsoobjects Load also array this->linkedObjects (Use 0 to increase performances)
- * @return int <0 if KO, >0 if OK
+ * @param int $sourceid Object source id (if not defined, id of object)
+ * @param string $sourcetype Object source type (if not defined, element name of object)
+ * @param int $targetid Object target id (if not defined, id of object)
+ * @param string $targettype Object target type (if not defined, element name of object)
+ * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
+ * @param int $alsosametype 0=Return only links to object that differs from source type. 1=Include also link to objects of same type.
+ * @param string $orderby SQL 'ORDER BY' clause
+ * @param int|string $loadalsoobjects Load also array this->linkedObjects. Use 0 to increase performances, Use 1 to load all, Use value of type ('facture', 'facturerec', ...) to load only a type of object.
+ * @return int <0 if KO, >0 if OK
* @see add_object_linked(), updateObjectLinked(), deleteObjectLinked()
*/
public function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1)
@@ -3892,10 +3892,9 @@ abstract class CommonObject
$module = 'mrp';
}
-
- // Here $module, $classfile and $classname are set
+ // Here $module, $classfile and $classname are set, we can use them.
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) {
- if ($loadalsoobjects) {
+ if ($loadalsoobjects && (is_numeric($loadalsoobjects) || ($loadalsoobjects === $objecttype))) {
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
//print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname);
if (class_exists($classname)) {
@@ -6110,6 +6109,7 @@ abstract class CommonObject
}
$sql .= ")";
+
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 184b97a3c98..4c0ec1ff5a5 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1947,8 +1947,8 @@ class ExtraFields
if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) {
continue;
}
- if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') {
- //when unticking boolean field, it's not set in POST
+
+ if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) {
continue;
}
diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php
index d1b1e08710e..a40ec3e30c3 100644
--- a/htdocs/core/class/hookmanager.class.php
+++ b/htdocs/core/class/hookmanager.class.php
@@ -111,7 +111,7 @@ class HookManager
if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) { // We instantiate action class only if initialized hook is handled by module
// Include actions class overwriting hooks
- if (empty($this->hooks[$context][$module]) || !is_object($this->hooks[$context][$module])) { // If set to an object value, class was already loaded
+ if (empty($this->hooks[$context][$module]) || !is_object($this->hooks[$context][$module])) { // If set to an object value, class was already loaded so we do nothing.
$path = '/'.$module.'/class/';
$actionfile = 'actions_'.$module.'.class.php';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index de8c4519a22..88fca7b536a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3120,7 +3120,7 @@ class Form
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock,";
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
- $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
+ $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,";
$sql .= " pfp.supplier_reputation";
// if we use supplier description of the products
if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
@@ -3275,7 +3275,7 @@ class Form
$optlabel = $objp->ref;
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
- $optlabel .= ' ('.$objp->ref_fourn.')';
+ $optlabel .= ' ('.$objp->ref_fourn.')';
}
if (!empty($conf->barcode->enabled) && !empty($objp->barcode)) {
$optlabel .= ' ('.$outbarcode.')';
@@ -3416,7 +3416,6 @@ class Form
$opt .= "\n";
-
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box
@@ -3427,7 +3426,11 @@ class Form
'value'=>$outref,
'label'=>$outval,
'qty'=>$outqty,
- 'price_ht'=>price2num($objp->unitprice, 'MT'),
+ 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
+ 'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
+ 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
+ 'tva_tx'=>$objp->tva_tx,
+ 'default_vat_code'=>$objp->default_vat_code,
'discount'=>$outdiscount,
'type'=>$outtype,
'duration_value'=>$outdurationvalue,
@@ -3662,7 +3665,7 @@ class Form
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Charge dans cache la liste des délais de livraison possibles
+ * Load int a cache property th elist of possible delivery delays.
*
* @return int Nb of lines loaded, <0 if KO
*/
@@ -3671,7 +3674,7 @@ class Form
// phpcs:enable
global $langs;
- $num = count($this->cache_availability);
+ $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
if ($num > 0) {
return 0; // Cache already loaded
}
@@ -3755,7 +3758,7 @@ class Form
{
global $langs;
- $num = count($this->cache_demand_reason);
+ $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
if ($num > 0) {
return 0; // Cache already loaded
}
@@ -3851,7 +3854,7 @@ class Form
// phpcs:enable
global $langs;
- $num = count($this->cache_types_paiements);
+ $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
if ($num > 0) {
return $num; // Cache already loaded
}
@@ -4092,7 +4095,7 @@ class Form
// phpcs:enable
global $langs;
- $num = count($this->cache_transport_mode);
+ $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
if ($num > 0) {
return $num; // Cache already loaded
}
diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php
index d4f4779a606..f5502426b00 100644
--- a/htdocs/core/class/html.formactions.class.php
+++ b/htdocs/core/class/html.formactions.class.php
@@ -352,7 +352,7 @@ class FormActions
* @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too.
* @param string $htmlname Name of select field
* @param string $excludetype A type to exclude ('systemauto', 'system', '')
- * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
+ * @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual", -2=Combined line is disabled (not implemented yet)
* @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value
* @param int $multiselect 1=Allow multiselect of action type
* @param int $nooutput 1=No output
@@ -373,7 +373,7 @@ class FormActions
$caction = new CActionComm($this->db);
// Suggest a list with manual events or all auto events
- $arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
+ $arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot, '', 0); // If we use param 'all' instead of 'code', there is no group by include in answer but the key 'type' of answer array contains the key for the group by.
if (empty($multiselect)) {
// Add empty line at start only if no multiselect
array_unshift($arraylist, ' ');
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 80a9c75dffc..7ceca2f373b 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1569,6 +1569,7 @@ class FormMail extends Form
// For mass emailing, we have different keys
$tmparray['__ID__'] = 'IdRecord';
+ $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode';
$tmparray['__EMAIL__'] = 'EMailRecipient';
$tmparray['__LASTNAME__'] = 'Lastname';
$tmparray['__FIRSTNAME__'] = 'Firstname';
diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php
index 25ab99bfe01..4f5557279f4 100644
--- a/htdocs/core/class/html.formsetup.class.php
+++ b/htdocs/core/class/html.formsetup.class.php
@@ -215,7 +215,7 @@ class FormSetup
$out = '
';
$out .= '';
$out .= '
';
- $out .= '
' . $this->langs->trans("Parameter") . '
';
+ $out .= '
' . $this->langs->trans("Parameter") . '
';
$out .= '
' . $this->langs->trans("Value") . '
';
$out .= '
';
$out .= '';
@@ -353,7 +353,8 @@ class FormSetup
*/
$item = new FormSetupItem($confKey);
- $item->setTypeFromTypeString($params['type']);
+ // need to be ignored from scrutinizer setTypeFromTypeString was created as deprecated to incite developper to use object oriented usage
+ /** @scrutinizer ignore-deprecated */ $item->setTypeFromTypeString($params['type']);
if (!empty($params['enabled'])) {
$item->enabled = $params['enabled'];
@@ -560,13 +561,16 @@ class FormSetupItem
/** @var string $helpText */
public $helpText = '';
- /** @var string $value */
+ /** @var string $fieldValue */
public $fieldValue;
+ /** @var array $fieldAttr fields attribute only for compatible fields like input text */
+ public $fieldAttr;
+
/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
public $fieldOverride = false;
- /** @var bool|string set this var to override field output */
+ /** @var bool|string set this var to override field input */
public $fieldInputOverride = false;
/** @var bool|string set this var to override field output */
@@ -583,6 +587,7 @@ class FormSetupItem
/**
* TODO each type must have setAs{type} method to help configuration
* And set var as protected when its done configuration must be done by method
+ * this is important for retrocompatibility of futures versions
* @var string $type 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
*/
protected $type = 'string';
@@ -594,13 +599,19 @@ class FormSetupItem
/**
* Constructor
*
- * @param $confKey the conf key used in database
+ * @param string $confKey the conf key used in database
*/
public function __construct($confKey)
{
- global $langs, $db, $conf;
+ global $langs, $db, $conf, $form;
$this->db = $db;
- $this->form = new Form($this->db);
+
+ if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // the form class has a cache inside so I am using it to optimize
+ $this->form = $form;
+ } else {
+ $this->form = new Form($this->db);
+ }
+
$this->langs = $langs;
$this->entity = $conf->entity;
@@ -700,6 +711,10 @@ class FormSetupItem
return $this->fieldInputOverride;
}
+ $this->fieldAttr['name'] = $this->confKey;
+ $this->fieldAttr['id'] = 'setup-'.$this->confKey;
+ $this->fieldAttr['value'] = $this->fieldValue;
+
$out = '';
if ($this->type == 'title') {
@@ -726,7 +741,9 @@ class FormSetupItem
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} else {
- $out.= '';
+ if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
+
+ $out.= 'fieldAttr).' />';
}
return $out;
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index eaf4804b213..f69dcb2874d 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -249,7 +249,7 @@ class Link extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
- dol_syslog(get_class($this)."::fetchAll ".$num."records", LOG_DEBUG);
+ dol_syslog(get_class($this)."::fetchAll num=".((int) $num), LOG_DEBUG);
if ($num > 0) {
while ($obj = $this->db->fetch_object($resql)) {
$link = new Link($this->db);
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index c092690a505..f881447cd67 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -555,9 +555,9 @@ class Translate
* Return translated value of key for special keys ("Currency...", "Civility...", ...).
* Search in lang file, then into database. Key must be any complete entry into lang file: CurrencyEUR, ...
* If not found, return key.
- * The string return is not formated (translated with transnoentitiesnoconv)
- * NOTE: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey), if you modify this function,
- * check that getLabelFromKey is not called with same value than input.
+ * The string return is not formated (translated with transnoentitiesnoconv).
+ * NOTE: To avoid infinite loop (getLabelFromKey->transnoentities->getTradFromKey->getLabelFromKey), if you modify this function,
+ * check that getLabelFromKey is never called with the same value than $key.
*
* @param string $key Key to translate
* @return string Translated string (translated with transnoentitiesnoconv)
@@ -585,7 +585,7 @@ class Translate
$newstr = $this->getLabelFromKey($db, $reg[1], 'c_lead_status', 'code', 'label');
} elseif (preg_match('/^OrderSource([0-9A-Z]+)$/i', $key, $reg)) {
// TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method
- //$newstr=$this->getLabelFromKey($db,$reg[1],'c_ordersource','code','label');
+ //$newstr=$this->getLabelFromKey($db,$reg[1],'llx_c_input_reason','code','label');
}
/* Disabled. There is too many cases where translation of $newstr is not defined is normal (like when output with setEventMessage an already translated string)
@@ -945,9 +945,9 @@ class Translate
*
* @param DoliDB $db Database handler
* @param string $key Translation key to get label (key in language file)
- * @param string $tablename Table name without prefix
- * @param string $fieldkey Field for key
- * @param string $fieldlabel Field for label
+ * @param string $tablename Table name without prefix. This value must always be a hardcoded string and not a value coming from user input.
+ * @param string $fieldkey Field for key. This value must always be a hardcoded string and not a value coming from user input.
+ * @param string $fieldlabel Field for label. This value must always be a hardcoded string and not a value coming from user input.
* @param string $keyforselect Use another value than the translation key for the where into select
* @param int $filteronentity Use a filter on entity
* @return string Label in UTF8 (but without entities)
@@ -959,10 +959,15 @@ class Translate
if ($key == '') {
return '';
}
+ // Test should be useless because the 3 variables are never set from user input but we keep it in case of.
+ if (preg_match('/[^0-9A-Z_]/i', $tablename) || preg_match('/[^0-9A-Z_]/i', $fieldkey) || preg_match('/[^0-9A-Z_]/i', $fieldlabel)) {
+ $this->error = 'Bad value for parameter tablename, fieldkey or fieldlabel';
+ return -1;
+ }
//print 'param: '.$key.'-'.$keydatabase.'-'.$this->trans($key); exit;
- // Check if a translation is available (this can call getTradFromKey)
+ // Check if a translation is available (Note: this can call getTradFromKey that can call getLabelFromKey)
$tmp = $this->transnoentitiesnoconv($key);
if ($tmp != $key && $tmp != 'ErrorBadValueForParamNotAString') {
return $tmp; // Found in language array
@@ -973,6 +978,7 @@ class Translate
return $this->cache_labels[$tablename][$key]; // Found in cache
}
+ // Not found in loaded language file nor in cache. So we will take the label into database.
$sql = "SELECT ".$fieldlabel." as label";
$sql .= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql .= " WHERE ".$fieldkey." = '".$db->escape($keyforselect ? $keyforselect : $key)."'";
diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php
index e081c59b14b..b408985a92d 100644
--- a/htdocs/core/class/utils.class.php
+++ b/htdocs/core/class/utils.class.php
@@ -399,21 +399,23 @@ class Utils
if ($execmethod == 2) { // With this method, there is no way to get the return code, only output
$handlein = popen($fullcommandclear, 'r');
$i = 0;
- while (!feof($handlein)) {
- $i++; // output line number
- $read = fgets($handlein);
- // Exclude warning line we don't want
- if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) {
- continue;
- }
- fwrite($handle, $read);
- if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) {
- $ok = 1;
- } elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) {
- $ok = 1;
+ if ($handlein) {
+ while (!feof($handlein)) {
+ $i++; // output line number
+ $read = fgets($handlein);
+ // Exclude warning line we don't want
+ if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) {
+ continue;
+ }
+ fwrite($handle, $read);
+ if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) {
+ $ok = 1;
+ } elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) {
+ $ok = 1;
+ }
}
+ pclose($handlein);
}
- pclose($handlein);
}
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index daa5f657549..fdbb755637a 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -62,6 +62,9 @@ abstract class DoliDB implements Database
/** @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ... */
public $lasterrno;
+ /** @var string If we need to set a prefix specific to the database so it can be reused (when defined instead of MAIN_DB_PREFIX) to forge requests */
+ public $prefix_db;
+
/** @var bool Status */
public $ok;
/** @var string */
diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php
index 77b0416956b..597031945f1 100644
--- a/htdocs/core/get_menudiv.php
+++ b/htdocs/core/get_menudiv.php
@@ -121,12 +121,13 @@ print '
display: none;
}
- a.alilevel0 {
+ a.alilevel0, span.spanlilevel0 {
background-image: url(\''.DOL_URL_ROOT.'/theme/'.urlencode($conf->theme).'/img/next.png\') !important;
background-repeat: no-repeat !important;
background-position-x: 10px;
background-position-y: 16px;
padding: 1em 15px 1em 40px;
+ display: block;
}
li.lilevel0 font.vsmenudisabled {
background-repeat: no-repeat !important;
diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php
index f4a4e59526a..af5952f6026 100644
--- a/htdocs/core/js/lib_notification.js.php
+++ b/htdocs/core/js/lib_notification.js.php
@@ -64,7 +64,7 @@ print "jQuery(document).ready(function () {\n";
//print " console.log('referrer=".dol_escape_js($_SERVER['HTTP_REFERER'])."');\n";
print ' var nowtime = Date.now();';
-print ' var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY.';'."\n"; // Always defined
+print ' var time_auto_update = '.max(1, getDolGlobalInt('MAIN_BROWSER_NOTIFICATION_FREQUENCY')).';'."\n"; // Always defined
print ' var time_js_next_test;'."\n";
?>
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index e806d9b5957..448677002df 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -240,6 +240,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
if (empty($nocommentremoval)) {
$buf = preg_replace('/([,;ERLT\)])\s*--.*$/i', '\1', $buf); //remove comment from a line that not start with -- before add it to the buffer
}
+ if ($buffer) $buffer .= ' ';
$buffer .= trim($buf);
}
@@ -639,7 +640,7 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
if ($nbofactivatedmodules <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled)
//$head[$h][1] = $form->textwithpicto($langs->trans("AvailableModules"), $desc);
$head[$h][1] = $langs->trans("AvailableModules");
- $head[$h][1] .= $form->textwithpicto('', $langs->trans("YouMustEnableOneModule").'.
'.$desc.'', 1, 'warning');
} else {
//$head[$h][1] = $langs->trans("AvailableModules").$form->textwithpicto(''.$nbofactivatedmodules.' / '.$nboftotalmodules.'', $desc, 1, 'help', '', 1, 3);
$head[$h][1] = $langs->trans("AvailableModules").''.$nbofactivatedmodules.' / '.$nboftotalmodules.'';
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 4ce7d4691a4..2902430bf82 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -916,8 +916,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
$form = new Form($db);
$optioncss = GETPOST('optioncss', 'alpha');
- $sortfield = GETPOST("sortfield", 'alpha');
- $sortorder = GETPOST("sortorder", 'alpha');
+ $sortfield = GETPOST('sortfield', 'aZ09comma');
+ $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$search_status = GETPOST("search_status", 'int');
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 7b5cc92c75d..c70ea041e0a 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2270,13 +2270,13 @@ function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(
/**
* Security check when accessing to a document (used by document.php, viewimage.php and webservices to get documents).
- * TODO Replace code that set $accesallowed by a call to restrictedArea()
+ * TODO Replace code that set $accessallowed by a call to restrictedArea()
*
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp'). Exemple: 'medias', 'invoice', 'logs', 'tax-vat', ...
* @param string $original_file Relative path with filename, relative to modulepart.
* @param string $entity Restrict onto entity (0=no restriction)
* @param User $fuser User object (forced)
- * @param string $refname Ref of object to check permission for external users (autodetect if not provided)
+ * @param string $refname Ref of object to check permission for external users (autodetect if not provided) or for hierarchy
* @param string $mode Check permission for 'read' or 'write'
* @return mixed Array with access information : 'accessallowed' & 'sqlprotectagainstexternals' & 'original_file' (as a full path name)
* @see restrictedArea()
@@ -2423,6 +2423,30 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = 1;
}
$original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file;
+ } elseif (($modulepart == 'holiday') && !empty($conf->holiday->dir_output)) {
+ if ($fuser->rights->holiday->{$read} || preg_match('/^specimen/i', $original_file)) {
+ $accessallowed = 1;
+ // If we known $id of holiday, call checkUserAccessToObject to check permission on properties and hierarchy of leave request
+ if ($refname && !preg_match('/^specimen/i', $original_file)) {
+ include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
+ $tmpholiday = new Holiday($db);
+ $tmpholiday->fetch('', $refname);
+ $accessallowed = checkUserAccessToObject($user, array('holiday'), $tmpholiday, 'holiday', '', '', 'rowid', '');
+ }
+ }
+ $original_file = $conf->holiday->dir_output.'/'.$original_file;
+ } elseif (($modulepart == 'expensereport') && !empty($conf->expensereport->dir_output)) {
+ if ($fuser->rights->expensereport->{$lire} || preg_match('/^specimen/i', $original_file)) {
+ $accessallowed = 1;
+ // If we known $id of expensereport, call checkUserAccessToObject to check permission on properties and hierarchy of expense report
+ if ($refname && !preg_match('/^specimen/i', $original_file)) {
+ include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
+ $tmpexpensereport = new ExpenseReport($db);
+ $tmpexpensereport->fetch('', $refname);
+ $accessallowed = checkUserAccessToObject($user, array('expensereport'), $tmpexpensereport, 'expensereport', '', '', 'rowid', '');
+ }
+ }
+ $original_file = $conf->expensereport->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) {
// Wrapping pour les apercu supplier invoice
if ($fuser->rights->expensereport->{$lire}) {
@@ -2686,7 +2710,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$tmptask = new Task($db);
$tmptask->fetch('', $refname);
- $accessallowed = checkUserAccessToObject($user, array('projet_task'), $tmptask->id, 'projet&project', '', '', 'rowid', '');
+ $accessallowed = checkUserAccessToObject($user, array('projet_task'), $tmptask->id, 'projet_task&project', '', '', 'rowid', '');
}
}
$original_file = $conf->projet->dir_output.'/'.$original_file;
@@ -2971,9 +2995,9 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
$ret = array(
- 'accessallowed' => $accessallowed,
- 'sqlprotectagainstexternals'=>$sqlprotectagainstexternals,
- 'original_file'=>$original_file
+ 'accessallowed' => ($accessallowed ? 1 : 0),
+ 'sqlprotectagainstexternals' => $sqlprotectagainstexternals,
+ 'original_file' => $original_file
);
return $ret;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index ed871204cae..28a20ad6b09 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -828,7 +828,10 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
// We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step (preg_replace).
// No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are
// using a non coventionnel way to be encoded, to not have them sanitized just after)
- $out = preg_replace_callback('/(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out);
+ //$out = preg_replace_callback('/(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out);
+ $out = preg_replace_callback('/(x?[0-9][0-9a-f]+;?)/i', function ($m) {
+ return realCharForNumericEntities($m); }, $out);
+
// Now we remove all remaining HTML entities starting with a number. We don't want such entities.
$out = preg_replace('/?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'.
@@ -1169,23 +1172,34 @@ function dol_sanitizeUrl($stringtoclean, $type = 1)
*/
function dol_string_unaccent($str)
{
+ global $conf;
+
if (utf8_check($str)) {
+ if (extension_loaded('intl') && !empty($conf->global->MAIN_UNACCENT_USE_TRANSLITERATOR)) {
+ $transliterator = \Transliterator::createFromRules(':: Any-Latin; :: Latin-ASCII; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC;', \Transliterator::FORWARD);
+ return $transliterator->transliterate($str);
+ }
// See http://www.utf8-chartable.de/
$string = rawurlencode($str);
$replacements = array(
'%C3%80' => 'A', '%C3%81' => 'A', '%C3%82' => 'A', '%C3%83' => 'A', '%C3%84' => 'A', '%C3%85' => 'A',
+ '%C3%87' => 'C',
'%C3%88' => 'E', '%C3%89' => 'E', '%C3%8A' => 'E', '%C3%8B' => 'E',
'%C3%8C' => 'I', '%C3%8D' => 'I', '%C3%8E' => 'I', '%C3%8F' => 'I',
+ '%C3%91' => 'N',
'%C3%92' => 'O', '%C3%93' => 'O', '%C3%94' => 'O', '%C3%95' => 'O', '%C3%96' => 'O',
+ '%C5%A0' => 'S',
'%C3%99' => 'U', '%C3%9A' => 'U', '%C3%9B' => 'U', '%C3%9C' => 'U',
+ '%C3%9D' => 'Y', '%C5%B8' => 'y',
'%C3%A0' => 'a', '%C3%A1' => 'a', '%C3%A2' => 'a', '%C3%A3' => 'a', '%C3%A4' => 'a', '%C3%A5' => 'a',
'%C3%A7' => 'c',
'%C3%A8' => 'e', '%C3%A9' => 'e', '%C3%AA' => 'e', '%C3%AB' => 'e',
'%C3%AC' => 'i', '%C3%AD' => 'i', '%C3%AE' => 'i', '%C3%AF' => 'i',
'%C3%B1' => 'n',
'%C3%B2' => 'o', '%C3%B3' => 'o', '%C3%B4' => 'o', '%C3%B5' => 'o', '%C3%B6' => 'o',
+ '%C5%A1' => 's',
'%C3%B9' => 'u', '%C3%BA' => 'u', '%C3%BB' => 'u', '%C3%BC' => 'u',
- '%C3%BF' => 'y'
+ '%C3%BD' => 'y', '%C3%BF' => 'y'
);
$string = strtr($string, $replacements);
return rawurldecode($string);
@@ -1985,7 +1999,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
}
} elseif (!$phototoshow) { // example if modulepart = 'societe' or 'photo'
- $phototoshow .= $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos);
+ $phototoshow .= $form->showphoto($modulepart, $object, 0, 0, 0, 'photowithmargin photoref', 'small', 1, 0, $maxvisiblephotos);
}
if ($phototoshow) {
@@ -3629,7 +3643,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building',
- 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
+ 'card', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
'multicurrency',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice',
@@ -3641,7 +3655,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'label', 'language', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'off', 'on', 'order',
- 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip',
+ 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'puce',
+ 'stock', 'resize', 'service', 'stats', 'trip',
'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
@@ -3660,7 +3675,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$facolor = '';
$fasize = '';
$fa = 'fas';
- if (in_array($pictowithouttext, array('bell', 'clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
+ if (in_array($pictowithouttext, array('card', 'bell', 'clock', 'establishment', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
$fa = 'far';
}
if (in_array($pictowithouttext, array('black-tie', 'github', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) {
@@ -3673,7 +3688,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'billd'=>'file-medical',
'supplier_invoice'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'supplier_invoicer'=>'file-invoice-dollar', 'supplier_invoiced'=>'file-medical',
'bom'=>'shapes',
- 'chart'=>'chart-line', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'collab'=>'people-arrows', 'conversation'=>'comments', 'country'=>'globe-americas', 'cron'=>'business-time',
+ 'card'=>'address-card', 'chart'=>'chart-line', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'collab'=>'people-arrows', 'conversation'=>'comments', 'country'=>'globe-americas', 'cron'=>'business-time',
'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd',
'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins',
'accounting'=>'search-dollar', 'category'=>'tag', 'dollyrevert'=>'dolly',
@@ -3693,10 +3708,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature',
- 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
+ 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'payment_vat'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'puce'=>'angle-right',
'recent' => 'question', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house', 'recurring'=>'history',
+ 'service'=>'concierge-bell',
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'technic'=>'cogs',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
@@ -5318,7 +5334,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
* 'CT'=Round to Max for totals with Tax of foreign currency accuracy
* Numeric = Nb of digits for rounding (For example 2 for a percentage)
* @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done)
- * Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator).
+ * Put 2 if you know that number is a user input (so we know we have to fix decimal separator).
* @return string Amount with universal numeric format (Example: '99.99999').
* If conversion fails to return a numeric, it returns:
* - text unchanged or partial if ($rounding = ''): price2num('W9ç', '', 0) => '9ç', price2num('W9ç', '', 1) => 'W9ç', price2num('W9ç', '', 2) => '9ç'
diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php
index d44da05fa38..7c32b377bd4 100644
--- a/htdocs/core/lib/modulebuilder.lib.php
+++ b/htdocs/core/lib/modulebuilder.lib.php
@@ -305,6 +305,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$texttoinsert .= "\t".$key." ".$type;
if ($key == 'rowid') {
$texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY';
+ } elseif ($type == 'timestamp') {
+ $texttoinsert .= ' DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
}
if ($key == 'entity') {
$texttoinsert .= ' DEFAULT 1';
diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php
index 05993368802..2911564adef 100644
--- a/htdocs/core/lib/payments.lib.php
+++ b/htdocs/core/lib/payments.lib.php
@@ -461,9 +461,11 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0,
$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
+ print ''."\n";
+
print ' ';
- print '
'."\n";
+ print '
'."\n";
if ($addformmessage) {
print '';
print ' ';
diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php
index 28723ab87db..4375d14430b 100644
--- a/htdocs/core/lib/price.lib.php
+++ b/htdocs/core/lib/price.lib.php
@@ -404,7 +404,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
}
}
- // Recal function using the multicurrency price as reference price. We must set param $multicurrency_tx to 1 to avoid infinite loop.
+ // Recall function using the multicurrency price as reference price. We must set param $multicurrency_tx to 1 to avoid infinite loop.
$newresult = calcul_price_total($qty, $pu_devise, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller, $localtaxes_array, $progress, 1, 0, '');
if ($multicurrency_code) {
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index e9e06708f7c..7f5daf77c4a 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -679,22 +679,23 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Title of task
if (count($arrayfields) > 0 && !empty($arrayfields['t.label']['checked'])) {
- print '
\n";
}
@@ -822,29 +823,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
}
}
- // Contacts of tasks. Disabled, because available by default just after
- /*
- if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
- print '