dolibarr 21.0.0-beta
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 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25// Load Dolibarr environment
26require '../../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29
38// Load translation files required by the page
39$langs->loadLangs(array('admin', 'hrm'));
40
41// Get Parameters
42$action = GETPOST('action', 'aZ09');
43
44// Other parameters HRM_*
45$list = array(
46// 'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example
47);
48
49// Permissions
50$permissiontoread = $user->admin;
51$permissiontoadd = $user->admin;
52
53// Security check - Protection if external user
54//if ($user->socid > 0) accessforbidden();
55//if ($user->socid > 0) $socid = $user->socid;
56//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
57//restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', 0);
58if (!isModEnabled('hrm')) {
60}
61if (empty($permissiontoread)) {
63}
64
65
66/*
67 * Actions
68 */
69
70if ($action == 'update') {
71 $error = 0;
72
73 foreach ($list as $constname) {
74 $constvalue = GETPOST($constname, 'alpha');
75
76 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
77 $error++;
78 }
79 }
80
81 if (!$error) {
82 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
83 } else {
84 setEventMessages($langs->trans("Error"), null, 'errors');
85 }
86}
87
88
89/*
90 * View
91 */
92
93
94$title = $langs->trans('Parameters');
95
96llxHeader('', $title, '');
97
98$form = new Form($db);
99
101
102// Subheader
103$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
104print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
105
106// Configuration header
107$head = hrm_admin_prepare_head();
108
109print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
110print '<input type="hidden" name="token" value="'.newToken().'">';
111print '<input type="hidden" name="action" value="update">';
112
113print dol_get_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user");
114
115print '<table class="noborder centpercent">';
116print '<tr class="liste_titre">';
117print '<td colspan="3">'.$langs->trans('Parameters').'</td>';
118print "</tr>\n";
119
120foreach ($list as $key) {
121 print '<tr class="oddeven value">';
122
123 // Param
124 $label = $langs->trans($key);
125 print '<td width="50%"><label for="'.$key.'">'.$label.'</label></td>';
126
127 // Value
128 print '<td>';
129 print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
130 print '</td></tr>';
131}
132
133print "</table>\n";
134
135print dol_get_fiche_end();
136
137print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
138
139print '</form>';
140
141// End of page
142llxFooter();
143$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).
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:71
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:68
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.