dolibarr  x.y.z
month_report.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2011 François Legastelois <flegastelois@teclib.com>
4  * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
5  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 // Load Dolibarr environment
28 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
34 
35 // Load translation files required by the page
36 $langs->loadLangs(array('holiday', 'hrm'));
37 
38 // Security check
39 $socid = 0;
40 $id = GETPOST('id', 'int');
41 
42 if ($user->socid > 0) { // Protection if external user
43  //$socid = $user->socid;
45 }
46 $result = restrictedArea($user, 'holiday', $id, '');
47 
48 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
49 $massaction = GETPOST('massaction', 'alpha');
50 $contextpage = GETPOST('contextpage', 'aZ');
51 $optioncss = GETPOST('optioncss', 'aZ');
52 
53 $search_ref = GETPOST('search_ref', 'alphanohtml');
54 $search_employee = GETPOST('search_employee', 'int');
55 $search_type = GETPOST('search_type', 'int');
56 $search_description = GETPOST('search_description', 'alphanohtml');
57 
58 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
59 $sortfield = GETPOST('sortfield', 'aZ09comma');
60 $sortorder = GETPOST('sortorder', 'aZ09comma');
61 
62 if (!$sortfield) {
63  $sortfield = "cp.rowid";
64 }
65 if (!$sortorder) {
66  $sortorder = "ASC";
67 }
68 
69 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
70 if (empty($page) || $page == -1) {
71  $page = 0;
72 }
73 
74 $hookmanager->initHooks(array('leavemovementlist'));
75 
76 $arrayfields = array();
77 $arrayofmassactions = array();
78 
79 /*
80  * Actions
81  */
82 
83 if (GETPOST('cancel', 'alpha')) {
84  $action = 'list'; $massaction = '';
85 }
86 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
87  $massaction = '';
88 }
89 
90 $parameters = array();
91 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
92 if ($reshook < 0) {
93  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
94 }
95 
96 if (empty($reshook)) {
97  // Selection of new fields
98  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
99 
100  // Purge search criteria
101  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
102  $search_ref = '';
103  $search_employee = '';
104  $search_type = '';
105  $search_description = '';
106  $toselect = array();
107  $search_array_options = array();
108  }
109 
110  if (GETPOST('button_removefilter_x', 'alpha')
111  || GETPOST('button_removefilter.x', 'alpha')
112  || GETPOST('button_removefilter', 'alpha')
113  || GETPOST('button_search_x', 'alpha')
114  || GETPOST('button_search.x', 'alpha')
115  || GETPOST('button_search', 'alpha')) {
116  $massaction = '';
117  }
118 }
119 
120 $arrayfields = array(
121  'cp.ref'=>array('label' => 'Ref', 'checked'=>1),
122  'cp.fk_user'=>array('label' => 'Employee', 'checked'=>1),
123  'cp.fk_type'=>array('label' => 'Type', 'checked'=>1),
124  'cp.date_debut'=>array('label' => 'DateDebCP', 'checked'=>1),
125  'cp.date_fin'=>array('label' => 'DateFinCP', 'checked'=>1),
126  'used_days'=>array('label' => 'NbUseDaysCPShort', 'checked'=>1),
127  'date_start_month'=>array('label' => 'DateStartInMonth', 'checked'=>1),
128  'date_end_month'=>array('label' => 'DateEndInMonth', 'checked'=>1),
129  'used_days_month'=>array('label' => 'NbUseDaysCPShortInMonth', 'checked'=>1),
130  'cp.description'=>array('label' => 'DescCP', 'checked'=>1),
131 );
132 
133 
134 /*
135  * View
136  */
137 
138 $form = new Form($db);
139 $formother = new FormOther($db);
140 $holidaystatic = new Holiday($db);
141 
142 $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
143 
144 $title = $langs->trans('CPTitreMenu');
145 
146 llxHeader('', $title);
147 
148 $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m", time());
149 $search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time());
150 $year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month);
151 
152 $sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday";
153 $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp";
154 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
155 $sql .= " WHERE cp.rowid > 0";
156 $sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED;
157 $sql .= " AND (";
158 $sql .= " (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
159 $sql .= " OR"; // For leave over several months
160 $sql .= " (date_format(cp.date_debut, '%Y-%m') < '".$db->escape($year_month)."' AND date_format(cp.date_fin, '%Y-%m') > '".$db->escape($year_month)."') ";
161 $sql .= " )";
162 if (!empty($search_ref)) {
163  $sql .= natural_search('cp.ref', $search_ref);
164 }
165 if (!empty($search_employee) && $search_employee > 0) {
166  $sql .= " AND cp.fk_user = ".((int) $search_employee);
167 }
168 if (!empty($search_type) && $search_type != '-1') {
169  $sql .= ' AND cp.fk_type IN ('.$db->sanitize($search_type).')';
170 }
171 if (!empty($search_description)) {
172  $sql .= natural_search('cp.description', $search_description);
173 }
174 
175 $sql .= $db->order($sortfield, $sortorder);
176 
177 $resql = $db->query($sql);
178 if (empty($resql)) {
179  dol_print_error($db);
180  exit;
181 }
182 
183 $num = $db->num_rows($resql);
184 
185 $param = '';
186 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
187  $param .= '&contextpage='.urlencode($contextpage);
188 }
189 if ($limit > 0 && $limit != $conf->liste_limit) {
190  $param .= '&limit='.urlencode($limit);
191 }
192 if (!empty($search_ref)) {
193  $param .= '&search_ref='.urlencode($search_ref);
194 }
195 if (!empty($search_employee)) {
196  $param .= '&search_employee='.urlencode($search_employee);
197 }
198 if (!empty($search_type)) {
199  $param .= '&search_type='.urlencode($search_type);
200 }
201 if (!empty($search_description)) {
202  $param .= '&search_description='.urlencode($search_description);
203 }
204 
205 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
206 if ($optioncss != '') {
207  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
208 }
209 print '<input type="hidden" name="token" value="'.newToken().'">';
210 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
211 print '<input type="hidden" name="action" value="list">';
212 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
213 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
214 print '<input type="hidden" name="page" value="'.$page.'">';
215 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
216 
217 print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm');
218 
219 // Selection filter
220 print '<div class="tabBar">';
221 print $formother->select_month($search_month, 'remonth', 0, 0, 'minwidth50 maxwidth75imp valignmiddle', true);
222 print $formother->selectyear($search_year, 'reyear', 0, 10, 5, 0, 0, '', 'valignmiddle width75', true);
223 print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Search")).'" />';
224 print '</div>';
225 print '<br>';
226 
227 $moreforfilter = '';
228 
229 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
230 $selectedfields = '';
231 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
232 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
233 
234 print '<div class="div-table-responsive">';
235 print '<table class="noborder centpercent">';
236 
237 print '<tr class="liste_titre">';
238 
239 // Filter: Ref
240 if (!empty($arrayfields['cp.ref']['checked'])) {
241  print '<td class="liste_titre">';
242  print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
243  print '</td>';
244 }
245 
246 // Filter: Employee
247 if (!empty($arrayfields['cp.fk_user']['checked'])) {
248  print '<td class="liste_titre">';
249  print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth100');
250  print '</td>';
251 }
252 
253 // Filter: Type
254 if (!empty($arrayfields['cp.fk_type']['checked'])) {
255  $typeleaves = $holidaystatic->getTypes(1, -1);
256  $arraytypeleaves = array();
257  foreach ($typeleaves as $key => $val) {
258  $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
259  $arraytypeleaves[$val['rowid']] = $labeltoshow;
260  }
261 
262  print '<td class="liste_titre">';
263  print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1);
264  print '</td>';
265 }
266 
267 if (!empty($arrayfields['cp.date_debut']['checked'])) {
268  print '<td class="liste_titre"></td>';
269 }
270 if (!empty($arrayfields['cp.date_fin']['checked'])) {
271  print '<td class="liste_titre"></td>';
272 }
273 if (!empty($arrayfields['used_days']['checked'])) {
274  print '<td class="liste_titre"></td>';
275 }
276 if (!empty($arrayfields['date_start_month']['checked'])) {
277  print '<td class="liste_titre"></td>';
278 }
279 if (!empty($arrayfields['date_end_month']['checked'])) {
280  print '<td class="liste_titre"></td>';
281 }
282 if (!empty($arrayfields['used_days_month']['checked'])) {
283  print '<td class="liste_titre"></td>';
284 }
285 
286 // Filter: Description
287 if (!empty($arrayfields['cp.description']['checked'])) {
288  print '<td class="liste_titre">';
289  print '<input type="text" class="maxwidth100" name="search_description" value="'.$search_description.'">';
290  print '</td>';
291 }
292 
293 // Action column
294 print '<td class="liste_titre maxwidthsearch">';
295 $searchpicto = $form->showFilterButtons();
296 print $searchpicto;
297 print '</td>';
298 print '</tr>';
299 
300 print '<tr class="liste_titre">';
301 if (!empty($arrayfields['cp.ref']['checked'])) {
302  print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder);
303 }
304 if (!empty($arrayfields['cp.fk_user']['checked'])) {
305  print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder);
306 }
307 if (!empty($arrayfields['cp.fk_type']['checked'])) {
308  print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder);
309 }
310 if (!empty($arrayfields['ct.label']['checked'])) {
311  print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder);
312 }
313 if (!empty($arrayfields['cp.date_debut']['checked'])) {
314  print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], 'cp.date_debut', '', '', '', $sortfield, $sortorder, 'center ');
315 }
316 if (!empty($arrayfields['cp.date_fin']['checked'])) {
317  print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], 'cp.date_fin', '', '', '', $sortfield, $sortorder, 'center ');
318 }
319 if (!empty($arrayfields['used_days']['checked'])) {
320  print_liste_field_titre($arrayfields['used_days']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidth125 right ');
321 }
322 if (!empty($arrayfields['date_start_month']['checked'])) {
323  print_liste_field_titre($arrayfields['date_start_month']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center ');
324 }
325 if (!empty($arrayfields['date_end_month']['checked'])) {
326  print_liste_field_titre($arrayfields['date_end_month']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center ');
327 }
328 if (!empty($arrayfields['used_days_month']['checked'])) {
329  print_liste_field_titre($arrayfields['used_days_month']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidth125 right ');
330 }
331 if (!empty($arrayfields['cp.description']['checked'])) {
332  print_liste_field_titre($arrayfields['cp.description']['label'], $_SERVER["PHP_SELF"], 'cp.description', '', '', '', $sortfield, $sortorder);
333 }
334 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
335 print '</tr>';
336 
337 if ($num == 0) {
338  print '<tr><td colspan="11" class="opacitymedium">'.$langs->trans('None').'</td></tr>';
339 } else {
340  while ($obj = $db->fetch_object($resql)) {
341  $user = new User($db);
342  $user->fetch($obj->fk_user);
343 
344  $date_start = $db->jdate($obj->date_debut, true);
345  $date_end = $db->jdate($obj->date_fin, true);
346 
347  $tmpstart = dol_getdate($date_start);
348  $tmpend = dol_getdate($date_end);
349 
350  $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning';
351  $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon';
352 
353  $halfdayinmonth = $obj->halfday;
354  $starthalfdayinmonth = $starthalfday;
355  $endhalfdayinmonth = $endhalfday;
356 
357  //0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
358 
359  // Set date_start_gmt and date_end_gmt that are date to show for the selected month
360  $date_start_inmonth = $db->jdate($obj->date_debut, true);
361  $date_end_inmonth = $db->jdate($obj->date_fin, true);
362  if ($tmpstart['year'] < $search_year || $tmpstart['mon'] < $search_month) {
363  $date_start_inmonth = dol_get_first_day($search_year, $search_month, true);
364  $starthalfdayinmonth = 'morning';
365  if ($halfdayinmonth == 2) {
366  $halfdayinmonth = 1;
367  }
368  if ($halfdayinmonth == -1) {
369  $halfdayinmonth = 0;
370  }
371  }
372  if ($tmpend['year'] > $search_year || $tmpend['mon'] > $search_month) {
373  $date_end_inmonth = dol_get_last_day($search_year, $search_month, true) - ((24 * 3600) - 1);
374  $endhalfdayinmonth = 'afternoon';
375  if ($halfdayinmonth == 2) {
376  $halfdayinmonth = -1;
377  }
378  if ($halfdayinmonth == 1) {
379  $halfdayinmonth = 0;
380  }
381  }
382 
383  // Leave request
384  $holidaystatic->id = $obj->rowid;
385  $holidaystatic->ref = $obj->ref;
386 
387  print '<tr class="oddeven">';
388 
389  if (!empty($arrayfields['cp.ref']['checked'])) {
390  print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1, 1).'</td>';
391  }
392  if (!empty($arrayfields['cp.fk_user']['checked'])) {
393  print '<td>'.$user->getFullName($langs).'</td>';
394  }
395  if (!empty($arrayfields['cp.fk_type']['checked'])) {
396  print '<td>'.$arraytypeleaves[$obj->fk_type].'</td>';
397  }
398 
399  if (!empty($arrayfields['cp.date_debut']['checked'])) {
400  print '<td class="center">'.dol_print_date($db->jdate($obj->date_debut), 'day');
401  print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
402  print '</td>';
403  }
404 
405  if (!empty($arrayfields['cp.date_fin']['checked'])) {
406  print '<td class="center">'.dol_print_date($db->jdate($obj->date_fin), 'day');
407  print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
408  print '</td>';
409  }
410 
411  if (!empty($arrayfields['used_days']['checked'])) {
412  print '<td class="right">'.num_open_day($date_start, $date_end, 0, 1, $obj->halfday).'</td>';
413  }
414 
415  if (!empty($arrayfields['date_start_month']['checked'])) {
416  print '<td class="center">'.dol_print_date($date_start_inmonth, 'day');
417  print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>';
418  print '</td>';
419  }
420 
421  if (!empty($arrayfields['date_end_month']['checked'])) {
422  print '<td class="center">'.dol_print_date($date_end_inmonth, 'day');
423  print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>';
424  print '</td>';
425  }
426 
427  if (!empty($arrayfields['used_days_month']['checked'])) {
428  print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>';
429  }
430  if (!empty($arrayfields['cp.description']['checked'])) {
431  print '<td class="maxwidth300 small">'.dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)).'</td>';
432  }
433 
434  print '<td></td>';
435  print '</tr>';
436  }
437 }
438 print '</table>';
439 print '</div>';
440 print '</form>';
441 
442 // End of page
443 llxFooter();
444 $db->close();
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class of the module paid holiday.
Class to manage Dolibarr users.
Definition: user.class.php:45
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:575
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:594
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.