diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt
index 06caf93bd60..3c99a539b3b 100644
--- a/dev/tools/codespell/codespell-lines-ignore.txt
+++ b/dev/tools/codespell/codespell-lines-ignore.txt
@@ -1,16 +1,16 @@
$objMod->dictionaries = $objMod->{"dictionnaries"}; // For backward compatibility
if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) {
print 'id.'&id_entrepot='.$entrepotstatic->id.'&action=transfert&pdluoid='.$pdluo->id.'&token='.newToken().'">';
+ $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt');
$reponsesadd = str_split($obj->reponses);
$sql .= " SET reponses = '".$db->escape($reponsesadd)."'";
$sql .= " SET reponses = '0".$db->escape($obj->reponses)."'";
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0);
+ dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject);
print '
';
- $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt');
$pice = '';
$typea = ($data[$j]->typea == 'birth') ? $picb : $pice;
GETPOSTINT("mouvement"),
- dol_syslog("msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." from=".$overview[0]->from." to=".$overview[0]->to." subject=".$overview[0]->subject);
jQuery("#mouvement option").removeAttr("selected").change();
jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change");
jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change");
@@ -46,6 +46,7 @@
$sql2 .= " SET reponses = '".$db->escape($newcar)."'";
$this->category->childs = array();
$tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field
+ $user->rights->accounting->mouvements = new stdClass();
// mise a jour des reponses utilisateurs dans la base
if ($user->hasRight('stock', 'mouvement', 'lire')) {
if (empty($reyear) || empty($remonth) || empty($reday)) {
@@ -66,6 +67,7 @@
$head[$tab][1] = $langs->trans("Referers");
$out .= "".$langs->trans("Referer").": ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT) : '')." \n";
$reday = GETPOSTINT('reday');
+ $savpermexport = $user->hasRight('accounting', 'mouvements', 'export');
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode as period, cs.import_key";
@@ -78,10 +80,14 @@
$this->periode = $this->date_creation + 3600 * 24 * 30;
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers');
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers');
+ $user->rights->accounting->mouvements->export = $savpermexport;
+ $user->rights->accounting->mouvements->export = 0;
+ $user->rights->accounting->mouvements->export = 1;
if (!empty($arrayfields['cs.periode']['checked'])) {
if ($newamount == 0 || empty($this->date_ech) || (empty($this->period) && empty($this->periode))) {
if ($user->hasRight('stock', 'mouvement', 'creer')) {
if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) {
+ if (empty($user->rights->accounting->mouvements)) {
* @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing.
$datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear"));
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear"));
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index 867c7d0390f..3349e0ebc7c 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -561,7 +561,7 @@ if ($refresh === true) {
$sql .= "SELECT SUM(amount) as mm, date_format(tva.datev,'%Y-%m') as dm, 'claimed' as mode";
$sql .= " FROM " . MAIN_DB_PREFIX . "tva as tva";
- $sql .= " WHERE tva.entity = " . $conf->entity;
+ $sql .= " WHERE tva.entity = " . ((int) $conf->entity);
$sql .= " AND (tva.datev >= '" . $db->idate($date_start) . "' AND tva.datev <= '" . $db->idate($date_end) . "')";
$sql .= " GROUP BY dm";
@@ -570,7 +570,7 @@ if ($refresh === true) {
$sql .= "SELECT SUM(ptva.amount) as mm, date_format(tva.datev,'%Y-%m') as dm, 'paid' as mode";
$sql .= " FROM " . MAIN_DB_PREFIX . "tva as tva";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "payment_vat as ptva ON (tva.rowid = ptva.fk_tva)";
- $sql .= " WHERE tva.entity = " . $conf->entity;
+ $sql .= " WHERE tva.entity = " . ((int) $conf->entity);
$sql .= " AND (tva.datev >= '" . $db->idate($date_start) . "' AND tva.datev <= '" . $db->idate($date_end) . "')";
$sql .= " GROUP BY dm";
diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php
index 4a2cfe074c3..1d5c57d2660 100644
--- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php
+++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php
@@ -77,7 +77,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
$sql .= ", b.code_journal";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.fk_doc = 0";
- $sql .= " AND b.entity = ".$conf->entity;
+ $sql .= " AND b.entity = ".((int) $conf->entity);
$sql .= " ORDER BY b.piece_num DESC ";
$sql .= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_accountancy_suspense_account.php b/htdocs/core/boxes/box_accountancy_suspense_account.php
index 811626ce8f3..2861ff0c2f7 100644
--- a/htdocs/core/boxes/box_accountancy_suspense_account.php
+++ b/htdocs/core/boxes/box_accountancy_suspense_account.php
@@ -75,7 +75,7 @@ class box_accountancy_suspense_account extends ModeleBoxes
$sql = "SELECT COUNT(*) as nb_suspense_account";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.numero_compte = '".$this->db->escape($suspenseAccount)."'";
- $sql .= " AND b.entity = ".$conf->entity;
+ $sql .= " AND b.entity = ".((int) $conf->entity);
$result = $this->db->query($sql);
$nbSuspenseAccount = 0;
diff --git a/htdocs/core/boxes/box_boms.php b/htdocs/core/boxes/box_boms.php
index 2c0e55068ea..7d7a8f35be6 100644
--- a/htdocs/core/boxes/box_boms.php
+++ b/htdocs/core/boxes/box_boms.php
@@ -91,7 +91,7 @@ class box_boms extends ModeleBoxes
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as c";
$sql .= " WHERE c.fk_product = p.rowid";
- $sql .= " AND c.entity = ".$conf->entity;
+ $sql .= " AND c.entity = ".((int) $conf->entity);
$sql .= " ORDER BY c.tms DESC, c.ref DESC";
$sql .= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php
index 3563c6489a8..fe8a94e0d0b 100644
--- a/htdocs/core/boxes/box_bookmarks.php
+++ b/htdocs/core/boxes/box_bookmarks.php
@@ -80,7 +80,7 @@ class box_bookmarks extends ModeleBoxes
$sql = "SELECT b.title, b.url, b.target, b.favicon";
$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
$sql .= " WHERE fk_user = ".((int) $user->id);
- $sql .= " AND b.entity = ".$conf->entity;
+ $sql .= " AND b.entity = ".((int) $conf->entity);
$sql .= $this->db->order("position", "ASC");
$sql .= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php
index 3e578fedb1f..88ab2123c7b 100644
--- a/htdocs/core/boxes/box_comptes.php
+++ b/htdocs/core/boxes/box_comptes.php
@@ -90,7 +90,7 @@ class box_comptes extends ModeleBoxes
$sql .= ', aj.code as accountancy_journal';
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_journal as aj ON aj.rowid = b.fk_accountancy_journal';
- $sql .= " WHERE b.entity = ".$conf->entity;
+ $sql .= " WHERE b.entity = ".((int) $conf->entity);
$sql .= " AND clos = 0";
$sql .= " ORDER BY label";
diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php
index 92a426957c7..c8ffcb759e8 100644
--- a/htdocs/core/boxes/box_contracts.php
+++ b/htdocs/core/boxes/box_contracts.php
@@ -84,7 +84,7 @@ class box_contracts extends ModeleBoxes
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
- $sql .= " AND c.entity = ".$conf->entity;
+ $sql .= " AND c.entity = ".((int) $conf->entity);
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php
index 5d31fdd79bf..322ae474c32 100644
--- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php
+++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php
@@ -94,7 +94,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {
- $sql .= " AND s.rowid = $user->socid";
+ $sql .= " AND s.rowid = ".((int) $user->socid);
}
$sql .= " AND s.outstanding_limit > 0";
$sql .= " AND s.rowid IN (SELECT fk_soc from ".MAIN_DB_PREFIX."facture as f WHERE f.fk_statut = 1 and f.fk_soc = s.rowid)";
diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php
index 57736378f36..61e80b497ab 100644
--- a/htdocs/core/boxes/box_ficheinter.php
+++ b/htdocs/core/boxes/box_ficheinter.php
@@ -88,7 +88,7 @@ class box_ficheinter extends ModeleBoxes
}
$sql .= ", ".MAIN_DB_PREFIX."fichinter as f";
$sql .= " WHERE f.fk_soc = s.rowid ";
- $sql .= " AND f.entity = ".$conf->entity;
+ $sql .= " AND f.entity = ".((int) $conf->entity);
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php
index 923d0090a67..f19132c5ef8 100644
--- a/htdocs/core/boxes/box_mos.php
+++ b/htdocs/core/boxes/box_mos.php
@@ -91,7 +91,7 @@ class box_mos extends ModeleBoxes
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ", ".MAIN_DB_PREFIX."mrp_mo as c";
$sql .= " WHERE c.fk_product = p.rowid";
- $sql .= " AND c.entity = ".$conf->entity;
+ $sql .= " AND c.entity = ".((int) $conf->entity);
$sql .= " ORDER BY c.tms DESC, c.ref DESC";
$sql .= $this->db->plimit($max, 0);
diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php
index 014032717d3..03c3bcf9b3b 100644
--- a/htdocs/core/boxes/box_scheduled_jobs.php
+++ b/htdocs/core/boxes/box_scheduled_jobs.php
@@ -79,7 +79,7 @@ class box_scheduled_jobs extends ModeleBoxes
$sql .= " t.label, t.status, t.test, t.lastresult, t.processing";
$sql .= " FROM " . MAIN_DB_PREFIX . "cronjob as t";
$sql .= " WHERE status <> ".$cronstatic::STATUS_DISABLED;
- $sql .= " AND entity IN (0, ".$conf->entity.")";
+ $sql .= " AND entity IN (0, ".((int) $conf->entity).")";
$sql .= $this->db->order("t.datelastrun", "DESC");
$result = $this->db->query($sql);
diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php
index 77ec1dd5ef3..559ef958cf4 100644
--- a/htdocs/core/boxes/box_services_expired.php
+++ b/htdocs/core/boxes/box_services_expired.php
@@ -84,7 +84,7 @@ class box_services_expired extends ModeleBoxes
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$this->db->idate($now)."'";
- $sql .= " AND c.entity = ".$conf->entity;
+ $sql .= " AND c.entity = ".((int) $conf->entity);
$sql .= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
if ($user->socid) {
$sql .= ' AND c.fk_soc = '.((int) $user->socid);
diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php
index d5f3c9b1f5a..928830750a1 100644
--- a/htdocs/core/boxes/box_task.php
+++ b/htdocs/core/boxes/box_task.php
@@ -158,7 +158,7 @@ class box_task extends ModeleBoxes
}
$sql .= " WHERE ";
- $sql .= " pt.entity = ".$conf->entity;
+ $sql .= " pt.entity = ".((int) $conf->entity);
$sql .= " AND p.fk_statut = ".Project::STATUS_VALIDATED;
$sql .= " AND (pt.progress < 100 OR pt.progress IS NULL ) "; // 100% is done and not displayed
$sql .= " AND p.usage_task = 1 ";
diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php
index a23a45ee47f..04ac8b891a7 100644
--- a/htdocs/core/class/cunits.class.php
+++ b/htdocs/core/class/cunits.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2024-2025 MDW
+ * Copyright (C) 2024-2026 MDW
* Copyright (C) 2024-2026 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -372,7 +372,7 @@ class CUnits extends CommonDict
$sql .= " short_label=".(isset($this->short_label) ? "'".$this->db->escape($this->short_label)."'" : "null").",";
$sql .= " unit_type=".(isset($this->unit_type) ? "'".$this->db->escape($this->unit_type)."'" : "null").",";
$sql .= " scale=".(isset($this->scale) ? "'".$this->db->escape((string) $this->scale)."'" : "null").",";
- $sql .= " active=".(isset($this->active) ? $this->active : "null");
+ $sql .= " active=".(isset($this->active) ? ((int) $this->active) : "null");
$sql .= " WHERE rowid=".((int) $this->id);
$this->db->begin();
diff --git a/htdocs/core/class/fieldsmanager.class.php b/htdocs/core/class/fieldsmanager.class.php
index d2db46eb9a3..ca3668c2cce 100644
--- a/htdocs/core/class/fieldsmanager.class.php
+++ b/htdocs/core/class/fieldsmanager.class.php
@@ -11,6 +11,7 @@
* Copyright (C) 2017 Nicolas ZABOURI
* Copyright (C) 2018-2022 Frédéric France
* Copyright (C) 2022 Antonin MARCHAL
+ * Copyright (C) 2026 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -499,7 +500,7 @@ class FieldsManager
$fieldInfos->size = $attributes['length'] ?? '';
$fieldInfos->label = $attributes['label'] ?? '';
$fieldInfos->langFile = $attributes['langfile'] ?? '';
- $fieldInfos->sqlAlias = $attributes['alias'] ?? null;
+ $fieldInfos->sqlAlias = $attributes['alias'] ?? null; // @phan-suppress-current-line SqlInjection
$fieldInfos->picto = $attributes['picto'] ?? '';
$fieldInfos->position = $attributes['position'] ?? 0;
$fieldInfos->required = ($attributes['notnull'] ?? 0) > 0;
diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php
index b3625c15ddc..10c7196c55f 100644
--- a/htdocs/core/modules/commande/mod_commande_marbre.php
+++ b/htdocs/core/modules/commande/mod_commande_marbre.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
* Copyright (C) 2024-2025 Frédéric France
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2026 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -109,10 +109,10 @@ class mod_commande_marbre extends ModeleNumRefCommandes
$max = '';
$posindice = strlen($this->prefix) + 6;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".((int) $posindice).") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."commande";
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql .= " AND entity = ".$conf->entity;
+ $sql .= " AND entity = ".((int) $conf->entity);
$resql = $db->query($sql);
if ($resql) {
@@ -144,7 +144,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes
// First, we get the max value
$posindice = strlen($this->prefix) + 6;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".((int) $posindice).") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."commande";
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql .= " AND entity IN (".getEntity('ordernumber', 1, $object).")";
diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php
index 3891de40409..08c2d0f8478 100644
--- a/htdocs/core/modules/mailings/advthirdparties.modules.php
+++ b/htdocs/core/modules/mailings/advthirdparties.modules.php
@@ -1,7 +1,7 @@
* Copyright (C) 2005-2009 Regis Houssin
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2026 MDW
* Copyright (C) 2024 Frédéric France
*
* This file is an example to follow to add your own email selector inside
@@ -258,7 +258,7 @@ class mailing_advthirdparties extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE type in (1,2)"; // We keep only categories for suppliers and customers/prospects
// $sql.= " AND visible > 0"; // We ignore the property visible because third party's categories does not use this property (only products categories use it).
- $sql .= " AND entity = ".$conf->entity;
+ $sql .= " AND entity = ".((int) $conf->entity);
$sql .= " ORDER BY label";
//print $sql;
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index c007ccb4e10..5b72020cc67 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -182,7 +182,7 @@ class mailing_fraise extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE type = 3"; // We keep only categories for members
// $sql.= " AND visible > 0"; // We ignore the property visible because member's categories does not use this property (only products categories use it).
- $sql .= " AND entity = ".$conf->entity;
+ $sql .= " AND entity = ".((int) $conf->entity);
$sql .= " ORDER BY label";
//print $sql;
diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php
index 4367f02e985..c2a3961d9c7 100644
--- a/htdocs/core/modules/mailings/pomme.modules.php
+++ b/htdocs/core/modules/mailings/pomme.modules.php
@@ -1,7 +1,7 @@
* Copyright (C) 2005-2009 Regis Houssin
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2026 MDW
* Copyright (C) 2024-2026 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -88,7 +88,7 @@ class mailing_pomme extends MailingTargets
$sql .= " count(distinct(u.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicit dans ce test
- $sql .= " AND u.entity IN (0,".$conf->entity.")";
+ $sql .= " AND u.entity IN (0,".((int) $conf->entity).")";
$statssql[0] = $sql;
@@ -111,7 +111,7 @@ class mailing_pomme extends MailingTargets
$sql = "SELECT count(distinct(u.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicit dans ce test
- $sql .= " AND u.entity IN (0,".$conf->entity.")";
+ $sql .= " AND u.entity IN (0,".((int) $conf->entity).")";
if (empty($this->evenunsubscribe)) {
$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = u.email and mu.entity = ".((int) $conf->entity).")";
}
@@ -184,7 +184,7 @@ class mailing_pomme extends MailingTargets
$sql .= " u.lastname, u.firstname as firstname, u.civility as civility_id, u.login, u.office_phone";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicit dans ce test
- $sql .= " AND u.entity IN (0,".$conf->entity.")";
+ $sql .= " AND u.entity IN (0,".((int) $conf->entity).")";
$sql .= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
if (GETPOSTISSET("filter") && GETPOST("filter") == '1') {
$sql .= " AND u.statut=1";
diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php
index 6d6ccea3877..eb089f04052 100644
--- a/htdocs/core/modules/modBom.class.php
+++ b/htdocs/core/modules/modBom.class.php
@@ -3,7 +3,7 @@
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2019 Maxime Kohlhaas
* Copyright (C) 2021 Ferran Marcet
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2026 MDW
* Copyright (C) 2024 Rafael San José
* Copyright (C) 2024-2026 Frédéric France
*
@@ -342,7 +342,7 @@ class modBom extends DolibarrModules
// Add extra fields
$import_extrafield_sample = array();
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bom' AND entity IN (0, ".$conf->entity.")";
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bom' AND entity IN (0, ".((int) $conf->entity).")";
$resql = $this->db->query($sql);
if ($resql) {
@@ -413,7 +413,7 @@ class modBom extends DolibarrModules
);
// Add extra fields
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bomline' AND entity IN (0, ".$conf->entity.")";
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bomline' AND entity IN (0, ".((int) $conf->entity).")";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php
index 78c30179619..6ab579255fa 100644
--- a/htdocs/core/modules/modKnowledgeManagement.class.php
+++ b/htdocs/core/modules/modKnowledgeManagement.class.php
@@ -3,7 +3,7 @@
* Copyright (C) 2018-2019 Nicolas ZABOURI
* Copyright (C) 2019-2024 Frédéric France
* Copyright (C) 2021 SuperAdmin
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2026 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -468,10 +468,10 @@ class modKnowledgeManagement extends DolibarrModules
}
$sql = array_merge($sql, array(
- "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".((int) $conf->entity),
- "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".((int) $conf->entity).")",
- "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".((int) $conf->entity),
- "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".((int) $conf->entity).")"
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".$this->db->escape(strtolower($myTmpObjectKey))."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".$this->db->escape(strtolower($myTmpObjectKey))."','".$this->db->escape(strtolower($myTmpObjectKey))."',".((int) $conf->entity).")",
+ "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".$this->db->escape(strtolower($myTmpObjectKey))."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
+ "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".$this->db->escape(strtolower($myTmpObjectKey))."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
));
}
}
diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php
index fc39646a024..2d44495364f 100644
--- a/htdocs/core/modules/modMrp.class.php
+++ b/htdocs/core/modules/modMrp.class.php
@@ -4,6 +4,7 @@
* Copyright (C) 2019-2025 Frédéric France
* Copyright (C) 2019 Destailleur Laurent
* Copyright (C) 2024 Charlene Benke
+ * Copyright (C) 2026 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -136,8 +137,8 @@ class modMrp extends DolibarrModules
// );
$this->const = array(
//1=>array('MRP_MO_ADDON_PDF', 'chaine', 'vinci', 'Name of default PDF model of MO', 0),
- 2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
- 3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/mrps', '', 0)
+ 2 => array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
+ 3 => array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/mrps', '', 0)
);
// Some keys to add into the overwriting translation tables
@@ -245,59 +246,59 @@ class modMrp extends DolibarrModules
// Exports profiles provided by this module
$r = 1;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]='MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_icon[$r]='mrp';
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = 'MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_icon[$r] = 'mrp';
$this->export_fields_array[$r] = array(
- 'm.rowid'=>"Id",
- 'm.ref'=>"Ref",
- 'm.label'=>"Label",
- 'm.fk_project'=>'Project',
- 'm.fk_bom'=>"Bom",
- 'm.date_start_planned'=>"DateStartPlanned",
- 'm.date_end_planned'=>"DateEndPlanned",
- 'm.fk_product'=>"Product",
- 'm.status'=>'Status',
- 'm.model_pdf'=>'Model',
- 'm.fk_user_valid'=>'ValidatedById',
- 'm.fk_user_modif'=>'ModifiedById',
- 'm.fk_user_creat'=>'CreatedById',
- 'm.date_valid'=>'DateValidation',
- 'm.note_private'=>'NotePrivate',
- 'm.note_public'=>'Note',
- 'm.fk_soc'=>'ThirdParty:ID',
- 'm.qty'=>'Qty',
- 'm.date_creation'=>'DateCreation',
- 'm.tms'=>'DateModification',
- 'm.fk_warehouse'=>'WarehouseForProduction:ID',
- 'e.ref'=>'WarehouseForProduction:Ref'
+ 'm.rowid' => "Id",
+ 'm.ref' => "Ref",
+ 'm.label' => "Label",
+ 'm.fk_project' => 'Project',
+ 'm.fk_bom' => "Bom",
+ 'm.date_start_planned' => "DateStartPlanned",
+ 'm.date_end_planned' => "DateEndPlanned",
+ 'm.fk_product' => "Product",
+ 'm.status' => 'Status',
+ 'm.model_pdf' => 'Model',
+ 'm.fk_user_valid' => 'ValidatedById',
+ 'm.fk_user_modif' => 'ModifiedById',
+ 'm.fk_user_creat' => 'CreatedById',
+ 'm.date_valid' => 'DateValidation',
+ 'm.note_private' => 'NotePrivate',
+ 'm.note_public' => 'Note',
+ 'm.fk_soc' => 'ThirdParty:ID',
+ 'm.qty' => 'Qty',
+ 'm.date_creation' => 'DateCreation',
+ 'm.tms' => 'DateModification',
+ 'm.fk_warehouse' => 'WarehouseForProduction:ID',
+ 'e.ref' => 'WarehouseForProduction:Ref'
);
$keyforselect = 'mrp_mo';
$keyforelement = 'mrp_mo';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_TypeFields_array[$r] = array(
- 'm.ref'=>"Text",
- 'm.label'=>"Text",
- 'm.fk_project'=>'Numeric',
- 'm.fk_bom'=>"Numeric",
- 'm.date_end_planned'=>"Date",
- 'm.date_start_planned'=>"Date",
- 'm.fk_product'=>"Numeric",
- 'm.status'=>'Numeric',
- 'm.model_pdf'=>'Text',
- 'm.fk_user_valid'=>'Numeric',
- 'm.fk_user_modif'=>'Numeric',
- 'm.fk_user_creat'=>'Numeric',
- 'm.date_valid'=>'Date',
- 'm.note_private'=>'Text',
- 'm.note_public'=>'Text',
- 'm.fk_soc'=>'Numeric',
- 'm.qty'=>'Numeric',
- 'm.date_creation'=>'Date',
- 'm.tms'=>'Date',
- 'm.fk_warehouse'=>'Numeric',
- 'e.ref'=>'Text',
+ 'm.ref' => "Text",
+ 'm.label' => "Text",
+ 'm.fk_project' => 'Numeric',
+ 'm.fk_bom' => "Numeric",
+ 'm.date_end_planned' => "Date",
+ 'm.date_start_planned' => "Date",
+ 'm.fk_product' => "Numeric",
+ 'm.status' => 'Numeric',
+ 'm.model_pdf' => 'Text',
+ 'm.fk_user_valid' => 'Numeric',
+ 'm.fk_user_modif' => 'Numeric',
+ 'm.fk_user_creat' => 'Numeric',
+ 'm.date_valid' => 'Date',
+ 'm.note_private' => 'Text',
+ 'm.note_public' => 'Text',
+ 'm.fk_soc' => 'Numeric',
+ 'm.qty' => 'Numeric',
+ 'm.date_creation' => 'Date',
+ 'm.tms' => 'Date',
+ 'm.fk_warehouse' => 'Numeric',
+ 'e.ref' => 'Text',
);
$this->export_entities_array[$r] = array('m.fk_warehouse' => 'warehouse', 'e.ref' => 'warehouse'); // We define here only fields that use another icon that the one defined into import_icon
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
@@ -308,30 +309,30 @@ class modMrp extends DolibarrModules
// Export of MO + liste of consumption / production
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]='ConsumptionAndProductionInMos'; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_icon[$r]='mrp';
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = 'ConsumptionAndProductionInMos'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_icon[$r] = 'mrp';
$this->export_fields_array[$r] = array(
- 'm.rowid'=>"Id",
- 'm.ref'=>"Ref",
- 'm.label'=>"Label",
- 'm.fk_project'=>'ProjectId',
- 'm.fk_bom'=>"Bom:ID",
- 'm.date_start_planned'=>"DateStartPlanned",
- 'm.date_end_planned'=>"DateEndPlanned",
- 'm.fk_product'=>"Product",
- 'm.status'=>'Status',
- 'm.model_pdf'=>'Model',
- 'm.fk_user_valid'=>'ValidatedById',
- 'm.fk_user_modif'=>'ModifiedById',
- 'm.fk_user_creat'=>'CreatedById',
- 'm.date_valid'=>'DateValidation',
- 'm.note_private'=>'NotePrivate',
- 'm.note_public'=>'Note',
- 'm.fk_soc'=>'ThirdParty',
- 'm.qty'=>'Qty',
- 'm.date_creation'=>'DateCreation',
- 'm.tms'=>'DateModification',
+ 'm.rowid' => "Id",
+ 'm.ref' => "Ref",
+ 'm.label' => "Label",
+ 'm.fk_project' => 'ProjectId',
+ 'm.fk_bom' => "Bom:ID",
+ 'm.date_start_planned' => "DateStartPlanned",
+ 'm.date_end_planned' => "DateEndPlanned",
+ 'm.fk_product' => "Product",
+ 'm.status' => 'Status',
+ 'm.model_pdf' => 'Model',
+ 'm.fk_user_valid' => 'ValidatedById',
+ 'm.fk_user_modif' => 'ModifiedById',
+ 'm.fk_user_creat' => 'CreatedById',
+ 'm.date_valid' => 'DateValidation',
+ 'm.note_private' => 'NotePrivate',
+ 'm.note_public' => 'Note',
+ 'm.fk_soc' => 'ThirdParty',
+ 'm.qty' => 'Qty',
+ 'm.date_creation' => 'DateCreation',
+ 'm.tms' => 'DateModification',
//'e.rowid'=>'WarehouseId',
//'e.ref'=>'WarehouseRef',
);
@@ -356,27 +357,27 @@ class modMrp extends DolibarrModules
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_TypeFields_array[$r] = array(
- 'm.ref'=>"Text",
- 'm.label'=>"Text",
- 'm.fk_project'=>'Numeric',
- 'm.fk_bom'=>"Numeric",
- 'm.date_end_planned'=>"Date",
- 'm.date_start_planned'=>"Date",
- 'm.fk_product'=>"Numeric",
- 'm.status'=>'Numeric',
- 'm.model_pdf'=>'Text',
- 'm.fk_user_valid'=>'Numeric',
- 'm.fk_user_modif'=>'Numeric',
- 'm.fk_user_creat'=>'Numeric',
- 'm.date_valid'=>'Date',
- 'm.note_private'=>'Text',
- 'm.note_public'=>'Text',
- 'm.fk_soc'=>'Numeric',
- 'm.qty'=>'Numeric',
- 'm.date_creation'=>'Date',
- 'm.tms'=>'Date',
- 'e.fk_warehouse'=>'Numeric',
- 'e.ref'=>'Text',
+ 'm.ref' => "Text",
+ 'm.label' => "Text",
+ 'm.fk_project' => 'Numeric',
+ 'm.fk_bom' => "Numeric",
+ 'm.date_end_planned' => "Date",
+ 'm.date_start_planned' => "Date",
+ 'm.fk_product' => "Numeric",
+ 'm.status' => 'Numeric',
+ 'm.model_pdf' => 'Text',
+ 'm.fk_user_valid' => 'Numeric',
+ 'm.fk_user_modif' => 'Numeric',
+ 'm.fk_user_creat' => 'Numeric',
+ 'm.date_valid' => 'Date',
+ 'm.note_private' => 'Text',
+ 'm.note_public' => 'Text',
+ 'm.fk_soc' => 'Numeric',
+ 'm.qty' => 'Numeric',
+ 'm.date_creation' => 'Date',
+ 'm.tms' => 'Date',
+ 'e.fk_warehouse' => 'Numeric',
+ 'e.ref' => 'Text',
'mp.qty' => 'Numeric',
'mp.batch' => 'Text',
'mp.fk_product' => 'Numeric',
@@ -427,39 +428,39 @@ class modMrp extends DolibarrModules
$r++; */
/* END MODULEBUILDER IMPORT MO */
$r++;
- $this->import_code[$r]=$this->rights_class.'_'.$r;
- $this->import_label[$r]='MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->import_icon[$r]='mrp';
+ $this->import_code[$r] = $this->rights_class.'_'.$r;
+ $this->import_label[$r] = 'MOs'; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->import_icon[$r] = 'mrp';
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
- $this->import_tables_array[$r] = array('m'=>MAIN_DB_PREFIX.'mrp_mo', 'extra'=>MAIN_DB_PREFIX.'mrp_mo_extrafields');
- $this->import_tables_creator_array[$r] = array('m'=>'fk_user_creat'); // Fields to store import user id
+ $this->import_tables_array[$r] = array('m' => MAIN_DB_PREFIX.'mrp_mo', 'extra' => MAIN_DB_PREFIX.'mrp_mo_extrafields');
+ $this->import_tables_creator_array[$r] = array('m' => 'fk_user_creat'); // Fields to store import user id
$this->import_fields_array[$r] = array(
'm.ref' => "Ref*",
'm.label' => "Label*",
- 'm.fk_project'=>'Project',
- 'm.fk_bom'=>"Bom",
- 'm.date_start_planned'=>"DateStartPlanned",
- 'm.date_end_planned'=>"DateEndPlanned",
- 'm.fk_product'=>"Product*",
- 'm.status'=>'Status',
- 'm.model_pdf'=>'Model',
- 'm.fk_user_valid'=>'ValidatedById',
- 'm.fk_user_modif'=>'ModifiedById',
- 'm.fk_user_creat'=>'CreatedById',
- 'm.date_valid'=>'DateValidation',
- 'm.note_private'=>'NotePrivate',
- 'm.note_public'=>'Note',
- 'm.fk_soc'=>'ThirdParty',
- 'm.fk_warehouse'=>'Warehouse',
- 'm.qty'=>'Qty*',
- 'm.date_creation'=>'DateCreation',
- 'm.tms'=>'DateModification',
+ 'm.fk_project' => 'Project',
+ 'm.fk_bom' => "Bom",
+ 'm.date_start_planned' => "DateStartPlanned",
+ 'm.date_end_planned' => "DateEndPlanned",
+ 'm.fk_product' => "Product*",
+ 'm.status' => 'Status',
+ 'm.model_pdf' => 'Model',
+ 'm.fk_user_valid' => 'ValidatedById',
+ 'm.fk_user_modif' => 'ModifiedById',
+ 'm.fk_user_creat' => 'CreatedById',
+ 'm.date_valid' => 'DateValidation',
+ 'm.note_private' => 'NotePrivate',
+ 'm.note_public' => 'Note',
+ 'm.fk_soc' => 'ThirdParty',
+ 'm.fk_warehouse' => 'Warehouse',
+ 'm.qty' => 'Qty*',
+ 'm.date_creation' => 'DateCreation',
+ 'm.tms' => 'DateModification',
);
$import_sample = array();
// Add extra fields
$import_extrafield_sample = array();
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'mrp_mo' AND entity IN (0, ".$conf->entity.")";
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'mrp_mo' AND entity IN (0, ".((int) $conf->entity).")";
$resql = $this->db->query($sql);
if ($resql) {
diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php
index 0f492d3fa40..10abd93fcc5 100644
--- a/htdocs/core/modules/modResource.class.php
+++ b/htdocs/core/modules/modResource.class.php
@@ -1,7 +1,7 @@
* Copyright (C) 2015 Laurent Destailleur
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024-2026 MDW
* Copyright (C) 2026 Frédéric France
*
* This program is free software: you can redistribute it and/or modify
@@ -274,7 +274,7 @@ class modResource extends DolibarrModules
$this->import_tables_array[$r] = array('r' => MAIN_DB_PREFIX.'resource', 'extra' => MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array('r.ref' => "ResourceFormLabel_ref*", 'r.fk_code_type_resource' => 'ResourceTypeCode', 'r.description' => 'ResourceFormLabel_description', 'r.note_private' => "NotePrivate", 'r.note_public' => "NotePublic", 'r.asset_number' => 'AssetNumber', 'r.datec' => 'DateCreation');
// Add extra fields
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'resource' AND entity IN (0,".((int) $conf->entity).")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php
index 359fe8e8da0..7146994ab23 100644
--- a/htdocs/core/modules/modUser.class.php
+++ b/htdocs/core/modules/modUser.class.php
@@ -3,6 +3,7 @@
* Copyright (C) 2005-2009 Laurent Destailleur
* Copyright (C) 2005-2024 Regis Houssin
* Copyright (C) 2026 Frédéric France
+ * Copyright (C) 2026 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -78,9 +79,9 @@ class modUser extends DolibarrModules
// Boxes
$this->boxes = [
- ['file'=>'box_lastlogin.php', 'enabledbydefaulton'=>'Home'],
- ['file'=>'box_birthdays.php', 'enabledbydefaulton'=>'Home'],
- ['file'=>'box_dolibarr_state_board.php', 'enabledbydefaulton'=>'Home'],
+ ['file' => 'box_lastlogin.php', 'enabledbydefaulton' => 'Home'],
+ ['file' => 'box_birthdays.php', 'enabledbydefaulton' => 'Home'],
+ ['file' => 'box_dolibarr_state_board.php', 'enabledbydefaulton' => 'Home'],
];
// Permissions
@@ -207,55 +208,55 @@ class modUser extends DolibarrModules
$this->export_label[$r] = 'List of users and attributes'; // Translation key (used only if key ExportDataset_user_1 not found)
$this->export_permission[$r] = array(array("user", "user", "export"));
$this->export_fields_array[$r] = array(
- 'u.rowid'=>"Id", 'u.login'=>"Login", 'u.lastname'=>"Lastname", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
- 'u.accountancy_code'=>"UserAccountancyCode",
- 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
- 'u.office_phone'=>'Phone', 'u.user_mobile'=>"Mobile", 'u.office_fax'=>'Fax',
- 'u.email'=>"Email", 'u.note_public'=>"NotePublic", 'u.note_private'=>"NotePrivate", 'u.signature'=>'Signature',
- 'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours',
- 'u.dateemployment'=>'DateEmploymentStart', 'u.dateemploymentend'=>'DateEmploymentEnd', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
- 'u.birth'=>'DateOfBirth',
- 'u.datec'=>"DateCreation", 'u.tms'=>"DateLastModification",
- 'u.admin'=>"Administrator", 'u.statut'=>'Status', 'u.datelastlogin'=>'LastConnexion', 'u.datepreviouslogin'=>'PreviousConnexion',
- 'u.fk_socpeople'=>"IdContact", 'u.fk_soc'=>"IdCompany",
- 'u.fk_member'=>"MemberId",
- "a.firstname"=>"MemberFirstname",
- "a.lastname"=>"MemberLastname",
- 'g.nom'=>"Group"
+ 'u.rowid' => "Id", 'u.login' => "Login", 'u.lastname' => "Lastname", 'u.firstname' => "Firstname", 'u.employee' => "Employee", 'u.job' => "PostOrFunction", 'u.gender' => "Gender",
+ 'u.accountancy_code' => "UserAccountancyCode",
+ 'u.address' => "Address", 'u.zip' => "Zip", 'u.town' => "Town",
+ 'u.office_phone' => 'Phone', 'u.user_mobile' => "Mobile", 'u.office_fax' => 'Fax',
+ 'u.email' => "Email", 'u.note_public' => "NotePublic", 'u.note_private' => "NotePrivate", 'u.signature' => 'Signature',
+ 'u.fk_user' => 'HierarchicalResponsible', 'u.thm' => 'THM', 'u.tjm' => 'TJM', 'u.weeklyhours' => 'WeeklyHours',
+ 'u.dateemployment' => 'DateEmploymentStart', 'u.dateemploymentend' => 'DateEmploymentEnd', 'u.salary' => 'Salary', 'u.color' => 'Color', 'u.api_key' => 'ApiKey',
+ 'u.birth' => 'DateOfBirth',
+ 'u.datec' => "DateCreation", 'u.tms' => "DateLastModification",
+ 'u.admin' => "Administrator", 'u.statut' => 'Status', 'u.datelastlogin' => 'LastConnexion', 'u.datepreviouslogin' => 'PreviousConnexion',
+ 'u.fk_socpeople' => "IdContact", 'u.fk_soc' => "IdCompany",
+ 'u.fk_member' => "MemberId",
+ "a.firstname" => "MemberFirstname",
+ "a.lastname" => "MemberLastname",
+ 'g.nom' => "Group"
);
$this->export_TypeFields_array[$r] = array(
- 'u.rowid'=>'Numeric', 'u.login'=>"Text", 'u.lastname'=>"Text", 'u.firstname'=>"Text", 'u.employee'=>'Boolean', 'u.job'=>'Text',
- 'u.accountancy_code'=>'Text',
- 'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
- 'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
- 'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note_public'=>"Text", 'u.note_private'=>"Text", 'u.signature'=>"Text", 'u.datelastlogin'=>'Date',
- 'u.fk_user'=>"FormSelect:select_dolusers",
- 'u.birth'=>'Date',
- 'u.datepreviouslogin'=>'Date',
- 'u.fk_socpeople'=>'FormSelect:selectcontacts',
- 'u.fk_soc'=>"FormSelect:select_company",
- 'u.tjm'=>"Numeric", 'u.thm'=>"Numeric", 'u.fk_member'=>"Numeric",
- 'u.weeklyhours'=>"Numeric",
- 'u.dateemployment'=>"Date", 'u.dateemploymentend'=>"Date", 'u.salary'=>"Numeric",
- 'u.color'=>'Text', 'u.api_key'=>'Text',
- 'a.firstname'=>'Text',
- 'a.lastname'=>'Text',
- 'g.nom'=>"Text"
+ 'u.rowid' => 'Numeric', 'u.login' => "Text", 'u.lastname' => "Text", 'u.firstname' => "Text", 'u.employee' => 'Boolean', 'u.job' => 'Text',
+ 'u.accountancy_code' => 'Text',
+ 'u.address' => "Text", 'u.zip' => "Text", 'u.town' => "Text",
+ 'u.office_phone' => 'Text', 'u.user_mobile' => 'Text', 'u.office_fax' => 'Text',
+ 'u.email' => 'Text', 'u.datec' => "Date", 'u.tms' => "Date", 'u.admin' => "Boolean", 'u.statut' => 'Status', 'u.note_public' => "Text", 'u.note_private' => "Text", 'u.signature' => "Text", 'u.datelastlogin' => 'Date',
+ 'u.fk_user' => "FormSelect:select_dolusers",
+ 'u.birth' => 'Date',
+ 'u.datepreviouslogin' => 'Date',
+ 'u.fk_socpeople' => 'FormSelect:selectcontacts',
+ 'u.fk_soc' => "FormSelect:select_company",
+ 'u.tjm' => "Numeric", 'u.thm' => "Numeric", 'u.fk_member' => "Numeric",
+ 'u.weeklyhours' => "Numeric",
+ 'u.dateemployment' => "Date", 'u.dateemploymentend' => "Date", 'u.salary' => "Numeric",
+ 'u.color' => 'Text', 'u.api_key' => 'Text',
+ 'a.firstname' => 'Text',
+ 'a.lastname' => 'Text',
+ 'g.nom' => "Text"
);
$this->export_entities_array[$r] = array(
- 'u.rowid'=>"user", 'u.login'=>"user", 'u.lastname'=>"user", 'u.firstname'=>"user", 'u.employee'=>'user', 'u.job'=>'user', 'u.gender'=>'user',
- 'u.accountancy_code'=>'user',
- 'u.address'=>"user", 'u.zip'=>"user", 'u.town'=>"user",
- 'u.office_phone'=>'user', 'u.user_mobile'=>'user', 'u.office_fax'=>'user',
- 'u.email'=>'user', 'u.note_public'=>"user", 'u.note_private'=>"user", 'u.signature'=>'user',
- 'u.fk_user'=>'user', 'u.thm'=>'user', 'u.tjm'=>'user', 'u.weeklyhours'=>'user',
- 'u.dateemployment'=>'user', 'u.dateemploymentend'=>'user', 'u.salary'=>'user', 'u.color'=>'user', 'u.api_key'=>'user',
- 'u.birth'=>'user',
- 'u.datec'=>"user", 'u.tms'=>"user",
- 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
- 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member",
- 'a.firstname'=>"member", 'a.lastname'=>"member",
- 'g.nom'=>"Group"
+ 'u.rowid' => "user", 'u.login' => "user", 'u.lastname' => "user", 'u.firstname' => "user", 'u.employee' => 'user', 'u.job' => 'user', 'u.gender' => 'user',
+ 'u.accountancy_code' => 'user',
+ 'u.address' => "user", 'u.zip' => "user", 'u.town' => "user",
+ 'u.office_phone' => 'user', 'u.user_mobile' => 'user', 'u.office_fax' => 'user',
+ 'u.email' => 'user', 'u.note_public' => "user", 'u.note_private' => "user", 'u.signature' => 'user',
+ 'u.fk_user' => 'user', 'u.thm' => 'user', 'u.tjm' => 'user', 'u.weeklyhours' => 'user',
+ 'u.dateemployment' => 'user', 'u.dateemploymentend' => 'user', 'u.salary' => 'user', 'u.color' => 'user', 'u.api_key' => 'user',
+ 'u.birth' => 'user',
+ 'u.datec' => "user", 'u.tms' => "user",
+ 'u.admin' => "user", 'u.statut' => 'user', 'u.datelastlogin' => 'user', 'u.datepreviouslogin' => 'user',
+ 'u.fk_socpeople' => "contact", 'u.fk_soc' => "company", 'u.fk_member' => "member",
+ 'a.firstname' => "member", 'a.lastname' => "member",
+ 'g.nom' => "Group"
);
$keyforselect = 'user';
$keyforelement = 'user';
@@ -279,28 +280,28 @@ class modUser extends DolibarrModules
$this->export_label[$r] = 'List of security events'; // Translation key (used only if key ExportDataset_user_2 not found)
$this->export_permission[$r] = array(array("user")); // Only admin
$this->export_fields_array[$r] = array(
- 'e.rowid'=>"Id", 'e.type'=>"Type",
- 'e.dateevent'=>"Date",
- 'e.description'=>'Description',
- 'e.ip'=>'IPAddress', 'e.user_agent'=>'UserAgent',
+ 'e.rowid' => "Id", 'e.type' => "Type",
+ 'e.dateevent' => "Date",
+ 'e.description' => 'Description',
+ 'e.ip' => 'IPAddress', 'e.user_agent' => 'UserAgent',
'e.authentication_method' => 'AuthenticationMode',
- 'e.fk_user'=>"UserID", 'u.login'=>"Login",
+ 'e.fk_user' => "UserID", 'u.login' => "Login",
);
$this->export_TypeFields_array[$r] = array(
- 'e.rowid'=>'Numeric', 'e.type'=>"Text",
- 'e.dateevent'=>"Date",
- 'e.description'=>'Text',
- 'e.ip'=>'Text', 'e.user_agent'=>'Text',
+ 'e.rowid' => 'Numeric', 'e.type' => "Text",
+ 'e.dateevent' => "Date",
+ 'e.description' => 'Text',
+ 'e.ip' => 'Text', 'e.user_agent' => 'Text',
'e.authentication_method' => 'Text',
- 'e.fk_user'=>"Numeric", 'u.login'=>"Text",
+ 'e.fk_user' => "Numeric", 'u.login' => "Text",
);
$this->export_entities_array[$r] = array(
- 'e.rowid'=>'securityevent', 'e.type'=>"securityevent",
- 'e.dateevent'=>"securityevent",
- 'e.description'=>'securityevent',
- 'e.ip'=>'securityevent', 'e.user_agent'=>'securityevent',
+ 'e.rowid' => 'securityevent', 'e.type' => "securityevent",
+ 'e.dateevent' => "securityevent",
+ 'e.description' => 'securityevent',
+ 'e.ip' => 'securityevent', 'e.user_agent' => 'securityevent',
'e.authentication_method' => 'securityevent',
- 'e.fk_user'=>"user", 'u.login'=>"user",
+ 'e.fk_user' => "user", 'u.login' => "user",
);
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'events as e';
@@ -317,22 +318,22 @@ class modUser extends DolibarrModules
$this->import_label[$r] = 'ImportDataset_user_1';
$this->import_icon[$r] = 'user';
$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
- $this->import_tables_array[$r] = array('u'=>MAIN_DB_PREFIX.'user', 'extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
+ $this->import_tables_array[$r] = array('u' => MAIN_DB_PREFIX.'user', 'extra' => MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r] = array(
- 'u.login'=>"Login*", 'u.lastname'=>"Name*", 'u.firstname'=>"Firstname", 'u.employee'=>"Employee*", 'u.job'=>"PostOrFunction", 'u.gender'=>"Gender",
- 'u.accountancy_code'=>"UserAccountancyCode",
- 'u.pass_crypted'=>"Password", 'u.admin'=>"Administrator", 'u.fk_soc'=>"Company*", 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town",
- 'u.fk_state'=>"StateId", 'u.fk_country'=>"CountryCode",
- 'u.office_phone'=>"Phone", 'u.user_mobile'=>"Mobile", 'u.office_fax'=>"Fax",
- 'u.email'=>"Email", 'u.note_public'=>"NotePublic", 'u.note_private'=>"NotePrivate", 'u.signature'=>'Signature',
- 'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours',
- 'u.dateemployment'=>'DateEmploymentStart', 'u.dateemploymentend'=>'DateEmploymentEnd', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey',
- 'u.birth'=>'DateOfBirth',
- 'u.datec'=>"DateCreation",
- 'u.statut'=>'Status'
+ 'u.login' => "Login*", 'u.lastname' => "Name*", 'u.firstname' => "Firstname", 'u.employee' => "Employee*", 'u.job' => "PostOrFunction", 'u.gender' => "Gender",
+ 'u.accountancy_code' => "UserAccountancyCode",
+ 'u.pass_crypted' => "Password", 'u.admin' => "Administrator", 'u.fk_soc' => "Company*", 'u.address' => "Address", 'u.zip' => "Zip", 'u.town' => "Town",
+ 'u.fk_state' => "StateId", 'u.fk_country' => "CountryCode",
+ 'u.office_phone' => "Phone", 'u.user_mobile' => "Mobile", 'u.office_fax' => "Fax",
+ 'u.email' => "Email", 'u.note_public' => "NotePublic", 'u.note_private' => "NotePrivate", 'u.signature' => 'Signature',
+ 'u.fk_user' => 'HierarchicalResponsible', 'u.thm' => 'THM', 'u.tjm' => 'TJM', 'u.weeklyhours' => 'WeeklyHours',
+ 'u.dateemployment' => 'DateEmploymentStart', 'u.dateemploymentend' => 'DateEmploymentEnd', 'u.salary' => 'Salary', 'u.color' => 'Color', 'u.api_key' => 'ApiKey',
+ 'u.birth' => 'DateOfBirth',
+ 'u.datec' => "DateCreation",
+ 'u.statut' => 'Status'
);
// Add extra fields
- $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'user' AND entity IN (0,".$conf->entity.")";
+ $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'user' AND entity IN (0,".((int) $conf->entity).")";
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
@@ -342,28 +343,28 @@ class modUser extends DolibarrModules
}
}
// End add extra fields
- $this->import_fieldshidden_array[$r] = array('u.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
+ $this->import_fieldshidden_array[$r] = array('u.fk_user_creat' => 'user->id', 'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'user'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r] = array(
- 'u.fk_state'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/cstate.class.php', 'class'=>'Cstate', 'method'=>'fetch', 'dict'=>'DictionaryState'),
- 'u.fk_country'=>array('rule'=>'fetchidfromcodeid', 'classfile'=>'/core/class/ccountry.class.php', 'class'=>'Ccountry', 'method'=>'fetch', 'dict'=>'DictionaryCountry'),
- 'u.salary'=>array('rule'=>'numeric')
+ 'u.fk_state' => array('rule' => 'fetchidfromcodeid', 'classfile' => '/core/class/cstate.class.php', 'class' => 'Cstate', 'method' => 'fetch', 'dict' => 'DictionaryState'),
+ 'u.fk_country' => array('rule' => 'fetchidfromcodeid', 'classfile' => '/core/class/ccountry.class.php', 'class' => 'Ccountry', 'method' => 'fetch', 'dict' => 'DictionaryCountry'),
+ 'u.salary' => array('rule' => 'numeric')
);
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r] = array(
- 'u.employee'=>'^[0|1]',
- 'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
- 'u.dateemployment'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
- 'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
+ 'u.employee' => '^[0|1]',
+ 'u.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
+ 'u.dateemployment' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
+ 'u.birth' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
);
$this->import_examplevalues_array[$r] = array(
- 'u.lastname'=>"Doe", 'u.firstname'=>'John', 'u.login'=>'jdoe', 'u.employee'=>'0 or 1', 'u.job'=>'CTO', 'u.gender'=>'man or woman',
- 'u.pass_crypted'=>'Encrypted password',
- 'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.address'=>"61 jump street",
- 'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102",
- 'u.email'=>"test@mycompany.com", 'u.salary'=>"10000", 'u.note_public'=>"This is an example of public note for record", 'u.note_private'=>"This is an example of private note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
- 'u.statut'=>"0 (closed) or 1 (active)",
+ 'u.lastname' => "Doe", 'u.firstname' => 'John', 'u.login' => 'jdoe', 'u.employee' => '0 or 1', 'u.job' => 'CTO', 'u.gender' => 'man or woman',
+ 'u.pass_crypted' => 'Encrypted password',
+ 'u.fk_soc' => '0 (internal user) or company name (external user)', 'u.address' => "61 jump street",
+ 'u.zip' => "123456", 'u.town' => "Big town", 'u.fk_country' => 'US, FR, DE...', 'u.office_phone' => "0101010101", 'u.office_fax' => "0101010102",
+ 'u.email' => "test@mycompany.com", 'u.salary' => "10000", 'u.note_public' => "This is an example of public note for record", 'u.note_private' => "This is an example of private note for record", 'u.datec' => "2015-01-01 or 2015-01-01 12:30:00",
+ 'u.statut' => "0 (closed) or 1 (active)",
);
- $this->import_updatekeys_array[$r] = array('u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>'Login');
+ $this->import_updatekeys_array[$r] = array('u.lastname' => 'Lastname', 'u.firstname' => 'Firstname', 'u.login' => 'Login');
}
diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php
index e785f0dd8d9..0acfb0a49ca 100644
--- a/htdocs/core/modules/propale/mod_propale_marbre.php
+++ b/htdocs/core/modules/propale/mod_propale_marbre.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2005-2008 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2024-2025 Frédéric France
- * Copyright (C) 2024-2025 MDW
+ * Copyright (C) 2024-2026 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -99,10 +99,10 @@ class mod_propale_marbre extends ModeleNumRefPropales
$max = '';
$posindice = strlen($this->prefix) + 6;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".((int) $posindice).") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."propal";
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
- $sql .= " AND entity = ".$conf->entity;
+ $sql .= " AND entity = ".((int) $conf->entity);
$resql = $db->query($sql);
if ($resql) {
@@ -135,7 +135,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
// First, we get the max value
$posindice = strlen($this->prefix) + 6;
- $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".((int) $posindice).") AS SIGNED)) as max"; // This is standard SQL
$sql .= " FROM ".MAIN_DB_PREFIX."propal";
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql .= " AND entity IN (".getEntity('proposalnumber', 1, $propal).")";
|