diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index cb5a7f41f8f..818cbca264d 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2008-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2022 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 @@ -362,7 +363,11 @@ function show_array_last_actions_done($max = 5) */ function agenda_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('actioncomm'); + $h = 0; $head = array(); @@ -395,6 +400,10 @@ function agenda_prepare_head() $head[$h][0] = DOL_URL_ROOT."/admin/agenda_extrafields.php"; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = is_countable($extrafields->attributes['actioncomm']['label']) ? count($extrafields->attributes['actioncomm']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; diff --git a/htdocs/hrm/lib/hrm.lib.php b/htdocs/hrm/lib/hrm.lib.php index 508cbef22fd..a571231c143 100644 --- a/htdocs/hrm/lib/hrm.lib.php +++ b/htdocs/hrm/lib/hrm.lib.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2022 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 @@ -21,7 +22,7 @@ /** * \file hrm/lib/hrm.lib.php - * \ingroup hr + * \ingroup hrm * \brief Library files with common functions for Workstation */ @@ -32,10 +33,15 @@ */ function hrmAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $db; $langs->load("hrm"); + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('hrm_evaluation'); + $extrafields->fetch_name_optionals_label('hrm_job'); + $extrafields->fetch_name_optionals_label('hrm_skill'); + $h = 0; $head = array(); $head[$h][0] = DOL_URL_ROOT . "/admin/hrm.php"; @@ -43,37 +49,37 @@ function hrmAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php'; - $head[$h][1] = $langs->trans("Establishments"); - $head[$h][2] = 'establishments'; - $h++; - - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; - $head[$h][1] = $langs->trans("EvaluationsExtraFields"); - $head[$h][2] = 'evaluationsAttributes'; - $h++; - - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php'; - $head[$h][1] = $langs->trans("JobsExtraFields"); - $head[$h][2] = 'jobsAttributes'; - $h++; - - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; - $head[$h][1] = $langs->trans("SkillsExtraFields"); - $head[$h][2] = 'skillsAttributes'; - $h++; - - /* - $head[$h][0] = dol_buildpath("/workstation/admin/myobject_extrafields.php", 1); - $head[$h][1] = $langs->trans("ExtraFields"); - $head[$h][2] = 'myobject_extrafields'; + $head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php'; + $head[$h][1] = $langs->trans("Establishments"); + $head[$h][2] = 'establishments'; $h++; - */ - /*$head[$h][0] = require_once "/admin/about.php"; - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++;*/ + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; + $head[$h][1] = $langs->trans("EvaluationsExtraFields"); + $nbExtrafields = is_countable($extrafields->attributes['hrm_evaluation']['label']) ? count($extrafields->attributes['hrm_evaluation']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } + $head[$h][2] = 'evaluationsAttributes'; + $h++; + + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php'; + $head[$h][1] = $langs->trans("JobsExtraFields"); + $nbExtrafields = is_countable($extrafields->attributes['hrm_job']['label']) ? count($extrafields->attributes['hrm_job']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } + $head[$h][2] = 'jobsAttributes'; + $h++; + + $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; + $head[$h][1] = $langs->trans("SkillsExtraFields"); + $nbExtrafields = is_countable($extrafields->attributes['hrm_skill']['label']) ? count($extrafields->attributes['hrm_skill']['label']) : 0; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } + $head[$h][2] = 'skillsAttributes'; + $h++; // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -85,7 +91,7 @@ function hrmAdminPrepareHead() //); // to remove a tab complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin'); - complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove'); return $head; }