33 require
'../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46 $action =
GETPOST(
'action',
'aZ09');
47 $cancel =
GETPOST(
'cancel',
'alpha');
48 $confirm =
GETPOST(
'confirm',
'alpha');
51 $fuserid = (
GETPOST(
'fuserid',
'int') ?
GETPOST(
'fuserid',
'int') : $user->id);
52 $users = (
GETPOST(
'users',
'array') ?
GETPOST(
'users',
'array') : array($user->id));
53 $groups =
GETPOST(
'groups',
'array');
54 $socid =
GETPOST(
'socid',
'int');
55 $autoValidation =
GETPOST(
'autoValidation',
'int');
56 $AutoSendMail =
GETPOST(
'AutoSendMail',
'int');
58 $langs->loadLangs(array(
"other",
"holiday",
"mails",
"trips"));
64 $childids = $user->getAllChildIds(1);
67 if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
68 $morefilter =
'AND employee = 1';
76 $extrafields->fetch_name_optionals_label($object->table_element);
78 if (($id > 0) || $ref) {
79 $object->fetch($id, $ref);
83 if (!empty($user->rights->holiday->readall)) {
86 if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
95 $hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
99 if (!empty($user->rights->holiday->write) && in_array($fuserid, $childids)) {
102 if (!empty($user->rights->holiday->writeall)) {
108 if (!empty($user->rights->holiday->delete)) {
111 if ($object->statut ==
Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) {
117 $socid = $user->socid;
119 $result =
restrictedArea($user,
'holiday', $object->id,
'holiday',
'',
'',
'rowid', $object->statut);
126 $parameters = array(
'socid' => $socid);
127 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
132 if (empty($reshook)) {
133 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
135 if (empty($backtopage) || ($cancel && empty($id))) {
136 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
137 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
138 $backtopage = $backurlforlist;
140 $backtopage = DOL_URL_ROOT.
'/holiday/card_group.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
146 if (!empty($backtopageforcancel)) {
147 header(
"Location: ".$backtopageforcancel);
149 } elseif (!empty($backtopage)) {
150 header(
"Location: ".$backtopage);
157 if ($action ==
'add') {
166 $users =
GETPOST(
'users',
'array');
167 $groups =
GETPOST(
'groups',
'array');
173 $starthalfday =
GETPOST(
'starthalfday');
174 $endhalfday =
GETPOST(
'endhalfday');
178 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
180 } elseif ($starthalfday ==
'afternoon') {
182 } elseif ($endhalfday ==
'morning') {
186 $approverid =
GETPOST(
'valideur',
'int');
187 $description = trim(
GETPOST(
'description',
'restricthtml'));
190 if (!$cancreateall) {
191 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
192 if (empty($user->rights->holiday->write)) {
195 } elseif (!in_array($fuserid, $childids)) {
201 if (empty($user->rights->holiday->write) && empty($user->rights->holiday->writeall_advance)) {
204 } elseif (empty($user->rights->holiday->writeall_advance) && !in_array($fuserid, $childids)) {
212 if (empty($groups) && empty($users)) {
213 setEventMessages($langs->trans(
"ErrorFieldRequiredUserOrGroup"),
null,
'errors');
221 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
227 if (empty($date_debut)) {
233 if (empty($date_fin)) {
239 if ($date_debut > $date_fin) {
246 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
247 if ($nbopenedday < 0.5) {
254 if ($approverid < 1) {
255 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
263 $TusersToProcess = array();
267 $sql =
' SELECT DISTINCT u.rowid,u.lastname,u.firstname from ' . MAIN_DB_PREFIX .
'user as u';
268 $sql .=
' LEFT JOIN ' . MAIN_DB_PREFIX .
'usergroup_user as ug on ug.fk_user = u.rowid ';
269 $sql .=
' WHERE fk_usergroup in (' .$db->sanitize(implode(
',', $groups)) .
')';
270 $resql = $db->query($sql);
273 while ($obj = $db->fetch_object(
$resql)) {
274 $TusersToProcess[$obj->rowid] = $obj->rowid;
278 if (is_array($users) && count($users) > 0) {
279 foreach ($users as $u) {
280 $TusersToProcess[$u] = $u;
283 foreach ($TusersToProcess as $u) {
285 $verifCP = $object->verifDateHolidayCP($u, $date_debut, $date_fin, $halfday);
289 $userError =
new User($db);
290 $result = $userError->fetch($u);
293 setEventMessages($langs->trans(
"UseralreadyCPexist", $userError->firstname .
' '. $userError->lastname),
null,
'errors');
306 foreach ($TusersToProcess as $u) {
308 $object->fk_user = $u;
309 $object->description = $description;
310 $object->fk_validator = $approverid;
311 $object->fk_type = $type;
312 $object->date_debut = $date_debut;
313 $object->date_fin = $date_fin;
314 $object->halfday = $halfday;
316 $result = $object->create($user);
323 if ($autoValidation) {
325 $htemp->fetch($result);
328 $resultValidated = $htemp->update($approverid);
330 if ($resultValidated < 0 ) {
336 if ($AutoSendMail && !$error) {
338 $returnSendMail = sendMail($result, $cancreate, $now, $autoValidation);
339 if (!empty($returnSendMail->msg))
setEventMessage($returnSendMail->msg, $returnSendMail->style);
348 header(
'Location: '.DOL_URL_ROOT.
'/holiday/list.php');
367 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
369 $title = $langs->trans(
'Leave');
374 if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
376 if ((in_array($fuserid, $childids) && empty($user->rights->holiday->writeall)) || (!in_array($fuserid, $childids) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)))) {
377 $errors[] = $langs->trans(
'CantCreateCP');
380 print
load_fiche_titre($langs->trans(
'MenuCollectiveAddCP'),
'',
'title_hrm.png');
386 $errors[] = $langs->trans(
'ErrorEndDateCP');
389 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
392 $errors[] = $langs->trans(
'CantCreateCP');
395 $errors[] = $langs->trans(
'InvalidValidatorCP');
398 $errors[] = $langs->trans(
'NoDateDebut');
401 $errors[] = $langs->trans(
'NoDateFin');
404 $errors[] = $langs->trans(
'ErrorDureeCP');
407 $errors[] = $langs->trans(
'alreadyCPexist');
415 print
'<script type="text/javascript">
416 $( document ).ready(function() {
418 if( $("input[name=autoValidation]").is(":checked") ){
419 $("#AutoSendMail").prop("disabled", false);
420 $("#AutoSendMail").prop("checked", true);
423 $("#AutoSendMail").prop("disabled", true);
424 $("#AutoSendMail").prop("checked", false);
427 $("input[name=autoValidation]").click( function(e) {
430 if( $("input[name=autoValidation]").is(":checked") ){
431 $("#AutoSendMail").prop("disabled", false);
432 $("#AutoSendMail").prop("checked", true);
434 $("#AutoSendMail").prop("disabled", true);
435 $("#AutoSendMail").prop("checked", false);
441 $("input.button-save").click("submit", function(e) {
442 console.log("Call valider()");
443 if (document.demandeCP.date_debut_.value != "")
445 if(document.demandeCP.date_fin_.value != "")
447 if(document.demandeCP.valideur.value != "-1") {
451 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
457 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
463 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
468 $("#autoValidation").change(function(){
469 if( $("input[name=autoValidation]").is(":checked") ){
470 $("#AutoSendMail").prop("disabled", false);
472 $("#AutoSendMail").prop("disabled", true);
473 $("#AutoSendMail").prop("checked", false);
481 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
482 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
483 print
'<input type="hidden" name="action" value="add" />'.
"\n";
487 print
'<table class="border centpercent">';
492 print
'<td class="titlefield fieldrequired">';
493 print
$form->textwithpicto($langs->trans(
"groups"), $langs->trans(
"fusionGroupsUsers"));
499 $sql =
' SELECT rowid, nom from '.MAIN_DB_PREFIX.
'usergroup ';
501 $resql = $db->query($sql);
503 while ($obj = $db->fetch_object(
$resql)) {
504 $Tgroup[$obj->rowid] = $obj->nom;
506 print
$form->multiselectarray(
'groups', $Tgroup,
GETPOST(
'groups',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
512 print
'<td class="titlefield fieldrequired">';
513 print
$form->textwithpicto($langs->trans(
"users"), $langs->trans(
"fusionGroupsUsers"));
516 $sql =
' SELECT DISTINCT u.rowid,u.lastname,u.firstname from '.MAIN_DB_PREFIX.
'user as u';
517 $sql .=
' WHERE 1=1 ';
518 $sql .= !empty($morefilter) ? $morefilter :
'';
520 $resql = $db->query($sql);
522 while ($obj = $db->fetch_object(
$resql)) {
523 $userlist[$obj->rowid] = $obj->firstname .
' '. $obj->lastname;
527 print
img_picto(
'',
'users') .
$form->multiselectarray(
'users', $userlist,
GETPOST(
'users',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
534 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
536 $typeleaves = $object->getTypes(1, -1);
537 $arraytypeleaves = array();
538 foreach ($typeleaves as $key => $val) {
539 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
540 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
541 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
543 print
$form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', true);
545 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
552 print
'<td class="fieldrequired">';
553 print
$form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
558 print
$form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
561 print
$form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
563 print
' ';
564 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
570 print
'<td class="fieldrequired">';
571 print
$form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
575 print
$form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
578 print
$form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
580 print
' ';
581 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
587 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
591 $include_users = $object->fetch_users_approver_holiday();
592 if (empty($include_users)) {
593 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
597 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
598 if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
599 $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR;
601 if (
GETPOST(
'valideur',
'int') > 0) {
602 $defaultselectuser =
GETPOST(
'valideur',
'int');
604 $s =
$form->select_dolusers($defaultselectuser,
"valideur", 1,
'', 0, $include_users,
'',
'0,'.$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
605 print
img_picto(
'',
'user').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
613 print
'<tr><td>'.$langs->trans(
"AutoValidationOnCreate").
'</td><td>';
614 print
'<input type="checkbox" id="autoValidation" name="autoValidation" value="1"'.($autoValidation ?
' checked="checked"' :
'').
'>';
615 print
'</td></tr>'.
"\n";
619 print
'<tr><td>'.$langs->trans(
"AutoSendMail").
'</td><td>';
620 print
'<input type="checkbox" id="AutoSendMail" name="AutoSendMail" value="1"'.($AutoSendMail ?
' checked="checked"' :
'').
'>';
621 print
'</td></tr>'.
"\n";
625 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
626 print
'<td class="tdtop">';
627 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->fckeditor->enabled) ?
false : $conf->fckeditor->enabled, ROWS_3,
'90%');
628 print $doleditor->Create(1);
632 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
639 print
$form->buttonsSaveCancel(
"SendRequestCollectiveCP");
641 print
'</from>'.
"\n";
645 print
'<div class="tabBar">';
647 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
655 if (is_object($db)) {
669 function sendMail($id, $cancreate, $now, $autoValidation)
671 $objStd =
new stdClass();
673 $objStd->status =
'success';
677 global $db, $user, $conf, $langs;
681 $result = $object->fetch($id);
690 $verif = $object->validate($user);
694 $destinataire =
new User($db);
695 $destinataire->fetch($object->fk_validator);
696 $emailTo = $destinataire->email;
700 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
703 $objStd->msg = $langs->trans(
'ErroremailTo');
704 $objStd->status =
'error';
705 $objStd->style=
"warnings";
710 $expediteur =
new User($db);
711 $expediteur->fetch($object->fk_user);
713 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
716 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
717 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
718 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
721 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
724 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
726 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
730 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY)) {
731 $delayForRequest = 0;
732 if ($delayForRequest) {
735 if ($object->date_debut < $nowplusdelay) {
736 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
742 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE)) {
743 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
745 if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
746 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
750 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
753 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
754 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Period").
" : ".
dol_print_date($object->date_debut,
'day').
" ".$langs->transnoentitiesnoconv(
"To").
" ".
dol_print_date($object->date_fin,
'day').
"</li>\n";
755 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
756 $message .=
"</ul>\n";
758 $trackid =
'leav'.$object->id;
760 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
763 $result = $mail->sendfile();
767 $objStd->msg = $langs->trans(
'ErroreSendmail');
768 $objStd->style=
"warnings";
769 $objStd->status =
'error';
771 $objStd->msg = $langs->trans(
'mailSended');
777 $objStd->msg = $langs->trans(
'ErroreVerif');
778 $objStd->status =
'error';
779 $objStd->style=
"errors";
785 $objStd->msg = $langs->trans(
'ErrorloadUserOnSendingMail');
786 $objStd->status =
'error';
787 $objStd->style=
"warnings";
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage a WYSIWYG editor.
Class of the module paid holiday.
const STATUS_VALIDATED
Validated status.
const STATUS_DRAFT
Draft status.
Class to manage Dolibarr users.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.