diff --git a/ChangeLog.md b/ChangeLog.md index 9e8ce88..2ba22c9 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,10 @@ # CHANGELOG MODULE TIMESHEETWEEK FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +## 1.0.4 +- Assure le chargement de la librairie admin Dolibarr avant l'appel à `dolibarr_set_const` dans le compteur FH. / Ensures the Dolibarr admin library loads before calling `dolibarr_set_const` in the FH counter. + ## 1.0.3 +- Corrige l'initialisation du compteur FH en chargeant les librairies Dolibarr adéquates. / Fixes FH counter initialisation by loading the appropriate Dolibarr libraries. - Sécurise les droits hiérarchiques pour lire, créer, modifier, supprimer et valider les feuilles des seuls collaborateurs gérés. / Secures hierarchy rights to read, create, update, delete and validate only managed employees' timesheets. - Restreint la liste hebdomadaire aux salariés autorisés et ajoute des filtres compatibles Multicompany. / Restricts the weekly list to authorised employees and adds Multicompany-compatible filters. - Limite le filtre salarié aux collaborateurs visibles par l'utilisateur et respecte le périmètre Multicompany. / Limits the employee filter to collaborators visible to the user and honours the Multicompany scope. diff --git a/core/modules/modTimesheetWeek.class.php b/core/modules/modTimesheetWeek.class.php index d14fe35..055709b 100644 --- a/core/modules/modTimesheetWeek.class.php +++ b/core/modules/modTimesheetWeek.class.php @@ -80,8 +80,8 @@ public function __construct($db) $this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@timesheetweek' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' - $this->version = '1.0.3'; // EN: Bump module version to ship hierarchy permission fixes. - // FR: Incrémente la version du module pour livrer les correctifs de permissions hiérarchiques. + $this->version = '1.0.4'; // EN: Release FH counter fix ensuring Dolibarr admin library loads. + // FR: Publie la correction du compteur FH en garantissant le chargement de la librairie admin Dolibarr. // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; diff --git a/core/modules/timesheetweek/mod_timesheetweek_fhweekly.php b/core/modules/timesheetweek/mod_timesheetweek_fhweekly.php index 5fc52ee..435c4d0 100644 --- a/core/modules/timesheetweek/mod_timesheetweek_fhweekly.php +++ b/core/modules/timesheetweek/mod_timesheetweek_fhweekly.php @@ -1,10 +1,14 @@ + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU GPL v3 or later. */ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; /** * Numbering module for TimesheetWeek @@ -57,11 +61,11 @@ public function getNextValue($object) $year = (int) $object->year; $week = (int) $object->week; - // fallback si non renseigné + // EN: Fallback to current year and week when missing. FR: Repli sur l'année et la semaine courantes si absentes. if (empty($year) || empty($week)) { - $ts = dol_now(); - $year = (int) dol_print_date($ts, '%Y'); - $week = (int) dol_print_date($ts, '%W'); // ISO week number + $ts = dol_now(); + $year = (int) dol_print_date($ts, '%Y'); + $week = (int) dol_print_date($ts, '%W'); // ISO week number } $key = 'TIMESHEETWEEK_FHWEEKLY_COUNTER_'.$entity.'_'.$year; @@ -71,6 +75,7 @@ public function getNextValue($object) $current = (int) getDolGlobalInt($key, 0); $next = $current + 1; + // EN: Persist the counter in Dolibarr constants per entity. FR: Persiste le compteur dans les constantes Dolibarr par entité. $res = dolibarr_set_const($db, $key, $next, 'integer', 0, '', $entity); if ($res <= 0) { $db->rollback();