29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/report.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancycategory.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountancyreport.class.php';
47$langs->loadLangs(array(
'compta',
'bills',
'donation',
'salaries',
'accountancy'));
57$action =
GETPOST(
'action',
'aZ09');
58$cat_id =
GETPOST(
'account_category');
62$cancel =
GETPOST(
'cancel',
'alpha');
63$showaccountdetail =
GETPOST(
'showaccountdetail',
'aZ09') ?
GETPOST(
'showaccountdetail',
'aZ09') :
'no';
66$date_startmonth =
GETPOSTINT(
'date_startmonth');
83 $year_start = $year_current - ($nbofyear - 1);
85 $year_current = $year;
87 $year_start = $year - ($nbofyear - 1);
89$date_start =
dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
90$date_end =
dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
93if (empty($date_start) || empty($date_end)) {
97 $year_end = $year_start + ($nbofyear - 1);
99 $date_startmonth = $month_start;
101 if (!$year && $month_start > $month_current) {
105 $month_end = $month_start - 1;
106 if ($month_end < 1) {
112 $month_end = $month_start;
141$start_year = $tmps[
'year'];
142$start_month = $tmps[
'mon'];
144$year_end = $tmpe[
'year'];
145$month_end = $tmpe[
'mon'];
146$nbofyear = ($year_end - $start_year) + 1;
148$date_startmonth = $start_month;
149$date_endmonth = $month_end;
163if (isModEnabled(
'accounting')) {
164 $modecompta =
'BOOKKEEPING';
166if (
GETPOST(
"modecompta",
'alpha')) {
167 $modecompta =
GETPOST(
"modecompta",
'alpha');
174if ($user->socid > 0) {
175 $socid = $user->socid;
177$hookmanager->initHooks([
'resultreportlist']);
178if (isModEnabled(
'comptabilite')) {
181if (isModEnabled(
'accounting')) {
182 $result =
restrictedArea($user,
'accounting',
'',
'',
'comptarapport');
190 $langs->trans(
"MonthShort01"),
191 $langs->trans(
"MonthShort02"),
192 $langs->trans(
"MonthShort03"),
193 $langs->trans(
"MonthShort04"),
194 $langs->trans(
"MonthShort05"),
195 $langs->trans(
"MonthShort06"),
196 $langs->trans(
"MonthShort07"),
197 $langs->trans(
"MonthShort08"),
198 $langs->trans(
"MonthShort09"),
199 $langs->trans(
"MonthShort10"),
200 $langs->trans(
"MonthShort11"),
201 $langs->trans(
"MonthShort12"),
204llxHeader(
'', $langs->trans(
'ReportInOut'));
211$form =
new Form($db);
213$textprevyear =
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.($start_year - 1).
'&showaccountdetail='.urlencode($showaccountdetail).
'">'.
img_previous().
'</a>';
214$textnextyear =
' <a href="'.$_SERVER[
"PHP_SELF"].
'?year='.($start_year + 1).
'&showaccountdetail='.urlencode($showaccountdetail).
'">'.
img_next().
'</a>';
218if ($modecompta ==
"CREANCES-DETTES") {
219 $name = $langs->trans(
"AnnualByAccountDueDebtMode");
220 $calcmode = $langs->trans(
"CalcModeDebt");
221 $calcmode .=
'<br>('.$langs->trans(
"SeeReportInInputOutputMode",
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$start_year.(GETPOST(
"month") > 0 ?
'&month='.GETPOST(
"month") :
'').
'&modecompta=RECETTES-DEPENSES">',
'</a>').
')';
222 if (isModEnabled(
'accounting')) {
223 $calcmode .=
'<br>('.$langs->trans(
"SeeReportInBookkeepingMode",
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$start_year.
'&modecompta=BOOKKEEPING">',
'</a>').
')';
225 $period = $form->selectDate($date_start,
'date_start', 0, 0, 0,
'', 1, 0).
' - '.$form->selectDate($date_end,
'date_end', 0, 0, 0,
'', 1, 0);
227 $description = $langs->trans(
"RulesResultDue");
229 $description .= $langs->trans(
"DepositsAreNotIncluded");
231 $description .= $langs->trans(
"DepositsAreIncluded");
234 $description .= $langs->trans(
"SupplierDepositsAreNotIncluded");
238} elseif ($modecompta ==
"RECETTES-DEPENSES") {
239 $name = $langs->trans(
"AnnualByAccountInputOutputMode");
240 $calcmode = $langs->trans(
"CalcModePayment");
241 $calcmode .=
'<br>('.$langs->trans(
"SeeReportInDueDebtMode",
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.(GETPOST(
"month") > 0 ?
'&month='.GETPOST(
"month") :
'').
'&modecompta=CREANCES-DETTES">',
'</a>').
')';
242 if (isModEnabled(
'accounting')) {
243 $calcmode .=
'<br>('.$langs->trans(
"SeeReportInBookkeepingMode",
'<a href="'.$_SERVER[
"PHP_SELF"].
'?year='.$year.
'&modecompta=BOOKKEEPING">',
'</a>').
')';
245 $period = $form->selectDate($date_start,
'date_start', 0, 0, 0,
'', 1, 0).
' - '.$form->selectDate($date_end,
'date_end', 0, 0, 0,
'', 1, 0);
247 $description = $langs->trans(
"RulesResultInOut");
250} elseif ($modecompta ==
"BOOKKEEPING") {
252 $accountingreportstatic->fetch($id_report);
254 $reportLabel = $accountingreportstatic->label;
256 $name = $langs->trans(
"ReportInOut").
', '.$langs->trans(
"ByPersonalizedAccountGroups").
' '.$reportLabel;
257 $calcmode = $langs->trans(
"CalcModeBookkeeping");
260 $period = $form->selectDate($date_start,
'date_start', 0, 0, 0,
'', 1, 0).
' - '.$form->selectDate($date_end,
'date_end', 0, 0, 0,
'', 1, 0);
261 $arraylist = array(
'no' => $langs->trans(
"None"),
'yes' => $langs->trans(
"AccountWithNonZeroValues"),
'all' => $langs->trans(
"All"));
262 $period .=
' <span class="opacitymedium">'.$langs->trans(
"DetailBy").
'</span> '.$form->selectarray(
'showaccountdetail', $arraylist, $showaccountdetail, 0);
263 $periodlink = $textprevyear.$textnextyear;
265 $description = $langs->trans(
"RulesResultBookkeepingPersonalized");
266 $description .=
' ('.$langs->trans(
"SeePageForSetup", DOL_URL_ROOT.
'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.
'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv(
"Accountancy").
' / '.$langs->transnoentitiesnoconv(
"Setup").
' / '.$langs->transnoentitiesnoconv(
"AccountingCategory")).
')';
270report_header($name,
'', $period, $periodlink ??
'', $description, $builddate, $exportlink ??
'', array(
'modecompta' => $modecompta,
'action' =>
''), $calcmode);
273if (isModEnabled(
'accounting') && $modecompta !=
'BOOKKEEPING') {
274 print
info_admin($langs->trans(
"WarningReportNotReliable"), 0, 0,
'1');
280print
'<div class="div-table-responsive">';
281print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
283print
'<tr class="liste_titre">';
284print
'<th class="liste_titre">'.$langs->trans(
"AccountingCategory").
'</th>';
285print
'<th class="liste_titre"></th>';
286print
'<th class="liste_titre right">'.$langs->trans(
"PreviousPeriod").
'</th>';
287print
'<th class="liste_titre right">'.$langs->trans(
"SelectedPeriod").
'</th>';
288foreach ($months as $k => $v) {
289 if (($k + 1) >= $date_startmonth && (($date_startmonth <= $date_endmonth && ($k + 1) <= $date_endmonth) || ($date_startmonth > $date_endmonth))) {
290 print
'<th class="liste_titre right width50">'.$langs->trans(
'MonthShort'.sprintf(
"%02d", ($k + 1))).
'</th>';
293if ($date_startmonth > $date_endmonth) {
294 foreach ($months as $k => $v) {
295 if (($k + 1) < $date_startmonth && ($k + 1) <= $date_endmonth) {
296 print
'<th class="liste_titre right width50">'.$langs->trans(
'MonthShort'.sprintf(
"%02d", ($k + 1))).
'</th>';
302if ($modecompta ==
'CREANCES-DETTES') {
305} elseif ($modecompta ==
"RECETTES-DEPENSES") {
308} elseif ($modecompta ==
"BOOKKEEPING") {
310 $cats = $AccCat->getCats(-1, 1, $id_report);
311 $unactive_cats = $AccCat->getCats(-1, 0, $id_report);
340 $totPerAccount = array();
341 if (!is_array($cats) && $cats < 0) {
343 } elseif (is_array($cats) && count($cats) == 0) {
344 print
'<tr class="liste_total">';
345 print
'<td colspan="15">';
346 print
'<span class="opacitymedium">';
347 print $langs->trans(
"ErrorNoAccountingCategoryForThisCountry", $mysoc->country_code, $langs->transnoentitiesnoconv(
"Accountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"AccountingCategory"));
351 } elseif (is_array($cats) && count($cats) > 0) {
353 foreach ($cats as $cat) {
354 if (!empty($cat[
'category_type'])) {
358 $formula = $cat[
'formula'];
360 print
'<tr class="liste_total">';
363 print
'<td class="liste_total tdoverflowmax100" title="'.dol_escape_htmltag($cat[
'code']).
'">';
365 print
'</td><td class="tdoverflowmax250 borderright" title="'.dol_escape_htmltag($cat[
'label']).
'">';
372 foreach ($unactive_cats as $un_cat) {
373 $vars[$un_cat[
'code']] = 0;
377 foreach ($sommes as $code => $det) {
378 $vars[$code] = empty($det[
'NP']) ? 0 : $det[
'NP'];
381 $result = strtr($formula, $vars);
382 $result = str_replace(
'--',
'+', $result);
384 if (preg_match(
'/[a-z]/i', $result)) {
385 $r =
'Error bad formula: '.$result;
387 print
'<td class="liste_total right"><span class="amount" title="'.dol_escape_htmltag($r).
'">'.$rshort.
'</span></td>';
391 $r = (float)
dol_eval($result, 1, 1,
'1');
394 print
'<td class="liste_total right"><span class="amount">'.price($r, 0,
'', 1, 0, 0).
'</span></td>';
396 print
'<td class="liste_total right"><span class="amount">'.price($r).
'</span></td>';
400 if (!isset($sommes[$code])) {
401 $sommes[$code] = array();
404 $code = $cat[
'code'];
405 if (empty($sommes[$code][
'NP'])) {
406 $sommes[$code][
'NP'] = $r;
408 $sommes[$code][
'NP'] += $r;
412 if (is_array($sommes) && !empty($sommes)) {
413 foreach ($sommes as $code => $det) {
414 $vars[$code] = empty($det[
'N']) ? 0 : $det[
'N'];
418 $result = strtr($formula, $vars);
419 $result = str_replace(
'--',
'+', $result);
422 $r = (float)
dol_eval($result, 1, 1,
'1');
425 print
'<td class="liste_total right borderright"><span class="amount">'.price($r, 0,
'', 1, 0, 0).
'</span></td>';
427 print
'<td class="liste_total right borderright"><span class="amount">'.price($r).
'</span></td>';
429 if (empty($sommes[$code][
'N'])) {
430 $sommes[$code][
'N'] = $r;
432 $sommes[$code][
'N'] += $r;
436 foreach ($months as $k => $v) {
437 if (($k + 1) >= $date_startmonth && (($date_startmonth <= $date_endmonth && ($k + 1) <= $date_endmonth) || ($date_startmonth > $date_endmonth))) {
438 foreach ($sommes as $code => $det) {
439 $vars[$code] = empty($det[
'M'][$k]) ? 0 : $det[
'M'][$k];
441 $result = strtr($formula, $vars);
442 $result = str_replace(
'--',
'+', $result);
445 $r = (float)
dol_eval($result, 1, 1,
'1');
449 print
'<td class="liste_total right"><span class="amount">'.price($r, 0,
'', 1, 0, 0).
'</span></td>';
451 print
'<td class="liste_total right"><span class="amount">'.price($r).
'</span></td>';
453 if (empty($sommes[$code][
'M'][$k])) {
454 $sommes[$code][
'M'][$k] = $r;
456 $sommes[$code][
'M'][$k] += $r;
461 if ($date_startmonth > $date_endmonth) {
462 foreach ($months as $k => $v) {
463 if (($k + 1) < $date_startmonth && ($k + 1) <= $date_endmonth) {
464 foreach ($sommes as $code => $det) {
465 $vars[$code] = empty($det[
'M'][$k]) ? 0 : $det[
'M'][$k];
467 $result = strtr($formula, $vars);
468 $result = str_replace(
'--',
'+', $result);
471 $r = (float)
dol_eval($result, 1, 1,
'1');
474 print
'<td class="liste_total right"><span class="amount">'.price($r, 0,
'', 1, 0, 0).
'</span></td>';
476 print
'<td class="liste_total right"><span class="amount">'.price($r).
'</span></td>';
478 if (empty($sommes[$code][
'M'][$k])) {
479 $sommes[$code][
'M'][$k] = $r;
481 $sommes[$code][
'M'][$k] += $r;
491 $code = $cat[
'code'];
496 $totCat[
'M'] = array();
497 foreach ($months as $k => $v) {
498 $totCat[
'M'][$k] = 0;
500 if (!isset($sommes[$code])) {
501 $sommes[$code] = array();
505 $cpts = $AccCat->getCptsCat($cat[
'rowid']);
511 $arrayofaccountforfilter = array();
512 foreach ($cpts as $i => $cpt) {
513 if (isset($cpt[
'account_number'])) {
514 $arrayofaccountforfilter[] = $cpt[
'account_number'];
519 if (!empty($arrayofaccountforfilter)) {
520 $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, empty($cat[
'dc']) ? 0 : $cat[
'dc']);
525 foreach ($cpts as $i => $cpt) {
526 $resultNP = empty($AccCat->sdcperaccount[$cpt[
'account_number']]) ? 0 : $AccCat->sdcperaccount[$cpt[
'account_number']];
528 if (empty($totCat[
'NP'])) {
529 $totCat[
'NP'] = $resultNP;
531 $totCat[
'NP'] += $resultNP;
533 if (empty($sommes[$code][
'NP'])) {
534 $sommes[$code][
'NP'] = $resultNP;
536 $sommes[$code][
'NP'] += $resultNP;
538 $totPerAccount[$cpt[
'account_number']][
'NP'] = $resultNP;
545 foreach ($cpts as $i => $cpt) {
551 foreach ($months as $k => $v) {
552 $monthtoprocess = $k + 1;
553 $yeartoprocess = $start_year;
554 if (($k + 1) < $start_month) {
559 if (isset($cpt[
'account_number'])) {
560 $return = $AccCat->getSumDebitCredit($cpt[
'account_number'], $date_start, $date_end, empty($cat[
'dc']) ? 0 : $cat[
'dc'],
'nofilter', $monthtoprocess, $yeartoprocess);
565 $resultM = $AccCat->sdc;
570 if (empty($totCat[
'M'][$k])) {
571 $totCat[
'M'][$k] = $resultM;
573 $totCat[
'M'][$k] += $resultM;
575 if (empty($sommes[$code][
'M'][$k])) {
576 $sommes[$code][
'M'][$k] = $resultM;
578 $sommes[$code][
'M'][$k] += $resultM;
580 if (isset($cpt[
'account_number'])) {
581 $totPerAccount[$cpt[
'account_number']][
'M'][$k] = $resultM;
584 $resultN += $resultM;
587 if (empty($totCat)) {
588 $totCat[
'N'] = $resultN;
590 $totCat[
'N'] += $resultN;
592 if (empty($sommes[$code][
'N'])) {
593 $sommes[$code][
'N'] = $resultN;
595 $sommes[$code][
'N'] += $resultN;
597 if (isset($cpt[
'account_number'])) {
598 $totPerAccount[$cpt[
'account_number']][
'N'] = $resultN;
605 print
'<tr'.($showaccountdetail !=
'no' ?
' class="trforbreak"' :
'').
'>';
608 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($cat[
'code']).
'">';
614 if (count($cpts) > 0 && !empty($cpts[0])) {
616 foreach ($cpts as $cpt) {
618 $labeltoshow .=
'...)';
622 $labeltoshow .=
', ';
624 $labeltoshow .=
' (';
633 $labeltoshow .=
' - <span class="warning">'.$langs->trans(
"GroupIsEmptyCheckSetup").
'</span>';
635 print
'<td class="tdoverflowmax250 borderright" title="'.dol_escape_htmltag(
dol_string_nohtmltag($labeltoshow)).
'">';
640 print
'<td class="right"><span class="amount">'.price($totCat[
'NP'], 0,
'', 1, 0, 0).
'</span></td>';
641 print
'<td class="right borderright"><span class="amount">'.price($totCat[
'N'], 0,
'', 1, 0, 0).
'</span></td>';
643 print
'<td class="right"><span class="amount">'.price($totCat[
'NP']).
'</span></td>';
644 print
'<td class="right borderright"><span class="amount">'.price($totCat[
'N']).
'</span></td>';
648 foreach ($totCat[
'M'] as $k => $v) {
649 if (($k + 1) >= $date_startmonth && (($date_startmonth <= $date_endmonth && ($k + 1) <= $date_endmonth) || ($date_startmonth > $date_endmonth))) {
651 print
'<td class="right nowraponall"><span class="amount">'.price($v, 0,
'', 1, 0, 0).
'</span></td>';
653 print
'<td class="right nowraponall"><span class="amount">'.price($v).
'</span></td>';
657 if ($date_startmonth > $date_endmonth) {
658 foreach ($totCat[
'M'] as $k => $v) {
659 if (($k + 1) < $date_startmonth && ($k + 1) <= $date_endmonth) {
661 print
'<td class="right nowraponall"><span class="amount">'.price($v, 0,
'', 1, 0, 0).
'</span></td>';
663 print
'<td class="right nowraponall"><span class="amount">'.price($v).
'</span></td>';
672 if ($showaccountdetail !=
'no') {
673 foreach ($cpts as $i => $cpt) {
674 if (isset($cpt[
'account_number'])) {
675 $resultNP = $totPerAccount[$cpt[
'account_number']][
'NP'];
676 $resultN = $totPerAccount[$cpt[
'account_number']][
'N'];
682 if ($showaccountdetail ==
'all' || $resultN != 0) {
686 if (isset($cpt[
'account_number'])) {
687 $labeldetail =
' '.length_accountg($cpt[
'account_number']).
' - '.$cpt[
'account_label'];
692 print
'<td class="tdoverflowmax250 borderright" title="'.dol_escape_htmltag($labeldetail).
'">';
696 print
'<td class="right"><span class="amount">'.price($resultNP, 0,
'', 1, 0, 0).
'</span></td>';
697 print
'<td class="right borderright"><span class="amount">'.price($resultN, 0,
'', 1, 0, 0).
'</span></td>';
699 print
'<td class="right"><span class="amount">'.price($resultNP).
'</span></td>';
700 print
'<td class="right borderright"><span class="amount">'.price($resultN).
'</span></td>';
704 foreach ($months as $k => $v) {
705 if (($k + 1) >= $date_startmonth && (($date_startmonth <= $date_endmonth && ($k + 1) <= $date_endmonth) || ($date_startmonth > $date_endmonth))) {
706 if (isset($cpt[
'account_number'])) {
707 $resultM = $totPerAccount[$cpt[
'account_number']][
'M'][$k];
711 print
'<td class="right"><span class="amount">'.price($resultM).
'</span></td>';
714 if ($date_startmonth > $date_endmonth) {
715 foreach ($months as $k => $v) {
716 if (($k + 1) < $date_startmonth && ($k + 1) <= $date_endmonth) {
717 if (isset($cpt[
'account_number'])) {
718 $resultM = empty($totPerAccount[$cpt[
'account_number']][
'M'][$k]) ? 0 : $totPerAccount[$cpt[
'account_number']][
'M'][$k];
722 print
'<td class="right"><span class="amount">'.price($resultM).
'</span></td>';
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage categories of an accounting account.
Class to manage reports for accounting categories.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_now($mode='auto')
Return date for now.
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).
img_previous($titlealt='default', $moreatt='')
Show previous logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_next($titlealt='default', $moreatt='')
Show next logo.
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_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink='', $moreparam=array(), $calcmode='', $varlink='')
Show header of a report.
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.