dolibarr  7.0.0-beta
admin_hrm.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
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 <http://www.gnu.org/licenses/>.
16  */
17 
23 require('../../main.inc.php');
24 require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php';
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
26 
27 $langs->load("admin");
28 $langs->load("hrm");
29 
30 if (! $user->admin)
32 
33 $action = GETPOST('action', 'alpha');
34 
35 // Other parameters HRM_*
36 $list = array (
37  'HRM_EMAIL_EXTERNAL_SERVICE' // To prevent your public accountant for example
38 );
39 
40 /*
41  * Actions
42  */
43 if ($action == 'update') {
44  $error = 0;
45 
46  foreach ($list as $constname) {
47  $constvalue = GETPOST($constname, 'alpha');
48 
49  if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
50  $error ++;
51  }
52  }
53 
54  if (! $error) {
55  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
56  } else {
57  setEventMessages($langs->trans("Error"), null, 'errors');
58  }
59 }
60 
61 /*
62  * View
63  */
64 llxHeader('', $langs->trans('Parameters'));
65 
66 $form = new Form($db);
67 
68 dol_htmloutput_mesg($mesg);
69 
70 // Subheader
71 $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
72 print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
73 
74 // Configuration header
75 $head = hrm_admin_prepare_head();
76 
77 print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
78 print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
79 print '<input type="hidden" name="action" value="update">';
80 
81 dol_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user");
82 
83 print '<table class="noborder" width="100%">';
84 print '<tr class="liste_titre">';
85 print '<td colspan="3">' . $langs->trans('Journaux') . '</td>';
86 print "</tr>\n";
87 
88 foreach ( $list as $key ) {
89  $var = ! $var;
90 
91  print '<tr ' . $bc[$var] . ' class="value">';
92 
93  // Param
94  $label = $langs->trans($key);
95  print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
96 
97  // Value
98  print '<td>';
99  print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
100  print '</td></tr>';
101 }
102 
103 print "</table>\n";
104 
105 dol_fiche_end();
106 
107 print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
108 
109 print '</form>';
110 
111 llxFooter();
112 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
hrm_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: hrm.lib.php:64
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
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).
Definition: admin.lib.php:485
if(empty($reshook)) $form
View.
Definition: perms.php:103
dol_htmloutput_mesg($mesgstring='', $mesgarray='', $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
dol_fiche_end($notab=0)
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
print
Draft customers invoices.
Definition: index.php:91