34require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
47$action =
GETPOST(
'action',
'aZ09');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
56$users = (
GETPOST(
'users',
'array') ?
GETPOST(
'users',
'array') : array($user->id));
57$groups =
GETPOST(
'groups',
'array');
63$langs->loadLangs(array(
"other",
"holiday",
"mails",
"trips"));
69$childids = $user->getAllChildIds(1);
73 $morefilter =
'AND employee = 1';
81$extrafields->fetch_name_optionals_label(
$object->table_element);
83if (($id > 0) || $ref) {
88 if ($user->hasRight(
'holiday',
'readall')) {
91 if ($user->hasRight(
'holiday',
'read') && in_array(
$object->fk_user, $childids)) {
100$hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
103$permissiontoaddall = 0;
104if ($user->hasRight(
'holiday',
'write') && in_array($fuserid, $childids)) {
105 $permissiontoadd = 1;
107if ($user->hasRight(
'holiday',
'writeall')) {
108 $permissiontoadd = 1;
109 $permissiontoaddall = 1;
113if ($user->hasRight(
'holiday',
'delete')) {
122 $socid = $user->socid;
131$parameters = array(
'socid' => $socid);
132$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
137if (empty($reshook)) {
138 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
140 if (empty($backtopage) || ($cancel && empty($id))) {
141 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
142 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
143 $backtopage = $backurlforlist;
145 $backtopage = DOL_URL_ROOT.
'/holiday/card_group.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
151 if (!empty($backtopageforcancel)) {
152 header(
"Location: ".$backtopageforcancel);
154 } elseif (!empty($backtopage)) {
155 header(
"Location: ".$backtopage);
162 if ($action ==
'add' && $permissiontoadd) {
163 $users =
GETPOST(
'users',
'array');
164 $groups =
GETPOST(
'groups',
'array');
170 $starthalfday =
GETPOST(
'starthalfday');
171 $endhalfday =
GETPOST(
'endhalfday');
175 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
177 } elseif ($starthalfday ==
'afternoon') {
179 } elseif ($endhalfday ==
'morning') {
184 $description = trim(
GETPOST(
'description',
'restricthtml'));
187 if (!$permissiontoaddall) {
189 if (!$user->hasRight(
'holiday',
'write')) {
192 } elseif (!in_array($fuserid, $childids)) {
198 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall_advance')) {
201 } elseif (!$user->hasRight(
'holiday',
'writeall_advance') && !in_array($fuserid, $childids)) {
209 if (empty($groups) && empty($users)) {
210 setEventMessages($langs->trans(
"ErrorFieldRequiredUserOrGroup"),
null,
'errors');
218 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
224 if (empty($date_debut)) {
230 if (empty($date_fin)) {
236 if ($date_debut > $date_fin) {
243 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
244 if ($nbopenedday < 0.5) {
251 if ($approverid < 1) {
252 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
260 $TusersToProcess = array();
264 $sql =
' SELECT DISTINCT u.rowid,u.lastname,u.firstname from ' . MAIN_DB_PREFIX .
'user as u';
265 $sql .=
' LEFT JOIN ' . MAIN_DB_PREFIX .
'usergroup_user as ug on ug.fk_user = u.rowid ';
266 $sql .=
' WHERE fk_usergroup in (' .$db->sanitize(implode(
',', $groups)) .
')';
267 $resql = $db->query($sql);
270 while ($obj = $db->fetch_object($resql)) {
271 $TusersToProcess[$obj->rowid] = $obj->rowid;
275 if (is_array($users) && count($users) > 0) {
276 foreach ($users as $u) {
277 $TusersToProcess[$u] = $u;
280 foreach ($TusersToProcess as $u) {
282 $verifCP =
$object->verifDateHolidayCP($u, $date_debut, $date_fin, $halfday);
286 $userError =
new User($db);
287 $result = $userError->fetch($u);
290 setEventMessages($langs->trans(
"UseralreadyCPexist", $userError->firstname .
' '. $userError->lastname),
null,
'errors');
303 foreach ($TusersToProcess as $u) {
306 $object->description = $description;
307 $object->fk_validator = $approverid;
309 $object->date_debut = $date_debut;
313 $result =
$object->create($user);
320 if ($autoValidation) {
322 $htemp->fetch($result);
325 $resultValidated = $htemp->update($approverid);
327 if ($resultValidated < 0) {
333 if ($AutoSendMail && !$error) {
335 $returnSendMail =
sendMail($result, $permissiontoadd, $now, $autoValidation);
336 if (!empty($returnSendMail->msg)) {
347 header(
'Location: '.DOL_URL_ROOT.
'/holiday/list.php');
362$form =
new Form($db);
365$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
367$title = $langs->trans(
'Leave');
368$help_url =
'EN:Module_Holiday';
370llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card_group');
372if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
374 if ((in_array($fuserid, $childids) && !$user->hasRight(
'holiday',
'writeall')) || (!in_array($fuserid, $childids) && (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || !$user->hasRight(
'holiday',
'writeall_advance')))) {
375 $errors[] = $langs->trans(
'CantCreateCP');
378 print
load_fiche_titre($langs->trans(
'MenuCollectiveAddCP'),
'',
'title_hrm.png');
384 $errors[] = $langs->trans(
'ErrorEndDateCP');
387 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
390 $errors[] = $langs->trans(
'CantCreateCP');
393 $errors[] = $langs->trans(
'InvalidValidatorCP');
396 $errors[] = $langs->trans(
'NoDateDebut');
399 $errors[] = $langs->trans(
'NoDateFin');
402 $errors[] = $langs->trans(
'ErrorDureeCP');
405 $errors[] = $langs->trans(
'alreadyCPexist');
413 print
'<script type="text/javascript">
414 $( document ).ready(function() {
416 if( $("input[name=autoValidation]").is(":checked") ){
417 $("#AutoSendMail").prop("disabled", false);
418 $("#AutoSendMail").prop("checked", true);
421 $("#AutoSendMail").prop("disabled", true);
422 $("#AutoSendMail").prop("checked", false);
425 $("input[name=autoValidation]").click( function(e) {
428 if( $("input[name=autoValidation]").is(":checked") ){
429 $("#AutoSendMail").prop("disabled", false);
430 $("#AutoSendMail").prop("checked", true);
432 $("#AutoSendMail").prop("disabled", true);
433 $("#AutoSendMail").prop("checked", false);
439 $("input.button-save").click("submit", function(e) {
440 console.log("Call valider()");
441 if (document.demandeCP.date_debut_.value != "")
443 if(document.demandeCP.date_fin_.value != "")
445 if(document.demandeCP.valideur.value != "-1") {
449 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
455 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
461 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
466 $("#autoValidation").change(function(){
467 if( $("input[name=autoValidation]").is(":checked") ){
468 $("#AutoSendMail").prop("disabled", false);
470 $("#AutoSendMail").prop("disabled", true);
471 $("#AutoSendMail").prop("checked", false);
479 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
480 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
481 print
'<input type="hidden" name="action" value="add" />'.
"\n";
485 print
'<table class="border centpercent">';
490 print
'<td class="titlefield fieldrequired">';
491 print $form->textwithpicto($langs->trans(
"groups"), $langs->trans(
"fusionGroupsUsers"));
494 print
img_picto($langs->trans(
"groups"),
'group',
'class="pictofixedwidth"');
496 $sql =
' SELECT rowid, nom from '.MAIN_DB_PREFIX.
'usergroup WHERE entity IN ('.
getEntity(
'usergroup').
')';
497 $resql = $db->query($sql);
499 while ($obj = $db->fetch_object($resql)) {
500 $Tgroup[$obj->rowid] = $obj->nom;
503 print $form->multiselectarray(
'groups', $Tgroup,
GETPOST(
'groups',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
509 print
'<td class="titlefield fieldrequired">';
510 print $form->textwithpicto($langs->trans(
"users"), $langs->trans(
"fusionGroupsUsers"));
512 print
img_picto($langs->trans(
"users"),
'user',
'class="pictofixedwidth"');
514 $sql =
'SELECT u.rowid, u.lastname, u.firstname, u.login, u.photo FROM '.MAIN_DB_PREFIX.
'user as u';
515 $sql .=
' WHERE 1 = 1';
516 $sql .= !empty($morefilter) ? $morefilter :
'';
519 $userstatic =
new User($db);
521 $resql = $db->query($sql);
523 while ($obj = $db->fetch_object($resql)) {
524 $userstatic->id = $obj->rowid;
525 $userstatic->login = $obj->login;
526 $userstatic->firstname = $obj->fistname;
527 $userstatic->lastname = $obj->lastname;
528 $userstatic->photo = $obj->photo;
530 $userlist[$obj->rowid] = array(
533 'data-html' => $userstatic->getNomUrl(-3,
'', 0, 1, 24, 1,
'login',
'', 1).
' '.
dolGetFirstLastname($obj->firstname, $obj->lastname)
538 print
img_picto(
'',
'users',
'class="pictofixedwidth"') . $form->multiselectarray(
'users', $userlist,
GETPOST(
'users',
'array'),
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
543 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
545 $typeleaves =
$object->getTypes(1, -1);
546 $arraytypeleaves = array();
547 foreach ($typeleaves as $key => $val) {
548 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
549 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
550 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
552 print $form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', true);
554 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
561 print
'<td class="fieldrequired">';
562 print $form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
567 print $form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
570 print $form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
572 print
' ';
573 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
579 print
'<td class="fieldrequired">';
580 print $form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
584 print $form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
587 print $form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
589 print
' ';
590 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
596 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
600 $include_users =
$object->fetch_users_approver_holiday();
601 if (empty($include_users)) {
602 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
606 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
613 $s = $form->select_dolusers($defaultselectuser,
"valideur", 1,
'', 0, $include_users,
'',
'0,'.$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
614 print
img_picto(
'',
'user').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
622 print
'<tr><td>'.$langs->trans(
"AutoValidationOnCreate").
'</td><td>';
623 print
'<input type="checkbox" id="autoValidation" name="autoValidation" value="1"'.($autoValidation ?
' checked="checked"' :
'').
'>';
624 print
'</td></tr>'.
"\n";
628 print
'<tr><td>'.$langs->trans(
"AutoSendMail").
'</td><td>';
629 print
'<input type="checkbox" id="AutoSendMail" name="AutoSendMail" value="1"'.($AutoSendMail ?
' checked="checked"' :
'').
'>';
630 print
'</td></tr>'.
"\n";
634 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
635 print
'<td class="tdtop">';
636 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In',
false,
false, isModEnabled(
'fckeditor'), ROWS_3,
'90%');
637 print $doleditor->Create(1);
641 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
648 print $form->buttonsSaveCancel(
"SendRequestCollectiveCP");
650 print
'</from>'.
"\n";
654 print
'<div class="tabBar">';
656 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
679function sendMail($id, $cancreate, $now, $autoValidation)
683 $objStd->status =
'success';
687 global $db, $user, $langs;
700 $verif =
$object->validate($user);
704 $destinataire =
new User($db);
705 $destinataire->fetch(
$object->fk_validator);
706 $emailTo = $destinataire->email;
710 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
713 $objStd->msg = $langs->trans(
'ErrorMailRecipientIsEmpty');
714 $objStd->status =
'error';
715 $objStd->style =
"warnings";
720 $expediteur =
new User($db);
721 $expediteur->fetch(
$object->fk_user);
731 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
734 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
736 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
741 $delayForRequest = 0;
742 if ($delayForRequest) {
745 if (
$object->date_debut < $nowplusdelay) {
746 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
756 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
760 $typeleaves =
$object->getTypes(1, -1);
761 $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']);
764 $starthalfdaykey =
"Afternoon";
765 $endhalfdaykey =
"Morning";
766 } elseif (
$object->halfday == -1) {
767 $starthalfdaykey =
"Afternoon";
768 $endhalfdaykey =
"Afternoon";
769 } elseif (
$object->halfday == 1) {
770 $starthalfdaykey =
"Morning";
771 $endhalfdaykey =
"Morning";
773 $starthalfdaykey =
"Morning";
774 $endhalfdaykey =
"Afternoon";
777 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
780 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
781 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type) : $labeltoshow).
"</li>\n";
782 $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";
783 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
784 $message .=
"</ul>\n";
786 $trackid =
'leav'.$object->id;
790 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
793 $result = $mail->sendfile();
797 $objStd->msg = $langs->trans(
'ErrorMailNotSend');
798 $objStd->style =
"warnings";
799 $objStd->status =
'error';
801 $objStd->msg = $langs->trans(
'MailSent');
807 $objStd->msg = $langs->trans(
'ErrorVerif');
808 $objStd->status =
'error';
809 $objStd->style =
"errors";
815 $objStd->msg = $langs->trans(
'ErrorloadUserOnSendingMail');
816 $objStd->status =
'error';
817 $objStd->style =
"warnings";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
if(is_object( $db)) sendMail($id, $cancreate, $now, $autoValidation)
send email to validator for current leave represented by (id)
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 information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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, $attop=0)
Set event message in dol_events session object.
dol_now($mode='auto')
Return date for now.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.