dolibarr 23.0.3
admin_hrm.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30
39// Load translation files required by the page
40$langs->loadLangs(array('admin', 'hrm'));
41
42// Get Parameters
43$action = GETPOST('action', 'aZ09');
44
45// Other parameters HRM_*
46$list = array(
47// 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example
48);
49
50// Permissions
51$permissiontoread = $user->admin;
52$permissiontoadd = $user->admin;
53
54// Security check - Protection if external user
55//if ($user->socid > 0) accessforbidden();
56//if ($user->socid > 0) $socid = $user->socid;
57//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
58//restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', 0);
59if (!isModEnabled('hrm')) {
61}
62if (empty($permissiontoread)) {
64}
65
66
67/*
68 * Actions
69 */
70
71if ($action == 'update') {
72 $error = 0;
73
74 foreach ($list as $constname) { // @phan-suppress-current-line PhanEmptyForeach
75 $constvalue = GETPOST($constname, 'alpha');
76
77 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
78 $error++;
79 }
80 }
81
82 if (!$error) {
83 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
84 } else {
85 setEventMessages($langs->trans("Error"), null, 'errors');
86 }
87}
88
89
90/*
91 * View
92 */
93
94
95$title = $langs->trans('Parameters');
96
97llxHeader('', $title, '');
98
99$form = new Form($db);
100
102
103// Subheader
104$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
105
106print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
107
108// Configuration header
109$head = hrm_admin_prepare_head();
110
111print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
112print '<input type="hidden" name="token" value="'.newToken().'">';
113print '<input type="hidden" name="action" value="update">';
114
115print dol_get_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user");
116
117print '<table class="noborder centpercent">';
118print '<tr class="liste_titre">';
119print '<td colspan="3">'.$langs->trans('Parameters').'</td>';
120print "</tr>\n";
121
122foreach ($list as $key) { // @phan-suppress-current-line PhanEmptyForeach
123 print '<tr class="oddeven value">';
124
125 // Param
126 $label = $langs->trans($key);
127 print '<td width="50%"><label for="'.$key.'">'.$label.'</label></td>';
128
129 // Value
130 print '<td>';
131 print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
132 print '</td></tr>';
133}
134
135print "</table>\n";
136
137print dol_get_fiche_end();
138
139print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
140
141print '</form>';
142
143// End of page
144llxFooter();
145$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
hrm_admin_prepare_head()
Return array head with list of tabs to view object information.
Definition hrm.lib.php:69
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.