33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
43require_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);
68 $morefilter =
'AND employee = 1';
76$extrafields->fetch_name_optionals_label($object->table_element);
78if (($id > 0) || $ref) {
79 $object->fetch($id, $ref);
83 if ($user->hasRight(
'holiday',
'readall')) {
86 if ($user->hasRight(
'holiday',
'read') && in_array($object->fk_user, $childids)) {
95$hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
99if ($user->hasRight(
'holiday',
'write') && in_array($fuserid, $childids)) {
102if ($user->hasRight(
'holiday',
'writeall')) {
108if ($user->hasRight(
'holiday',
'delete')) {
111if ($object->statut ==
Holiday::STATUS_DRAFT && $user->hasRight(
'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);
132if (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) {
192 if (!$user->hasRight(
'holiday',
'write')) {
195 } elseif (!in_array($fuserid, $childids)) {
201 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall_advance')) {
204 } elseif (!$user->hasRight(
'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)) {
350 header(
'Location: '.DOL_URL_ROOT.
'/holiday/list.php');
366$form =
new Form($db);
369$listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
371$title = $langs->trans(
'Leave');
372$help_url =
'EN:Module_Holiday';
376if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
378 if ((in_array($fuserid, $childids) && !$user->hasRight(
'holiday',
'writeall')) || (!in_array($fuserid, $childids) && (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || !$user->hasRight(
'holiday',
'writeall_advance')))) {
379 $errors[] = $langs->trans(
'CantCreateCP');
382 print
load_fiche_titre($langs->trans(
'MenuCollectiveAddCP'),
'',
'title_hrm.png');
388 $errors[] = $langs->trans(
'ErrorEndDateCP');
391 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
394 $errors[] = $langs->trans(
'CantCreateCP');
397 $errors[] = $langs->trans(
'InvalidValidatorCP');
400 $errors[] = $langs->trans(
'NoDateDebut');
403 $errors[] = $langs->trans(
'NoDateFin');
406 $errors[] = $langs->trans(
'ErrorDureeCP');
409 $errors[] = $langs->trans(
'alreadyCPexist');
417 print
'<script type="text/javascript">
418 $( document ).ready(function() {
420 if( $("input[name=autoValidation]").is(":checked") ){
421 $("#AutoSendMail").prop("disabled", false);
422 $("#AutoSendMail").prop("checked", true);
425 $("#AutoSendMail").prop("disabled", true);
426 $("#AutoSendMail").prop("checked", false);
429 $("input[name=autoValidation]").click( function(e) {
432 if( $("input[name=autoValidation]").is(":checked") ){
433 $("#AutoSendMail").prop("disabled", false);
434 $("#AutoSendMail").prop("checked", true);
436 $("#AutoSendMail").prop("disabled", true);
437 $("#AutoSendMail").prop("checked", false);
443 $("input.button-save").click("submit", function(e) {
444 console.log("Call valider()");
445 if (document.demandeCP.date_debut_.value != "")
447 if(document.demandeCP.date_fin_.value != "")
449 if(document.demandeCP.valideur.value != "-1") {
453 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
459 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
465 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
470 $("#autoValidation").change(function(){
471 if( $("input[name=autoValidation]").is(":checked") ){
472 $("#AutoSendMail").prop("disabled", false);
474 $("#AutoSendMail").prop("disabled", true);
475 $("#AutoSendMail").prop("checked", false);
483 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
484 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
485 print
'<input type="hidden" name="action" value="add" />'.
"\n";
489 print
'<table class="border centpercent">';
494 print
'<td class="titlefield fieldrequired">';
495 print $form->textwithpicto($langs->trans(
"groups"), $langs->trans(
"fusionGroupsUsers"));
498 print
img_picto($langs->trans(
"groups"),
'group',
'class="pictofixedwidth"');
500 $sql =
' SELECT rowid, nom from '.MAIN_DB_PREFIX.
'usergroup WHERE entity IN ('.
getEntity(
'usergroup').
')';
501 $resql = $db->query($sql);
503 while ($obj = $db->fetch_object($resql)) {
504 $Tgroup[$obj->rowid] = $obj->nom;
507 print $form->multiselectarray(
'groups', $Tgroup,
GETPOST(
'groups',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
513 print
'<td class="titlefield fieldrequired">';
514 print $form->textwithpicto($langs->trans(
"users"), $langs->trans(
"fusionGroupsUsers"));
516 print
img_picto($langs->trans(
"users"),
'user',
'class="pictofixedwidth"');
518 $sql =
' SELECT u.rowid, u.lastname, u.firstname from '.MAIN_DB_PREFIX.
'user as u';
519 $sql .=
' WHERE 1=1';
520 $sql .= !empty($morefilter) ? $morefilter :
'';
522 $resql = $db->query($sql);
524 while ($obj = $db->fetch_object($resql)) {
529 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);
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, isModEnabled(
'fckeditor'), 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)" />';
669function sendMail($id, $cancreate, $now, $autoValidation)
673 $objStd->status =
'success';
677 global $db, $user, $conf, $langs;
681 $result = $object->fetch($id);
686 $object->oldcopy =
dol_clone($object, 2);
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;
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";
731 $delayForRequest = 0;
732 if ($delayForRequest) {
735 if ($object->date_debut < $nowplusdelay) {
736 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
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 $typeleaves = $object->getTypes(1, -1);
751 $labeltoshow = (($typeleaves[$object->fk_type][
'code'] && $langs->trans($typeleaves[$object->fk_type][
'code']) != $typeleaves[$object->fk_type][
'code']) ? $langs->trans($typeleaves[$object->fk_type][
'code']) : $typeleaves[$object->fk_type][
'label']);
753 if ($object->halfday == 2) {
754 $starthalfdaykey =
"Afternoon";
755 $endhalfdaykey =
"Morning";
756 } elseif ($object->halfday == -1) {
757 $starthalfdaykey =
"Afternoon";
758 $endhalfdaykey =
"Afternoon";
759 } elseif ($object->halfday == 1) {
760 $starthalfdaykey =
"Morning";
761 $endhalfdaykey =
"Morning";
762 } elseif ($object->halfday == 0 || $object->halfday == 2) {
763 $starthalfdaykey =
"Morning";
764 $endhalfdaykey =
"Afternoon";
767 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
770 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
771 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow).
"</li>\n";
772 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Period").
" : ".
dol_print_date($object->date_debut,
'day').
" ".$langs->transnoentitiesnoconv($starthalfdaykey).
" ".$langs->transnoentitiesnoconv(
"To").
" ".
dol_print_date($object->date_fin,
'day').
" ".$langs->transnoentitiesnoconv($endhalfdaykey).
"</li>\n";
773 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
774 $message .=
"</ul>\n";
776 $trackid =
'leav'.$object->id;
778 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
781 $result = $mail->sendfile();
785 $objStd->msg = $langs->trans(
'ErroreSendmail');
786 $objStd->style=
"warnings";
787 $objStd->status =
'error';
789 $objStd->msg = $langs->trans(
'mailSended');
795 $objStd->msg = $langs->trans(
'ErroreVerif');
796 $objStd->status =
'error';
797 $objStd->style=
"errors";
803 $objStd->msg = $langs->trans(
'ErrorloadUserOnSendingMail');
804 $objStd->status =
'error';
805 $objStd->style=
"warnings";
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.
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.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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.