From b09cfab2712def94a1ac62f86e0c9a2127c4a9eb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 29 Aug 2025 17:19:36 +0200 Subject: [PATCH 1/5] PHPStan > Update baseline (#35134) Co-authored-by: Dolibot --- dev/build/phpstan/phpstan-baseline.neon | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 69598de2dbb..468cfb9ff03 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -11922,12 +11922,6 @@ parameters: count: 4 path: ../../../htdocs/eventorganization/core/actions_massactions_mail.inc.php - - - message: '#^Variable \$object might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/eventorganization/tpl/linkedobjectblock.tpl.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -15576,12 +15570,6 @@ parameters: count: 2 path: ../../../htdocs/mrp/mo_production.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/mrp/tpl/linkedobjectblock.tpl.php - - message: '#^Parameter \#1 \$object of method MultiCurrencies\:\:_cleanObjectDatasRate\(\) expects MultiCurrency, CurrencyRate given\.$#' identifier: argument.type From 96130d756227d34ed93c2c7abb818b7c359576d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Aug 2025 17:20:20 +0200 Subject: [PATCH 2/5] wip workstation tms (#35126) * wip workstation tms * wip workstation tms * setup * setup * setup * setup * setup --- htdocs/admin/workstation_extrafields.php | 117 ++++++++++++++++++ .../llx_asset_extrafields-asset.key.sql | 2 +- ...orkstation_extrafields-workstation.key.sql | 19 +++ ...on_workstation_extrafields-workstation.sql | 27 ++++ .../workstation/class/workstation.class.php | 24 ++-- htdocs/workstation/lib/workstation.lib.php | 24 ++-- htdocs/workstation/workstation_card.php | 8 +- 7 files changed, 187 insertions(+), 34 deletions(-) create mode 100644 htdocs/admin/workstation_extrafields.php create mode 100644 htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.key.sql create mode 100644 htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.sql diff --git a/htdocs/admin/workstation_extrafields.php b/htdocs/admin/workstation_extrafields.php new file mode 100644 index 00000000000..c05423c18c0 --- /dev/null +++ b/htdocs/admin/workstation_extrafields.php @@ -0,0 +1,117 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2024-2025 Frédéric France + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/modulebuilder/template/admin/workstation_extrafields.php + * \ingroup workstation + * \brief Page to setup extra fields of workstation + */ + +// Load Dolibarr environment +require "../main.inc.php"; + +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/workstation/lib/workstation.lib.php'; + +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + +// Load translation files required by the page +$langs->loadLangs(array('workstation', 'admin')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$type2label = ExtraFields::getListOfTypesLabels(); + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'workstation_workstation'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject = $langs->transnoentitiesnoconv("Workstation"); + +$help_url = ''; +$page_name = "WorkstationSetup"; + +llxHeader('', $langs->trans("WorkstationSetup"), $help_url, '', 0, 0, '', '', '', 'mod-workstation page-admin_extrafields'); + + +$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); + + +$head = workstationAdminPrepareHead(); + +print dol_get_fiche_head($head, 'workstation_extrafields', $langs->trans($page_name), -1, 'workstation'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +/* + * Creation of an optional field + */ +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql index 5671e2a5b9f..56341197eb7 100644 --- a/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql +++ b/htdocs/install/mysql/tables/llx_asset_extrafields-asset.key.sql @@ -1,5 +1,5 @@ -- =================================================================== --- Copyright (C) 2021 Frédéric France +-- Copyright (C) 2021 Frédéric France -- -- 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 diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.key.sql b/htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.key.sql new file mode 100644 index 00000000000..0f4e14def46 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.key.sql @@ -0,0 +1,19 @@ +-- =================================================================== +-- Copyright (C) 2025 Frédéric France +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + +ALTER TABLE llx_workstation_workstation_extrafields ADD INDEX idx_workstation_workstation_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.sql b/htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.sql new file mode 100644 index 00000000000..c5179a4561c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_workstation_workstation_extrafields-workstation.sql @@ -0,0 +1,27 @@ +-- =================================================================== +-- Copyright (C) 2025 Frédéric France +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. +-- =================================================================== +-- +-- Table for extrafields of workstation +-- + +create table llx_workstation_workstation_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 0e379369e3f..141c5b0f6ec 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2020 Gauthier VERDOL - * Copyright (C) 2023-2024 Frédéric France +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2023-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -47,17 +47,6 @@ class Workstation extends CommonObject */ public $table_element = 'workstation_workstation'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int<0,1> Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for workstation. Must be the part after the 'object_' into object_workstation.png */ @@ -194,7 +183,7 @@ class Workstation extends CommonObject $this->db = $db; $this->ismultientitymanaged = 1; - $this->isextrafieldmanaged = 0; + $this->isextrafieldmanaged = 1; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; @@ -800,9 +789,10 @@ class Workstation extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; + $sql = 'SELECT t.rowid, t.date_creation as datec, GREATEST(t.tms, tef.tms) as datem,'; + $sql .= ' t.fk_user_creat, t.fk_user_modif'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.$this->table_element.'_extrafields as tef ON tef.fk_object=t.rowid'; $sql .= ' WHERE t.rowid = '.((int) $id); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/workstation/lib/workstation.lib.php b/htdocs/workstation/lib/workstation.lib.php index 086093daaab..915c6c6444b 100644 --- a/htdocs/workstation/lib/workstation.lib.php +++ b/htdocs/workstation/lib/workstation.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2020 Gauthier VERDOL + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify @@ -30,7 +30,10 @@ */ function workstationAdminPrepareHead() { - global $langs, $conf; + global $conf, $db, $langs; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('workstation_workstation'); $langs->load("workstation"); @@ -41,17 +44,14 @@ function workstationAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - /* - $head[$h][0] = dol_buildpath("/workstation/admin/myobject_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT."/admin/workstation_extrafields.php"; $head[$h][1] = $langs->trans("ExtraFields"); - $head[$h][2] = 'myobject_extrafields'; + $nbExtrafields = $extrafields->attributes['workstation_workstation']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } + $head[$h][2] = 'workstation_extrafields'; $h++; - */ - - /*$head[$h][0] = require_once "/admin/about.php"; - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++;*/ // Show more tabs from modules // Entries must be declared in modules descriptor with line diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index e357231ed96..302f6b08afe 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -91,7 +91,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu // Permissions $permissiontoread = $user->hasRight('workstation', 'workstation', 'read'); $permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->hasRight('workstation', 'workstation', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DISABLED); +$permissiontodelete = $user->hasRight('workstation', 'workstation', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == Workstation::STATUS_DISABLED); $permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_dellink.inc.php @@ -472,7 +472,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Disable / Enable if ($permissiontoadd) { - if ($object->status == $object::STATUS_ENABLED) { + if ($object->status == Workstation::STATUS_ENABLED) { print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); } else { print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd); From c567e55b5eca489091851b9c060895eca8c7b6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 30 Aug 2025 15:34:39 +0200 Subject: [PATCH 3/5] fetch greatest tms for members (#35133) * fetch greatest tms for members * fetch greatest tms for members --- htdocs/adherents/class/adherent.class.php | 6 ++++-- .../core/boxes/box_members_last_modified.php | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 76214e0b5e3..b92f93dfb38 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1463,7 +1463,7 @@ class Adherent extends CommonObject $sql .= " d.email, d.url, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql .= " d.datec as datec,"; - $sql .= " d.tms as datem,"; + $sql .= " GREATEST(d.tms, aef.tms) as datem,"; $sql .= " d.datefin as datefin, d.default_lang,"; $sql .= " d.birth as birthday,"; $sql .= " d.datevalid as datev,"; @@ -1475,6 +1475,7 @@ class Adherent extends CommonObject $sql .= " t.libelle as type, t.subscription as subscription,"; $sql .= " u.rowid as user_id, u.login as user_login"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as aef ON aef.fk_object = d.rowid'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member"; @@ -2973,9 +2974,10 @@ class Adherent extends CommonObject { $sql = 'SELECT a.rowid, a.datec as datec,'; $sql .= ' a.datevalid as datev,'; - $sql .= ' a.tms as datem,'; + $sql .= ' GREATEST(a.tms, aef.tms) as datem,'; $sql .= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod'; $sql .= ' FROM '.MAIN_DB_PREFIX.'adherent as a'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as aef ON aef.fk_object = a.rowid'; $sql .= ' WHERE a.rowid = '.((int) $id); dol_syslog(get_class($this)."::info", LOG_DEBUG); diff --git a/htdocs/core/boxes/box_members_last_modified.php b/htdocs/core/boxes/box_members_last_modified.php index c4a3fc27e7d..274fdbfb422 100644 --- a/htdocs/core/boxes/box_members_last_modified.php +++ b/htdocs/core/boxes/box_members_last_modified.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015-2025 Frédéric France + * Copyright (C) 2024 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 @@ -83,13 +83,15 @@ class box_members_last_modified extends ModeleBoxes if ($user->hasRight('adherent', 'lire')) { $sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,"; - $sql .= " a.datec, a.tms as datem, a.statut as status, a.datefin as date_end_subscription,"; + $sql .= " a.datec, GREATEST(a.tms, aef.tms) as datem, a.statut as status, a.datefin as date_end_subscription,"; $sql .= ' a.photo, a.email, a.gender, a.morphy,'; $sql .= " t.rowid as typeid, t.subscription, t.libelle as label"; - $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as aef ON aef.fk_object = a.rowid'; + $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE a.entity IN (".getEntity('member').")"; $sql .= " AND a.fk_adherent_type = t.rowid"; - $sql .= " ORDER BY a.tms DESC"; + $sql .= " ORDER BY datem DESC"; $sql .= $this->db->plimit($max, 0); $result = $this->db->query($sql); From b25814cb58f8cc24a4e06ff7508388e318973d02 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Sat, 30 Aug 2025 15:35:48 +0200 Subject: [PATCH 4/5] fix experimental intuitive select (#35131) --- .../experiments/intuitive-select/index.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/admin/tools/ui/experimental/experiments/intuitive-select/index.php b/htdocs/admin/tools/ui/experimental/experiments/intuitive-select/index.php index 0f141d15c58..2b32616f9f2 100644 --- a/htdocs/admin/tools/ui/experimental/experiments/intuitive-select/index.php +++ b/htdocs/admin/tools/ui/experimental/experiments/intuitive-select/index.php @@ -313,6 +313,9 @@ $form = new Form($db); }