37require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
45$langs->loadLangs(array(
'companies',
'bills',
'banks',
'compta'));
47$action =
GETPOST(
'action',
'alpha');
48$massaction =
GETPOST(
'massaction',
'alpha');
49$optioncss =
GETPOST(
'optioncss',
'alpha');
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'vendorpaymentlist';
52$socid =
GETPOST(
'socid',
'int');
55if ($user->socid) $socid = $user->socid;
57$search_ref =
GETPOST(
'search_ref',
'alpha');
58$search_date_startday =
GETPOST(
'search_date_startday',
'int');
59$search_date_startmonth =
GETPOST(
'search_date_startmonth',
'int');
60$search_date_startyear =
GETPOST(
'search_date_startyear',
'int');
61$search_date_endday =
GETPOST(
'search_date_endday',
'int');
62$search_date_endmonth =
GETPOST(
'search_date_endmonth',
'int');
63$search_date_endyear =
GETPOST(
'search_date_endyear',
'int');
64$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
65$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
66$search_company =
GETPOST(
'search_company',
'alpha');
67$search_payment_type =
GETPOST(
'search_payment_type');
68$search_cheque_num =
GETPOST(
'search_cheque_num',
'alpha');
69$search_bank_account =
GETPOST(
'search_bank_account',
'int');
70$search_amount =
GETPOST(
'search_amount',
'alpha');
71$search_sale =
GETPOST(
'search_sale',
'int');
73$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
74$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
75$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
76$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
'page',
'int');
78if (empty($page) || $page == -1) {
81$offset = $limit * $page;
89 $sortfield =
"p.datep";
92$search_all = trim(GETPOSTISSET(
"search_all") ?
GETPOST(
"search_all",
'alpha') :
GETPOST(
'sall'));
95$fieldstosearchall = array(
96 'p.ref'=>
"RefPayment",
97 's.nom'=>
"ThirdParty",
98 'p.num_paiement'=>
"Numero",
103 'p.ref' =>array(
'label'=>
"RefPayment",
'checked'=>1,
'position'=>10),
104 'p.datep' =>array(
'label'=>
"Date",
'checked'=>1,
'position'=>20),
105 's.nom' =>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>30),
106 'c.libelle' =>array(
'label'=>
"Type",
'checked'=>1,
'position'=>40),
107 'p.num_paiement' =>array(
'label'=>
"Numero",
'checked'=>1,
'position'=>50,
'tooltip'=>
"ChequeOrTransferNumber"),
108 'ba.label' =>array(
'label'=>
"Account",
'checked'=>1,
'position'=>60,
'enable'=>(isModEnabled(
"banque"))),
109 'p.amount' =>array(
'label'=>
"Amount",
'checked'=>1,
'position'=>70),
114$hookmanager->initHooks(array(
'paymentsupplierlist'));
117if (!$user->hasRight(
'societe',
'client',
'voir')) {
118 $search_sale = $user->id;
123 $socid = $user->socid;
132if (!isModEnabled(
'supplier_invoice')) {
135if ((!$user->hasRight(
"fournisseur",
"facture",
"lire") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))
136 || (!$user->hasRight(
"supplier_invoice",
"lire") && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD))) {
145$parameters = array(
'socid'=>$socid);
146$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
151if (empty($reshook)) {
152 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
154 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
156 $search_date_startday =
'';
157 $search_date_startmonth =
'';
158 $search_date_startyear =
'';
159 $search_date_endday =
'';
160 $search_date_endmonth =
'';
161 $search_date_endyear =
'';
162 $search_date_start =
'';
163 $search_date_end =
'';
164 $search_company =
'';
165 $search_payment_type =
'';
166 $search_cheque_num =
'';
167 $search_bank_account =
'';
176llxHeader(
'', $langs->trans(
'ListPayment'));
178$form =
new Form($db);
180$accountstatic =
new Account($db);
181$companystatic =
new Societe($db);
184$sql =
'SELECT p.rowid, p.ref, p.datep, p.fk_bank, p.statut, p.num_paiement, p.amount';
185$sql .=
', c.code as paiement_type, c.libelle as paiement_libelle';
186$sql .=
', ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal as accountancy_journal';
187$sql .=
', s.rowid as socid, s.nom as name, s.email';
190$sql .=
", SUM(pf.amount) as totalamount, COUNT(f.rowid) as nbinvoices";
194$sql .=
' FROM '.MAIN_DB_PREFIX.
'paiementfourn AS p';
195$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_paiement AS c ON p.fk_paiement = c.id';
196$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
197$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
199$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
200$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
201$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe AS s ON s.rowid = f.fk_soc';
203$sql .=
' WHERE f.entity IN ('.getEntity(
'supplier_invoice').
')';
205 $sql .=
" AND EXISTS (SELECT f.fk_soc FROM ".MAIN_DB_PREFIX.
"facture_fourn as f, ".MAIN_DB_PREFIX.
"paiementfourn_facturefourn as pf";
206 $sql .=
" WHERE p.rowid = pf.fk_paiementfourn AND pf.fk_facturefourn = f.rowid AND f.fk_soc = ".((int) $socid).
")";
213if ($search_date_start) {
214 $sql .=
" AND p.datep >= '" . $db->idate($search_date_start) .
"'";
216if ($search_date_end) {
217 $sql .=
" AND p.datep <= '" . $db->idate($search_date_end) .
"'";
220if ($search_company) {
223if ($search_payment_type !=
'') {
224 $sql .=
" AND c.code = '".$db->escape($search_payment_type).
"'";
226if ($search_cheque_num !=
'') {
230 $sql .=
" AND (".natural_search(
'p.amount', $search_amount, 1, 1);
235if ($search_bank_account > 0) {
236 $sql .=
' AND b.fk_account = '.((int) $search_bank_account);
239 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
242if ($search_sale && $search_sale !=
'-1') {
243 if ($search_sale == -2) {
244 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
245 } elseif ($search_sale > 0) {
246 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
251include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
253$sql .=
' GROUP BY p.rowid, p.ref, p.datep, p.fk_bank, p.statut, p.num_paiement, p.amount, s.rowid, s.nom, s.email, c.code, c.libelle,';
254$sql .=
' ba.rowid, ba.ref, ba.label, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.fk_accountancy_journal';
257$nbtotalofrecords =
'';
260 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(DISTINCT p.rowid) as nbtotalofrecords', $sql);
261 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
262 $resql = $db->query($sqlforcount);
264 $objforcount = $db->fetch_object($resql);
265 $nbtotalofrecords = $objforcount->nbtotalofrecords;
270 if (($page * $limit) > $nbtotalofrecords) {
278$sql .= $db->order($sortfield, $sortorder);
280 $sql .= $db->plimit($limit + 1, $offset);
284$resql = $db->query($sql);
292$num = $db->num_rows($resql);
296if (!empty($contextpage) && $contextpage != $_SERVER[
'PHP_SELF']) {
297 $param .=
'&contextpage='.urlencode($contextpage);
299if ($limit > 0 && $limit != $conf->liste_limit) {
300 $param .=
'&limit='.((int) $limit);
302if ($optioncss !=
'') {
303 $param .=
'&optioncss='.urlencode($optioncss);
307 $param .=
'&search_ref='.urlencode($search_ref);
309if ($search_date_startday) {
310 $param .=
'&search_date_startday='.urlencode($search_date_startday);
312if ($search_date_startmonth) {
313 $param .=
'&search_date_startmonth='.urlencode($search_date_startmonth);
315if ($search_date_startyear) {
316 $param .=
'&search_date_startyear='.urlencode($search_date_startyear);
318if ($search_date_endday) {
319 $param .=
'&search_date_endday='.urlencode($search_date_endday);
321if ($search_date_endmonth) {
322 $param .=
'&search_date_endmonth='.urlencode($search_date_endmonth);
324if ($search_date_endyear) {
325 $param .=
'&search_date_endyear='.urlencode($search_date_endyear);
327if ($search_company) {
328 $param .=
'&search_company='.urlencode($search_company);
330if ($search_payment_type) {
331 $param .=
'&search_company='.urlencode($search_payment_type);
333if ($search_cheque_num) {
334 $param .=
'&search_cheque_num='.urlencode($search_cheque_num);
337 $param .=
'&search_amount='.urlencode($search_amount);
341include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
343print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
344if ($optioncss !=
'') {
345 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
347print
'<input type="hidden" name="token" value="'.newToken().
'">';
348print
'<input type="hidden" name="action" value="list">';
349print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
350print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
351print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
352print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
354print_barre_liste($langs->trans(
'SupplierPayments'), $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'supplier_invoice', 0,
'',
'', $limit, 0, 0, 1);
357 foreach ($fieldstosearchall as $key => $val) {
358 $fieldstosearchall[$key] = $langs->trans($val);
360 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
365$parameters = array();
366$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
367if (empty($reshook)) {
368 $moreforfilter .= $hookmanager->resPrint;
370 $moreforfilter = $hookmanager->resPrint;
374 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
375 print $moreforfilter;
379$varpage = empty($contextpage) ? $_SERVER[
'PHP_SELF'] : $contextpage;
380$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
381if (!empty($massactionbutton)) {
382 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
385print
'<div class="div-table-responsive">';
386print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
'').
'">';
388print
'<tr class="liste_titre_filter">';
391if (!empty($arrayfields[
'p.ref'][
'checked'])) {
392 print
'<td class="liste_titre left">';
393 print
'<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
398if (!empty($arrayfields[
'p.datep'][
'checked'])) {
399 print
'<td class="liste_titre center">';
400 print
'<div class="nowrap">';
401 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
403 print
'<div class="nowrap">';
404 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
410if (!empty($arrayfields[
's.nom'][
'checked'])) {
411 print
'<td class="liste_titre">';
412 print
'<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
417if (!empty($arrayfields[
'c.libelle'][
'checked'])) {
418 print
'<td class="liste_titre">';
419 $form->select_types_paiements($search_payment_type,
'search_payment_type',
'', 2, 1, 1);
424if (!empty($arrayfields[
'p.num_paiement'][
'checked'])) {
425 print
'<td class="liste_titre">';
426 print
'<input class="flat" type="text" size="4" name="search_cheque_num" value="'.dol_escape_htmltag($search_cheque_num).
'">';
431if (!empty($arrayfields[
'ba.label'][
'checked'])) {
432 print
'<td class="liste_titre">';
433 $form->select_comptes($search_bank_account,
'search_bank_account', 0,
'', 1);
438if (!empty($arrayfields[
'p.amount'][
'checked'])) {
439 print
'<td class="liste_titre right">';
440 print
'<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'">';
445$parameters = array(
'arrayfields'=>$arrayfields);
446$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
447print $hookmanager->resPrint;
450print
'<td class="liste_titre maxwidthsearch">';
451print $form->showFilterAndCheckAddButtons(0);
456print
'<tr class="liste_titre">';
457if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
460if (!empty($arrayfields[
'p.ref'][
'checked'])) {
461 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'p.rowid',
'', $param,
'', $sortfield, $sortorder);
463if (!empty($arrayfields[
'p.datep'][
'checked'])) {
464 print_liste_field_titre($arrayfields[
'p.datep'][
'label'], $_SERVER[
"PHP_SELF"],
'p.datep',
'', $param,
'', $sortfield, $sortorder,
'center ');
466if (!empty($arrayfields[
's.nom'][
'checked'])) {
467 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
469if (!empty($arrayfields[
'c.libelle'][
'checked'])) {
470 print_liste_field_titre($arrayfields[
'c.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
'c.libelle',
'', $param,
'', $sortfield, $sortorder);
472if (!empty($arrayfields[
'p.num_paiement'][
'checked'])) {
473 print_liste_field_titre($arrayfields[
'p.num_paiement'][
'label'], $_SERVER[
"PHP_SELF"],
"p.num_paiement",
'', $param,
'', $sortfield, $sortorder,
'', $arrayfields[
'p.num_paiement'][
'tooltip']);
475if (!empty($arrayfields[
'ba.label'][
'checked'])) {
476 print_liste_field_titre($arrayfields[
'ba.label'][
'label'], $_SERVER[
"PHP_SELF"],
'ba.label',
'', $param,
'', $sortfield, $sortorder);
478if (!empty($arrayfields[
'p.amount'][
'checked'])) {
479 print_liste_field_titre($arrayfields[
'p.amount'][
'label'], $_SERVER[
"PHP_SELF"],
'p.amount',
'', $param,
'', $sortfield, $sortorder,
'right ');
483$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
484$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
485print $hookmanager->resPrint;
487print_liste_field_titre($selectedfields, $_SERVER[
'PHP_SELF'],
'',
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
491foreach ($arrayfields as $column) {
492 if ($column[
'checked']) {
498$totalarray = array();
499while ($i < min($num, $limit)) {
500 $objp = $db->fetch_object($resql);
502 $paymentfournstatic->id = $objp->rowid;
503 $paymentfournstatic->ref = $objp->ref;
504 $paymentfournstatic->datepaye = $db->jdate($objp->datep);
505 $paymentfournstatic->amount = $objp->amount;
507 $companystatic->id = $objp->socid;
508 $companystatic->name = $objp->name;
509 $companystatic->email = $objp->email;
511 print
'<tr class="oddeven">';
514 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
515 print
'<td class="nowraponall">'.(($offset * $limit) + $i).
'</td>';
517 $totalarray[
'nbfield']++;
522 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
523 print
'<td class="nowraponall">';
524 print $paymentfournstatic->getNomUrl(1);
527 $totalarray[
'nbfield']++;
532 if (!empty($arrayfields[
'p.datep'][
'checked'])) {
533 $dateformatforpayment =
'dayhour';
534 print
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).
'</td>';
536 $totalarray[
'nbfield']++;
541 if (!empty($arrayfields[
's.nom'][
'checked'])) {
542 print
'<td class="tdoverflowmax125">';
543 if ($objp->socid > 0) {
544 print $companystatic->getNomUrl(1,
'', 24);
548 $totalarray[
'nbfield']++;
553 if (!empty($arrayfields[
'c.libelle'][
'checked'])) {
554 $payment_type = $langs->trans(
"PaymentType".$objp->paiement_type) != (
"PaymentType".$objp->paiement_type) ? $langs->trans(
"PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
555 print
'<td>'.$payment_type.
' '.
dol_trunc($objp->num_paiement, 32).
'</td>';
557 $totalarray[
'nbfield']++;
562 if (!empty($arrayfields[
'p.num_paiement'][
'checked'])) {
563 print
'<td>'.$objp->num_paiement.
'</td>';
565 $totalarray[
'nbfield']++;
570 if (!empty($arrayfields[
'ba.label'][
'checked'])) {
571 print
'<td class="tdoverflowmax125">';
573 $accountstatic->id = $objp->bid;
574 $accountstatic->ref = $objp->bref;
575 $accountstatic->label = $objp->blabel;
576 $accountstatic->number = $objp->number;
577 $accountstatic->iban = $objp->iban_prefix;
578 $accountstatic->bic = $objp->bic;
579 $accountstatic->currency_code = $objp->currency_code;
580 $accountstatic->account_number = $objp->account_number;
583 $accountingjournal->fetch($objp->accountancy_journal);
584 $accountstatic->accountancy_journal = $accountingjournal->code;
586 print $accountstatic->getNomUrl(1);
592 $totalarray[
'nbfield']++;
597 if (!empty($arrayfields[
'p.amount'][
'checked'])) {
598 print
'<td class="right">';
599 if ($objp->nbinvoices > 1 || ($objp->totalamount && $objp->amount != $objp->totalamount)) {
600 print $form->textwithpicto(
'', $langs->trans(
"PaymentMadeForSeveralInvoices"));
602 print
'<span class="amount">'.price($objp->amount).
'</span>';
605 $totalarray[
'nbfield']++;
607 $totalarray[
'pos'][$checkedCount] =
'amount';
608 $totalarray[
'val'][
'amount'] += $objp->amount;
614 $totalarray[
'nbfield']++;
622include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
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 accounting accounts.
Class to manage payments for supplier invoices.
Class to manage third parties objects (customers, suppliers, prospects...)
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...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
print_barre_liste($titre, $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.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.