dolibarr  13.0.2
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 
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 // Load translation files required by the page
28 $langs->loadLangs(array('admin', 'hrm'));
29 
30 if (!$user->admin)
32 
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 /*
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 /*
63  * View
64  */
65 
66 llxHeader('', $langs->trans('Parameters'));
67 
68 $form = new Form($db);
69 
70 dol_htmloutput_mesg($mesg);
71 
72 // Subheader
73 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
74 print load_fiche_titre($langs->trans("HRMSetup"), $linkback);
75 
76 // Configuration header
77 $head = hrm_admin_prepare_head();
78 
79 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
80 print '<input type="hidden" name="token" value="'.newToken().'">';
81 print '<input type="hidden" name="action" value="update">';
82 
83 print dol_get_fiche_head($head, 'parameters', $langs->trans("HRM"), -1, "user");
84 
85 print '<table class="noborder centpercent">';
86 print '<tr class="liste_titre">';
87 print '<td colspan="3">'.$langs->trans('Parameters').'</td>';
88 print "</tr>\n";
89 
90 foreach ($list as $key) {
91  $var = !$var;
92 
93  print '<tr '.$bc[$var].' class="value">';
94 
95  // Param
96  $label = $langs->trans($key);
97  print '<td width="50%"><label for="'.$key.'">'.$label.'</label></td>';
98 
99  // Value
100  print '<td>';
101  print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
102  print '</td></tr>';
103 }
104 
105 print "</table>\n";
106 
107 print dol_get_fiche_end();
108 
109 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
110 
111 print '</form>';
112 
113 // End of page
114 llxFooter();
115 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
hrm_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: hrm.lib.php:65
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:575
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_htmloutput_mesg($mesgstring= '', $mesgarray=array(), $style= 'ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
print
Draft customers invoices.
Definition: index.php:89
dol_get_fiche_end($notab=0)
Return tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59