dolibarr  7.0.0-beta
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 $langs->load("admin");
32 $langs->load("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_ACCOUNTING_ACCOUNT_PAYMENT',
43  'SALARIES_ACCOUNTING_ACCOUNT_CHARGE'
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  }
66  else
67  {
68  setEventMessages($langs->trans("Error"), null, 'errors');
69  }
70 }
71 
72 /*
73  * View
74  */
75 
76 llxHeader('',$langs->trans('SalariesSetup'));
77 
78 $form = new Form($db);
79 if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
80 
81 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
82 print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup');
83 
84 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
85 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
86 print '<input type="hidden" name="action" value="update">';
87 
88 //dol_fiche_head(null, '', '', -1);
89 
90 /*
91  * Params
92  */
93 print '<table class="noborder" width="100%">';
94 print '<tr class="liste_titre">';
95 print '<td colspan="3">' . $langs->trans('Options') . '</td>';
96 print "</tr>\n";
97 
98 foreach ($list as $key)
99 {
100 
101 
102  print '<tr class="oddeven value">';
103 
104  // Param
105  $label = $langs->trans($key);
106  print '<td><label for="'.$key.'">'.$label.'</label></td>';
107 
108  // Value
109  print '<td>';
110  if (! empty($conf->accounting->enabled))
111  {
112  print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
113  }
114  else
115  {
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 //dol_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 llxFooter();
132 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
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:485
if(empty($reshook)) $form
View.
Definition: perms.php:103
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.
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
Class to manage generation of HTML components for accounting management.