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