28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/prelevement.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/ligneprelevement.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
36$langs->loadLangs(array(
'banks',
'categories',
'bills',
'companies',
'withdrawals'));
39$action =
GETPOST(
'action',
'aZ09');
49$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
50$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52if (empty($page) || $page == -1) {
55$offset = $limit * $page;
60 $sortfield =
'pl.rowid';
69include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
71$hookmanager->initHooks(array(
'directdebitprevcard',
'globalcard',
'directdebitprevlist'));
75$salaryBonPl =
$object->checkIfSalaryBonPrelevement();
76if ($type ==
'bank-transfer') {
77 $result =
restrictedArea($user,
'paymentbybanktransfer',
'',
'',
'');
79 $permissiontoadd = $user->hasRight(
'paymentbybanktransfer',
'create');
80 $permissiontosend = $user->hasRight(
'paymentbybanktransfer',
'send');
81 $permissiontocreditdebit = $user->hasRight(
'paymentbybanktransfer',
'debit');
82 $permissiontodelete = $user->hasRight(
'paymentbybanktransfer',
'read');
86 $permissiontoadd = $user->hasRight(
'prelevement',
'bons',
'creer');
87 $permissiontosend = $user->hasRight(
'prelevement',
'bons',
'send');
88 $permissiontocreditdebit = $user->hasRight(
'prelevement',
'bons',
'credit');
89 $permissiontodelete = $user->hasRight(
'prelevement',
'bons',
'read');
98$parameters = array(
'socid' => $socid);
99$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
104if (empty($reshook)) {
105 if ($action ==
'setbankaccount' && $permissiontoadd) {
113 if ($action ==
'setdate_trans' && $permissiontosend) {
114 $result =
$object->setValueFrom(
'date_trans', $date_trans,
'',
null,
'date');
120 if ($action ==
'infotrans' && $permissiontosend) {
121 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
144 $error =
$object->set_infotrans($user, $dt,
GETPOST(
'methode',
'alpha'));
147 header(
"Location: card.php?id=".$id.
"&error=$error");
153 if ($action ==
'setinfocredit' && $permissiontocreditdebit) {
156 if ((
$object->type !=
'bank-transfer' &&
$object->statut == BonPrelevement::STATUS_CREDITED) || (
$object->type ==
'bank-transfer' &&
$object->statut == BonPrelevement::STATUS_DEBITED)) {
160 $error =
$object->set_infocredit($user, $dt, ($salaryBonPl ?
'salary' :
''));
168 if ($action ==
'reopen' && $permissiontocreditdebit) {
170 $res =
$object->setStatut(BonPrelevement::STATUS_TRANSFERED);
176 if ($action ==
'confirm_delete' && $permissiontodelete) {
180 if ($savtype ==
'bank-transfer') {
181 header(
"Location: ".DOL_URL_ROOT.
'/compta/paymentbybanktransfer/index.php');
183 header(
"Location: ".DOL_URL_ROOT.
'/compta/prelevement/index.php');
196$form =
new Form($db);
198llxHeader(
'', $langs->trans(
"WithdrawalsReceipts"));
200if ($id > 0 || $ref) {
202 print
dol_get_fiche_head($head,
'prelevement', $langs->trans(
"WithdrawalsReceipts"), -1,
'payment');
204 if (
GETPOST(
'error',
'alpha') !=
'') {
205 print
'<div class="error">'.$object->getErrorString(
GETPOST(
'error',
'alpha')).
'</div>';
208 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.(
$object->type !=
'bank-transfer' ?
'' :
'&type=bank-transfer').
'">'.$langs->trans(
"BackToList").
'</a>';
210 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref');
212 print
'<div class="fichecenter">';
213 print
'<div class="underbanner clearboth"></div>';
214 print
'<table class="border centpercent tableforfield">';
217 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Date").
'</td><td>'.
dol_print_date(
$object->datec,
'day').
'</td></tr>';
219 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td><span class="amount">'.
price(
$object->amount).
'</span></td></tr>';
222 if (!empty(
$object->date_trans)) {
223 $muser =
new User($db);
224 $muser->fetch(
$object->user_trans);
228 print
'<table class="nobordernopadding centpercent"><tr><td>';
229 print $langs->trans(
'TransData');
231 if ($action !=
'editdate_trans' && $permissiontosend) {
232 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_trans&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetTransDate'), 1).
'</a></td>';
234 print
'</tr></table>';
236 if ($action ==
'editdate_trans' && $permissiontosend) {
237 print
'<form name="setdate_trans" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post">';
238 print
'<input type="hidden" name="token" value="'.newToken().
'">';
239 print
'<input type="hidden" name="action" value="setdate_trans">';
240 print $form->selectDate(
$object->date_trans ?
$object->date_trans : -1,
'date_trans', 0, 0,
"setdate_trans");
241 print
'<input type="submit" class="button button-edit smallpaddingimp valign middle" value="'.$langs->trans(
'Modify').
'">';
245 print
' <span class="opacitymedium">'.$langs->trans(
"By").
'</span> '.$muser->getNomUrl(-1).
'</td>';
251 print
'<tr><td>'.$langs->trans(
"TransMetod").
'</td><td>';
257 if (!empty(
$object->date_credit)) {
258 print
'<tr><td>'.$langs->trans(
'CreditDate').
'</td><td>';
267 print
'<div class="underbanner clearboth"></div>';
268 print
'<table class="border centpercent tableforfield">';
272 $fk_bank_account =
$object->fk_bank_account;
273 if (empty($fk_bank_account)) {
276 if ($fk_bank_account > 0) {
277 $result = $acc->fetch($fk_bank_account);
281 $labelofbankfield =
"BankToReceiveWithdraw";
282 if (
$object->type ==
'bank-transfer') {
283 $labelofbankfield =
'BankToPayCreditTransfer';
286 $caneditbank = $permissiontoadd;
287 if (
$object->status != $object::STATUS_DRAFT) {
299 print
'<tr><td class="titlefieldcreate">';
300 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
301 print $form->textwithpicto($langs->trans(
"BankAccount"), $langs->trans($labelofbankfield));
303 if (($action !=
'editbankaccount') && $caneditbank) {
304 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editfkbankaccount&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->trans(
'SetBankAccount'), 1).
'</a></td>';
306 print
'</tr></table>';
308 if ($action ==
'editfkbankaccount') {
309 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $fk_bank_account,
'fk_bank_account', 0);
311 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $fk_bank_account,
'none');
317 print
'<tr><td class="titlefieldcreate">';
318 $labelfororderfield =
'WithdrawalFile';
319 if (
$object->type ==
'bank-transfer') {
320 $labelfororderfield =
'CreditTransferFile';
322 print $langs->trans($labelfororderfield).
'</td><td>';
324 $modulepart =
'prelevement';
325 if (
$object->type ==
'bank-transfer') {
326 $modulepart =
'paymentbybanktransfer';
329 if (isModEnabled(
'multicompany')) {
330 $labelentity = $conf->entity;
331 $relativepath =
'receipts/'.$object->ref.
'-'.$labelentity.
'.xml';
333 if ($type !=
'bank-transfer') {
334 $dir = $conf->prelevement->dir_output;
336 $dir = $conf->paymentbybanktransfer->dir_output;
339 $relativepath =
'receipts/'.$object->ref.
'.xml';
342 $relativepath =
'receipts/'.$object->ref.
'.xml';
345 print
'<a data-ajax="false" href="'.DOL_URL_ROOT.
'/document.php?type=text/plain&modulepart='.$modulepart.
'&file='.urlencode($relativepath).
'">'.$relativepath;
346 print
img_picto(
'',
'download',
'class="paddingleft"');
351 $parameters = array();
352 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
353 print $hookmanager->resPrint;
365 if ($action ==
'delete') {
366 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Delete'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
379 if (empty(
$object->date_trans) && (($user->hasRight(
'prelevement',
'bons',
'send') &&
$object->type !=
'bank-transfer') || ($user->hasRight(
'paymentbybanktransfer',
'send') &&
$object->type ==
'bank-transfer')) && $action ==
'settransmitted') {
380 print
'<form method="post" name="userfile" action="card.php?id='.$object->id.
'" enctype="multipart/form-data">';
381 print
'<input type="hidden" name="token" value="'.newToken().
'">';
382 print
'<input type="hidden" name="action" value="infotrans">';
383 print
'<table class="noborder centpercent">';
384 print
'<tr class="liste_titre">';
385 print
'<td colspan="3">'.$langs->trans(
"NotifyTransmision").
'</td></tr>';
386 print
'<tr class="oddeven"><td>'.$langs->trans(
"TransData").
'</td><td>';
387 print $form->selectDate(
'',
'', 0, 0, 0,
"userfile", 1, 1);
389 print
'<tr class="oddeven"><td>'.$langs->trans(
"TransMetod").
'</td><td>';
390 print $form->selectarray(
"methode",
$object->methodes_trans);
393 print
'<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
"SetToStatusSent")).
'"></div>';
398 if (
$object->status == BonPrelevement::STATUS_TRANSFERED && (($user->hasRight(
'prelevement',
'bons',
'credit') &&
$object->type !=
'bank-transfer') || ($user->hasRight(
'paymentbybanktransfer',
'debit') &&
$object->type ==
'bank-transfer')) && $action ==
'setcredited') {
399 $btnLabel = (
$object->type ==
'bank-transfer') ? $langs->trans(
"ClassDebited") : $langs->trans(
"ClassCredited");
400 print
'<form name="infocredit" method="post" action="card.php?id='.$object->id.
'">';
401 print
'<input type="hidden" name="token" value="'.newToken().
'">';
402 print
'<input type="hidden" name="action" value="setinfocredit">';
403 print
'<table class="noborder centpercent">';
404 print
'<tr class="liste_titre">';
405 print
'<td colspan="3">'.$langs->trans(
"NotifyCredit").
'</td></tr>';
406 print
'<tr class="oddeven"><td>'.$langs->trans(
'CreditDate').
'</td><td>';
407 print $form->selectDate(-1,
'', 0, 0, 0,
"infocredit", 1, 1);
410 print
'<br><div class="center"><span class="opacitymedium">'.$langs->trans(
"ThisWillAlsoAddPaymentOnInvoice").
'</span></div>';
411 print
'<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($btnLabel).
'"></div>';
417 if ($action !=
'settransmitted' && $action !=
'setcredited') {
418 print
"\n".
'<div class="tabsAction">'.
"\n";
419 $parameters = array();
420 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
421 if (empty($reshook)) {
422 if (empty(
$object->date_trans)) {
423 if (
$object->type ==
'bank-transfer') {
424 print
dolGetButtonAction($langs->trans(
"SetToStatusSent"),
'',
'default',
'card.php?action=settransmitted&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'paymentbybanktransfer',
'send'));
426 print
dolGetButtonAction($langs->trans(
"SetToStatusSent"),
'',
'default',
'card.php?action=settransmitted&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'prelevement',
'bons',
'send'));
430 if (
$object->status == BonPrelevement::STATUS_TRANSFERED) {
431 if (
$object->type ==
'bank-transfer') {
432 print
dolGetButtonAction($langs->trans(
"ClassDebited"),
'',
'default',
'card.php?action=setcredited&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'paymentbybanktransfer',
'debit'));
434 print
dolGetButtonAction($langs->trans(
"ClassCredited"),
'',
'default',
'card.php?action=setcredited&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'prelevement',
'bons',
'credit'));
439 if (
$object->status == BonPrelevement::STATUS_DEBITED ||
$object->status == BonPrelevement::STATUS_CREDITED) {
440 if (
$object->type ==
'bank-transfer') {
441 print
dolGetButtonAction($langs->trans(
"ReOpen"),
'',
'default',
'card.php?action=reopen&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'paymentbybanktransfer',
'debit'));
443 print
dolGetButtonAction($langs->trans(
"ReOpen"),
'',
'default',
'card.php?action=reopen&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'prelevement',
'bons',
'credit'));
448 if (
$object->type ==
'bank-transfer') {
449 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete',
'card.php?action=delete&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'paymentbybanktransfer',
'create'));
451 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete',
'card.php?action=delete&token='.newToken().
'&id='.
$object->id,
'', $user->hasRight(
'prelevement',
'bons',
'creer'));
462 $sql =
"SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,";
463 $sql .=
" u.rowid as socid, u.login as name";
464 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
465 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
466 $sql .=
", ".MAIN_DB_PREFIX.
"user as u";
467 $sql .=
" WHERE pl.fk_prelevement_bons = ".((int) $id);
468 $sql .=
" AND pl.fk_prelevement_bons = pb.rowid";
469 $sql .=
" AND pb.entity = ".((int) $conf->entity);
470 $sql .=
" AND pl.fk_user = u.rowid";
472 $sql .=
" AND u.rowid = ".((int) $socid);
474 $sql .= $db->order($sortfield, $sortorder);
476 $sql =
"SELECT pl.rowid, pl.statut, pl.amount,";
477 $sql .=
" s.rowid as socid, s.nom as name";
478 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_lignes as pl";
479 $sql .=
", ".MAIN_DB_PREFIX.
"prelevement_bons as pb";
480 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
481 $sql .=
" WHERE pl.fk_prelevement_bons = ".((int) $id);
482 $sql .=
" AND pl.fk_prelevement_bons = pb.rowid";
483 $sql .=
" AND pb.entity = ".((int) $conf->entity);
484 $sql .=
" AND pl.fk_soc = s.rowid";
486 $sql .=
" AND s.rowid = ".((int) $socid);
488 $sql .= $db->order($sortfield, $sortorder);
491 $nbtotalofrecords =
'';
493 $result = $db->query($sql);
494 $nbtotalofrecords = $db->num_rows($result);
495 if (($page * $limit) > $nbtotalofrecords) {
502 $sql .= $db->plimit($limit + 1, $offset);
504 $result = $db->query($sql);
507 $num = $db->num_rows($result);
510 $urladd =
"&id=".urlencode((
string) ($id));
511 if ($limit > 0 && $limit != $conf->liste_limit) {
512 $urladd .=
'&limit='.((int) $limit);
515 print
'<form method="POST" action="'.$_SERVER [
'PHP_SELF'].
'" name="search_form">'.
"\n";
516 print
'<input type="hidden" name="token" value="'.newToken().
'"/>';
517 print
'<input type="hidden" name="id" value="'.$id.
'"/>';
518 print
'<input type="hidden" name="socid" value="'.$socid.
'"/>';
520 print
'<input type="hidden" name="page" value="'.$page.
'"/>';
522 if (!empty($limit)) {
523 print
'<input type="hidden" name="limit" value="'.$limit.
'"/>';
525 if (!empty($sortfield)) {
526 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'"/>';
528 if (!empty($sortorder)) {
529 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'"/>';
532 print_barre_liste($langs->trans(
"Lines"), $page, $_SERVER[
"PHP_SELF"], $urladd, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'', 0,
'',
'', $limit);
534 print
'<div class="div-table-responsive-no-min">';
535 print
'<table class="noborder liste centpercent">';
536 print
'<tr class="liste_titre">';
538 print_liste_field_titre((!$salaryBonPl ?
"ThirdParty" :
"Employee"), $_SERVER[
"PHP_SELF"],
"s.nom",
'', $urladd,
'', $sortfield, $sortorder);
539 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"pl.amount",
"", $urladd,
'class="right"', $sortfield, $sortorder);
545 while ($i < min($num, $limit)) {
546 $obj = $db->fetch_object($result);
548 print
'<tr class="oddeven">';
552 print
'<a class="valignmiddle" href="'.DOL_URL_ROOT.
'/compta/prelevement/line.php?id='.$obj->rowid.
'&type='.
$object->type.
'&token='.
newToken().
'">';
553 print $ligne->LibStatut($obj->statut, 2);
554 print
'<span class="paddingleft">'.$obj->rowid.
'</span>';
557 $thirdparty =
new Societe($db);
558 $thirdparty->fetch($obj->socid);
560 $userSalary =
new User($db);
561 $userSalary->fetch($obj->fk_user);
563 print
'<td class="tdoverflowmax150">';
564 print(!$salaryBonPl ? $thirdparty->getNomUrl(1) : $userSalary->getNomUrl(-1));
567 print
'<td class="right"><span class="amount">'.price($obj->amount).
"</span></td>\n";
569 print
'<td class="right">';
571 if ($obj->statut == 3) {
572 print
'<span class="error">'.$langs->trans(
"StatusRefused").
'</span>';
574 if (
$object->statut == BonPrelevement::STATUS_CREDITED) {
575 if ($obj->statut == LignePrelevement::STATUS_CREDITED) {
576 if ($user->hasRight(
'prelevement',
'bons',
'credit')) {
578 print
'<a href="line.php?action=rejet&type='.$object->type.
'&id='.$obj->rowid.
'&token='.
newToken().
'">'.$langs->trans(
"StandingOrderReject").
'</a>';
590 $total += $obj->amount;
598 print
'<tr class="liste_total">';
599 print
'<td>'.$langs->trans(
"Total").
'</td>';
600 print
'<td> </td>';
601 print
'<td class="right">';
602 if (empty($offset) && $num <= $limit) {
604 if ($total !=
$object->amount) {
605 print
img_warning($langs->trans(
"TotalAmountOfdirectDebitOrderDiffersFromSumOfLines"));
610 print
'<td> </td>';
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()
Empty header.
Class to manage bank accounts.
Class to manage withdrawal receipts.
Class to manage withdrawals.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_is_file($pathoffile)
Return if path is a file.
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...
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
prelevement_prepare_head(BonPrelevement $object)
Prepare array with list of tabs.
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.