dolibarr  9.0.0
salaries.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2014-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  */
18 
25 require '../main.inc.php';
26 
27 // Class
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array('admin', 'salaries'));
33 
34 // Security check
35 if (!$user->admin)
37 
38 $action = GETPOST('action', 'alpha');
39 
40 // Other parameters SALARIES_*
41 $list = array (
42  'SALARIES_XXX',
43 );
44 
45 /*
46  * Actions
47  */
48 
49 if ($action == 'update')
50 {
51  $error = 0;
52 
53  foreach ($list as $constname) {
54  $constvalue = GETPOST($constname, 'alpha');
55 
56  if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
57  $error++;
58  }
59  }
60 
61  if (! $error)
62  {
63  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
64  }
65  else
66  {
67  setEventMessages($langs->trans("Error"), null, 'errors');
68  }
69 }
70 
71 /*
72  * View
73  */
74 
75 llxHeader('',$langs->trans('SalariesSetup'));
76 
77 $form = new Form($db);
78 if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
79 
80 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
81 print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup');
82 
83 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
84 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
85 print '<input type="hidden" name="action" value="update">';
86 
87 //dol_fiche_head(null, '', '', -1);
88 
89 /*
90  * Params
91  */
92 print '<table class="noborder" width="100%">';
93 print '<tr class="liste_titre">';
94 print '<td colspan="3">' . $langs->trans('Options') . '</td>';
95 print "</tr>\n";
96 
97 foreach ($list as $key)
98 {
99 
100 
101  print '<tr class="oddeven value">';
102 
103  // Param
104  $label = $langs->trans($key);
105  print '<td><label for="'.$key.'">'.$label.'</label></td>';
106 
107  // Value
108  print '<td>';
109  if (! empty($conf->accounting->enabled))
110  {
111  print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
112  }
113  else
114  {
115  print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
116  }
117  print '</td></tr>';
118 }
119 
120 print '</tr>';
121 
122 print "</table>\n";
123 
124 //dol_fiche_end();
125 
126 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
127 
128 print '</form>';
129 
130 // End of page
131 llxFooter();
132 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
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:510
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.
llxHeader()
Empty header.
Definition: wrapper.php:44
Class to manage generation of HTML components for accounting management.