dolibarr 24.0.0-beta
factures.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
34require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
35require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
36require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
37require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
38
47// Load translation files required by the page
48$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawals', 'salaries', 'suppliers'));
49
50$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
51$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
52
53// Get supervariables
54$id = GETPOSTINT('id');
55$ref = GETPOST('ref', 'alpha');
56$socid = GETPOSTINT('socid');
57$userid = GETPOSTINT('userid');
58$type = GETPOST('type', 'aZ09');
59
60// Load variable for pagination
61$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
62$sortfield = GETPOST('sortfield', 'aZ09comma');
63$sortorder = GETPOST('sortorder', 'aZ09comma');
64$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
65if (empty($page) || $page == -1) {
66 $page = 0;
67} // If $page is not defined, or '' or -1
68$offset = $limit * $page;
69$pageprev = $page - 1;
70$pagenext = $page + 1;
71if (!$sortfield) {
72 $sortfield = 'p.ref';
73}
74if (!$sortorder) {
75 $sortorder = 'DESC';
76}
77
79
80// Load object
81include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals
82
83$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
84
85// Security check
86if ($user->socid > 0) {
88}
89
90$type = $object->type;
91$salaryBonPl = $object->checkIfSalaryBonPrelevement();
92if ($type == 'bank-transfer') {
93 $result = restrictedArea($user, 'paymentbybanktransfer', '', '', '');
94} else {
95 $result = restrictedArea($user, 'prelevement', '', '', 'bons');
96}
97
98
99/*
100 * View
101 */
102
103$form = new Form($db);
104$invoicetmp = new Facture($db);
105$thirdpartytmp = new Societe($db);
106
107llxHeader('', $langs->trans("WithdrawalsReceipts"));
108
109if ($id > 0 || $ref) {
110 if (empty($object->id)) {
111 $langs->load('errors');
112 echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
113 llxFooter();
114 exit;
115 }
116
117 $head = prelevement_prepare_head($object);
118
119 print dol_get_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
120
121 $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>';
122
123 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
124
125 print '<div class="fichecenter">';
126 print '<div class="underbanner clearboth"></div>';
127 print '<table class="border centpercent tableforfield">'."\n";
128
129 //print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
130 print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
131 print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
132
133 if (!empty($object->date_trans)) {
134 $muser = new User($db);
135 $muser->fetch($object->user_trans);
136
137 print '<tr><td>'.$langs->trans("TransData").'</td><td>';
138 print dol_print_date($object->date_trans, 'day');
139 print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
140 print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
141 print $object->methodes_trans[$object->method_trans];
142 print '</td></tr>';
143 }
144 if (!empty($object->date_credit)) {
145 print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
146 print dol_print_date($object->date_credit, 'day');
147 print '</td></tr>';
148 }
149
150 print '</table>';
151
152 print '<br>';
153
154 print '<div class="underbanner clearboth"></div>';
155 print '<table class="border centpercent tableforfield">';
156
157 // Get bank account for the payment
158 $acc = new Account($db);
159 $fk_bank_account = $object->fk_bank_account;
160 if (empty($fk_bank_account)) {
161 $fk_bank_account = ($object->type == 'bank-transfer' ? getDolGlobalInt('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT'));
162 }
163 if ($fk_bank_account > 0) {
164 $result = $acc->fetch($fk_bank_account);
165 }
166
167 $labelofbankfield = "BankToReceiveWithdraw";
168 if ($object->type == 'bank-transfer') {
169 $labelofbankfield = 'BankToPayCreditTransfer';
170 }
171
172 print '<tr><td class="titlefieldcreate">';
173 print $form->textwithpicto($langs->trans("BankAccount"), $langs->trans($labelofbankfield));
174 print '</td>';
175
176 print '<td>';
177 if ($acc->id > 0) {
178 print $acc->getNomUrl(1);
179 }
180 print '</td>';
181 print '</tr>';
182
183 $modulepart = 'prelevement';
184 if ($object->type == 'bank-transfer') {
185 $modulepart = 'paymentbybanktransfer';
186 }
187
188 print '<tr><td class="titlefieldcreate">';
189 $labelfororderfield = 'WithdrawalFile';
190 if ($object->type == 'bank-transfer') {
191 $labelfororderfield = 'CreditTransferFile';
192 }
193 print $langs->trans($labelfororderfield).'</td><td>';
194
195 if (isModEnabled('multicompany')) {
196 $labelentity = $conf->entity;
197 $relativepath = 'receipts/'.$object->ref.'-'.$labelentity.'.xml';
198
199 if ($type != 'bank-transfer') {
200 $dir = $conf->prelevement->dir_output;
201 } else {
202 $dir = $conf->paymentbybanktransfer->dir_output;
203 }
204 if (!dol_is_file($dir.'/'.$relativepath)) { // For backward compatibility
205 $relativepath = 'receipts/'.$object->ref.'.xml';
206 }
207 } else {
208 $relativepath = 'receipts/'.$object->ref.'.xml';
209 }
210
211 print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">'.$relativepath;
212 print img_picto('', 'download', 'class="paddingleft"');
213 print '</a>';
214 print '</td></tr></table>';
215
216 print '</div>';
217
218 print dol_get_fiche_end();
219}
220
221
222// List of invoices or salaries
223if ($salaryBonPl) {
224 $sql = "SELECT pf.rowid, p.type,";
225 $sql .= " f.rowid as salaryid, f.ref as ref, f.amount,";
226 $sql .= " u.rowid as userid, u.firstname, u.lastname,";
227 $sql .= " pl.statut as status, pl.amount as amount_requested";
228 $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
229 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON pl.fk_prelevement_bons = p.rowid";
230 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement as pf ON pf.fk_prelevement_lignes = pl.rowid";
231 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as f ON f.rowid = pf.fk_salary AND f.entity IN (".getEntity('salary').")";
232 $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON f.fk_user = u.rowid";
233 $sql .= " WHERE 1 = 1";
234 if ($object->id > 0) {
235 $sql .= " AND p.rowid = ".((int) $object->id);
236 }
237 if ($userid > 0) {
238 $sql .= " AND u.rowid = ".((int) $userid);
239 }
240} else {
241 $sql = "SELECT pf.rowid, p.type,";
242 $sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
243 if ($object->type == 'bank-transfer') {
244 $sql .= " f.ref_supplier,";
245 }
246 $sql .= " s.rowid as socid, s.nom as name,";
247 $sql .= " pl.statut as status, pl.amount as amount_requested";
248 $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p,";
249 $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
250 $sql .= " ".MAIN_DB_PREFIX."prelevement as pf";
251 if ($object->type != 'bank-transfer') {
252 $sql .= ", ".MAIN_DB_PREFIX."facture as f";
253 } else {
254 $sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
255 }
256 $sql .= ", ".MAIN_DB_PREFIX."societe as s";
257 $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
258 $sql .= " AND pl.fk_prelevement_bons = p.rowid";
259 $sql .= " AND f.fk_soc = s.rowid";
260 if ($object->type != 'bank-transfer') {
261 $sql .= " AND pf.fk_facture = f.rowid";
262 } else {
263 $sql .= " AND pf.fk_facture_fourn = f.rowid";
264 }
265 if ($object->type != 'bank-transfer') {
266 $sql .= " AND f.entity IN (".getEntity('invoice').")";
267 } else {
268 $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
269 }
270 if ($object->id > 0) {
271 $sql .= " AND p.rowid = ".((int) $object->id);
272 }
273 if ($socid > 0) {
274 $sql .= " AND s.rowid = ".((int) $socid);
275 }
276 $sql .= $db->order($sortfield, $sortorder);
277}
278// Count total nb of records
279$nbtotalofrecords = '';
280if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
281 $resql = $db->query($sql);
282 $nbtotalofrecords = $db->num_rows($resql);
283 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
284 $page = 0;
285 $offset = 0;
286 }
287}
288
289$sql .= $db->plimit($limit + 1, $offset);
290$resql = $db->query($sql);
291if ($resql) {
292 $num = $db->num_rows($resql);
293 $i = 0;
294
295 $param = "&id=".((int) $id);
296 if ($limit > 0 && $limit != $conf->liste_limit) {
297 $param .= '&limit='.((int) $limit);
298 }
299
300 // Lines of title fields
301 print '<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
302 if ($optioncss != '') {
303 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
304 }
305 print '<input type="hidden" name="token" value="'.newToken().'">';
306 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
307 print '<input type="hidden" name="action" value="list">';
308 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
309 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
310 print '<input type="hidden" name="page" value="'.$page.'">';
311 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
312 print '<input type="hidden" name="id" value="'.$id.'">';
313
314 $massactionbutton = '';
315 $title = ($salaryBonPl ? $langs->trans("Salaries") : ($object->type == 'bank-transfer' ? $langs->trans("SupplierInvoices") : $langs->trans("Invoices")));
316
317 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
318
319 print"\n<!-- debut table -->\n";
320 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
321 print '<table class="liste centpercent">';
322 print '<tr class="liste_titre">';
323 print_liste_field_titre(($salaryBonPl ? "Salary" : "Bill"), $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder);
324 if ($object->type == 'bank-transfer' && !$salaryBonPl) {
325 print_liste_field_titre("RefSupplierShort", $_SERVER["PHP_SELF"], "f.ref_supplier", '', $param, '', $sortfield, $sortorder);
326 }
327 print_liste_field_titre(($salaryBonPl ? "Employee" : "ThirdParty"), $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
328 print_liste_field_titre(($salaryBonPl ? "AmountSalary" : "AmountInvoice"), $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, '', $sortfield, $sortorder, 'right ');
329 print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, '', $sortfield, $sortorder, 'right ');
330 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, '"', $sortfield, $sortorder, 'center ');
331 print "</tr>\n";
332
333 $totalinvoices = 0;
334 $totalamount_requested = 0;
335 $salarytmp = null;
336 $usertmp = null;
337 $invoicetmpcustomer = null;
338 $invoicetmpsupplier = null;
339
340 if ($salaryBonPl) {
341 $salarytmp = new Salary($db);
342 $usertmp = new User($db);
343 } else {
344 $invoicetmpcustomer = new Facture($db);
345 $invoicetmpsupplier = new FactureFournisseur($db);
346 }
347
348 $imaxinloop = ($limit ? min($num, $limit) : $num);
349 while ($i < $imaxinloop) {
350 $obj = $db->fetch_object($resql);
351
352 $itemurl = '';
353 $partyurl = '';
354 if ($salaryBonPl && ($salarytmp instanceof Salary) && ($usertmp instanceof User)) {
355 $salarytmp->fetch($obj->salaryid);
356 $usertmp->fetch($obj->userid);
357 $itemurl = $salarytmp->getNomUrl(1);
358 $partyurl = $usertmp->getNomUrl(-1);
359 } elseif ($invoicetmpcustomer instanceof Facture && $invoicetmpsupplier instanceof FactureFournisseur) {
360 if ($obj->type == 'bank-transfer') {
361 $invoicetmp = $invoicetmpsupplier;
362 } else {
363 $invoicetmp = $invoicetmpcustomer;
364 }
365 $invoicetmp->fetch($obj->facid);
366
367 $thirdpartytmp->fetch($obj->socid);
368 $itemurl = $invoicetmp->getNomUrl(1);
369 $partyurl = $thirdpartytmp->getNomUrl(1);
370 }
371
372 print '<tr class="oddeven">';
373
374 print '<td class="nowraponall">';
375 print $itemurl;
376 print "</td>\n";
377
378 if ($object->type == 'bank-transfer' && !$salaryBonPl) {
379 $labeltoshow = '';
380 if ($invoicetmp instanceof Facture) {
381 $labeltoshow = $invoicetmp->ref_supplier;
382 }
383 print '<td class="tdoverflowmax150" title="'.dolPrintHTMLForAttribute($labeltoshow).'">';
384 if ($invoicetmp instanceof Facture) {
385 print dol_escape_htmltag($invoicetmp->ref_supplier);
386 }
387 print "</td>\n";
388 }
389
390 print '<td class="tdoverflowmax125">';
391 print $partyurl;
392 print "</td>\n";
393
394 // Amount of invoice
395 print '<td class="right"><span class="amount">'.price(($salaryBonPl ? $obj->amount : $obj->total_ttc))."</span></td>\n";
396
397 // Amount requested
398 print '<td class="right"><span class="amount">'.price($obj->amount_requested)."</span></td>\n";
399
400 // Status of requests
401 print '<td class="center">';
402 if ($obj->status == 0) {
403 print $langs->trans("StatusWaiting");
404 } elseif ($obj->status == 2) {
405 if ($obj->type == 'bank-transfer') {
406 print $langs->trans("StatusDebited");
407 } else {
408 print $langs->trans("StatusCredited");
409 }
410 } elseif ($obj->status == 3) {
411 print '<span class="error">'.$langs->trans("StatusRefused").'</span>';
412 }
413 print "</td>";
414
415 print "</tr>\n";
416
417 $totalinvoices += $obj->total_ttc;
418 $totalamount_requested += $obj->amount_requested;
419
420 $i++;
421 }
422
423 if ($num > 0) {
424 print '<tr class="liste_total">';
425 print '<td>'.$langs->trans("Total").'</td>';
426 if ($object->type == 'bank-transfer' && !$salaryBonPl) {
427 print '<td>&nbsp;</td>';
428 }
429 print '<td>&nbsp;</td>';
430 print '<td class="right">';
431 print "</td>\n";
432 print '<td class="right">';
433 // If the page show all record (no pagination) and total does not match total of file, we show a warning. Should not happen.
434 if (($nbtotalofrecords <= $num) && $totalamount_requested != (float) $object->amount) {
435 $langs->load("errors");
436 // Warning, amount of file (%s) differs from the sum of lines (%s)
437 print img_warning($langs->trans("WarningAmountOfFileDiffersFromSumOfLines", price((float) $object->amount), price($totalamount_requested)));
438 }
439 print price($totalamount_requested);
440 print "</td>\n";
441 print '<td>&nbsp;</td>';
442 print "</tr>\n";
443 }
444
445 print "</table>";
446 print '</div>';
447
448 $db->free($resql);
449} else {
451}
452
453// End of page
454llxFooter();
455$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class to manage bank accounts.
Class to manage withdrawal receipts.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage generation of HTML components Only common components must be here.
Class to manage salary payments.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_is_file($pathoffile)
Return if path is a file.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $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, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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, $morecssdiv='')
Show tabs of a record.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isModEnabled($module)
Is Dolibarr module enabled.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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...
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.