diff --git a/htdocs/core/lib/admin_extrafields.lib.php b/htdocs/core/lib/admin_extrafields.lib.php index 18c8d2e4c45..38105250f4a 100644 --- a/htdocs/core/lib/admin_extrafields.lib.php +++ b/htdocs/core/lib/admin_extrafields.lib.php @@ -756,5 +756,38 @@ function getExtrafieldsAdminMap() 'helpurl' => '', 'langs' => array('companies', 'admin', 'members', 'interventions'), ), + 'hrm_skill' => array( + 'headfunction' => 'hrmAdminPrepareHead', + 'headfile' => 'hrm/lib/hrm.lib.php', + 'tabid' => 'skillsAttributes', + 'headlabel' => 'HrmSetup', + 'textobject' => 'Skills', + 'headpicto' => 'hrm', + 'title' => 'HrmSetup', + 'helpurl' => '', + 'langs' => array('hrm', 'admin'), + ), + 'hrm_job' => array( + 'headfunction' => 'hrmAdminPrepareHead', + 'headfile' => 'hrm/lib/hrm.lib.php', + 'tabid' => 'jobsAttributes', + 'headlabel' => 'HrmSetup', + 'textobject' => 'JobProfile', + 'headpicto' => 'hrm', + 'title' => 'HrmSetup', + 'helpurl' => '', + 'langs' => array('hrm', 'admin'), + ), + 'hrm_evaluation' => array( + 'headfunction' => 'hrmAdminPrepareHead', + 'headfile' => 'hrm/lib/hrm.lib.php', + 'tabid' => 'evaluationsAttributes', + 'headlabel' => 'HrmSetup', + 'textobject' => 'Evaluation', + 'headpicto' => 'hrm', + 'title' => 'HrmSetup', + 'helpurl' => '', + 'langs' => array('hrm', 'admin'), + ), ); } diff --git a/htdocs/hrm/admin/evaluation_extrafields.php b/htdocs/hrm/admin/evaluation_extrafields.php deleted file mode 100644 index 966fe877c82..00000000000 --- a/htdocs/hrm/admin/evaluation_extrafields.php +++ /dev/null @@ -1,118 +0,0 @@ - - * 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 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/hrm/admin/evaluation_extrafields.php - * \ingroup hrm - * \brief Page to setup extra fields of hrm evaluation - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once '../lib/hrm.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('hrm', 'admin')); - -$extrafields = new ExtraFields($db); -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -// Get Parameters -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'hrm_evaluation'; //Must be the $table_element of the class that manage extrafield - -// Security Check -if (!$user->admin) { - accessforbidden(); -} - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("Evaluation"); - -$help_url = ''; -$page_name = "HrmSetup"; - -llxHeader('', $langs->trans("HrmSetup"), $help_url); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); - - -$head = hrmAdminPrepareHead(); - -print dol_get_fiche_head($head, 'evaluationsAttributes', $langs->trans($page_name), -1, 'hrm'); - -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/hrm/admin/job_extrafields.php b/htdocs/hrm/admin/job_extrafields.php deleted file mode 100644 index b2260411f0b..00000000000 --- a/htdocs/hrm/admin/job_extrafields.php +++ /dev/null @@ -1,118 +0,0 @@ - - * 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 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/hrm/admin/job_extrafields.php - * \ingroup hrm - * \brief Page to setup extra fields of hrm jobs - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once '../lib/hrm.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('hrm', 'admin')); - -$extrafields = new ExtraFields($db); -$form = new Form($db); - -// List of supported format -$type2label = ExtraFields::getListOfTypesLabels(); - -// Get Parameters -$action = GETPOST('action', 'aZ09'); -$attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'hrm_job'; //Must be the $table_element of the class that manage extrafield - -// Security Check -if (!$user->admin) { - accessforbidden(); -} - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("JobProfile"); - -$help_url = ''; -$page_name = "HrmSetup"; - -llxHeader('', $langs->trans("Setup"), $help_url); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); - - -$head = hrmAdminPrepareHead(); - -print dol_get_fiche_head($head, 'jobsAttributes', $langs->trans($page_name), -1, 'hrm'); - -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/hrm/admin/skill_extrafields.php b/htdocs/hrm/admin/skill_extrafields.php deleted file mode 100644 index 76ba79ec66b..00000000000 --- a/htdocs/hrm/admin/skill_extrafields.php +++ /dev/null @@ -1,117 +0,0 @@ - - * 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 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/hrm/admin/skill_extrafields.php - * \ingroup hrm - * \brief Page to setup extra fields of hrm skills - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once '../lib/hrm.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('hrm', '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 = 'hrm_skill'; //Must be the $table_element of the class that manage extrafield - -// Security check -if (!$user->admin) { - accessforbidden(); -} - - -/* - * Actions - */ - -require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; - - - -/* - * View - */ - -$textobject = $langs->transnoentitiesnoconv("Skills"); - -$help_url = ''; -$page_name = "HrmSetup"; - -llxHeader('', $langs->trans("HrmSetup"), $help_url); - -$linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); - - -$head = hrmAdminPrepareHead(); - -print dol_get_fiche_head($head, 'skillsAttributes', $langs->trans($page_name), -1, 'hrm'); - -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/hrm/lib/hrm.lib.php b/htdocs/hrm/lib/hrm.lib.php index 0ec0fee78f3..4d8d071be74 100644 --- a/htdocs/hrm/lib/hrm.lib.php +++ b/htdocs/hrm/lib/hrm.lib.php @@ -54,7 +54,7 @@ function hrmAdminPrepareHead() $head[$h][2] = 'establishments'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/skill_extrafields.php'; + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'hrm_skill')); $head[$h][1] = $langs->trans("SkillsExtraFields"); $nbExtrafields = $extrafields->attributes['hrm_skill']['count']; if ($nbExtrafields > 0) { @@ -63,7 +63,7 @@ function hrmAdminPrepareHead() $head[$h][2] = 'skillsAttributes'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/job_extrafields.php'; + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'hrm_job')); $head[$h][1] = $langs->trans("JobsExtraFields"); $nbExtrafields = $extrafields->attributes['hrm_job']['count']; if ($nbExtrafields > 0) { @@ -72,7 +72,7 @@ function hrmAdminPrepareHead() $head[$h][2] = 'jobsAttributes'; $h++; - $head[$h][0] = DOL_URL_ROOT . '/hrm/admin/evaluation_extrafields.php'; + $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/admin/extrafields.php', array('elementtype' => 'hrm_evaluation')); $head[$h][1] = $langs->trans("EvaluationsExtraFields"); $nbExtrafields = $extrafields->attributes['hrm_evaluation']['count']; if ($nbExtrafields > 0) {