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