dolibarr 21.0.0-beta
product_lot.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2021 Christophe Battarel <christophe.battarel@altairis.fr>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
31
41// Load translation files required by the page
42$langs->loadLangs(array("admin", "products", "productbatch"));
43
44// Security check
45if (!$user->admin || (empty($conf->productbatch->enabled))) {
47}
48
49$action = GETPOST('action', 'alpha');
50$value = GETPOST('value', 'alpha');
51$label = GETPOST('label', 'alpha');
52$scandir = GETPOST('scan_dir', 'alpha');
53$type = 'product_batch';
54
55$error = 0;
56
57
58/*
59 * Actions
60 */
61
62include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
63
64if ($action == 'updateMaskLot') {
65 $maskconstbatch = GETPOST('maskconstLot', 'aZ09');
66 $maskbatch = GETPOST('maskLot', 'alpha');
67
68 if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) {
69 $res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity);
70 if ($res <= 0) {
71 $error++;
72 }
73 }
74
75 if (!$error) {
76 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
77 } else {
78 setEventMessages($langs->trans("Error"), null, 'errors');
79 }
80} elseif ($action == 'updateMaskSN') {
81 $maskconstbatch = GETPOST('maskconstSN', 'aZ09');
82 $maskbatch = GETPOST('maskSN', 'alpha');
83
84 if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) {
85 $res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity);
86 if ($res <= 0) {
87 $error++;
88 }
89 }
90
91 if (!$error) {
92 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
93 } else {
94 setEventMessages($langs->trans("Error"), null, 'errors');
95 }
96} elseif ($action == 'setmodlot') {
97 dolibarr_set_const($db, "PRODUCTBATCH_LOT_ADDON", $value, 'chaine', 0, '', $conf->entity);
98} elseif ($action == 'setmodsn') {
99 dolibarr_set_const($db, "PRODUCTBATCH_SN_ADDON", $value, 'chaine', 0, '', $conf->entity);
100} elseif ($action == 'setmaskslot') {
101 dolibarr_set_const($db, "PRODUCTBATCH_LOT_USE_PRODUCT_MASKS", $value, 'bool', 0, '', $conf->entity);
102 if ($value == '1' && getDolGlobalString('PRODUCTBATCH_LOT_ADDONS') !== 'mod_lot_advanced') {
103 dolibarr_set_const($db, "PRODUCTBATCH_LOT_ADDON", 'mod_lot_advanced', 'chaine', 0, '', $conf->entity);
104 }
105} elseif ($action == 'setmaskssn') {
106 dolibarr_set_const($db, "PRODUCTBATCH_SN_USE_PRODUCT_MASKS", $value, 'bool', 0, '', $conf->entity);
107 if ($value == '1' && getDolGlobalString('PRODUCTBATCH_SN_ADDONS') !== 'mod_sn_advanced') {
108 dolibarr_set_const($db, "PRODUCTBATCH_SN_ADDON", 'mod_sn_advanced', 'chaine', 0, '', $conf->entity);
109 }
110} elseif ($action == 'set') {
111 // Activate a model
112 $ret = addDocumentModel($value, $type, $label, $scandir);
113} elseif ($action == 'del') {
114 $ret = delDocumentModel($value, $type);
115 if ($ret > 0) {
116 if ($conf->global->FACTURE_ADDON_PDF == "$value") {
117 dolibarr_del_const($db, 'FACTURE_ADDON_PDF', $conf->entity);
118 }
119 }
120} elseif ($action == 'specimen') {
121 $modele = GETPOST('module', 'alpha');
122
123 $product_batch = new Productlot($db);
124 $product_batch->initAsSpecimen();
125
126 // Search template files
127 $file = '';
128 $classname = '';
129 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
130 foreach ($dirmodels as $reldir) {
131 $file = dol_buildpath($reldir . "core/modules/product_batch/doc/pdf_" . $modele . ".modules.php", 0);
132 if (file_exists($file)) {
133 $classname = "pdf_" . $modele;
134 break;
135 }
136 }
137
138 if ($classname !== '') {
139 require_once $file;
140
141 $module = new $classname($db);
142
143 '@phan-var-force ModelePDFProductBatch $module';
144
145 if ($module->write_file($product_batch, $langs) > 0) {
146 header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=product_batch&file=SPECIMEN.pdf");
147 return;
148 } else {
149 setEventMessages($module->error, $module->errors, 'errors');
150 dol_syslog($module->error, LOG_ERR);
151 }
152 } else {
153 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
154 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
155 }
156} elseif ($action == 'setdoc') {
157 // Set default model
158 if (dolibarr_set_const($db, "PRODUCT_BATCH_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
159 // La constante qui a ete lue en avant du nouveau set
160 // on passe donc par une variable pour avoir un affichage coherent
161 $conf->global->PRODUCT_BATCH_ADDON_PDF = $value;
162 }
163
164 // On active le modele
165 $ret = delDocumentModel($value, $type);
166 if ($ret > 0) {
167 $ret = addDocumentModel($value, $type, $label, $scandir);
168 }
169}
170
171/*
172 * View
173 */
174
175$form = new Form($db);
176
177$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
178
179llxHeader("", $langs->trans("ProductLotSetup"), '', '', 0, 0, '', '', '', 'mod-product page-admin_product_lot');
180
181$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
182print load_fiche_titre($langs->trans("ProductLotSetup"), $linkback, 'title_setup');
183
185
186print dol_get_fiche_head($head, 'settings', $langs->trans("Batch"), -1, 'lot');
187
188
189if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
190 // The feature to define the numbering module of lot or serial is no enabled because it is not used anywhere in Dolibarr code: You can set it
191 // but the numbering module is not used.
192 // TODO Use it on lot creation page, when you create a lot and when the lot number is kept empty to define the lot according
193 // to the selected product.
194 print $langs->trans("NothingToSetup");
195} else {
196 /*
197 * Lot Numbering models
198 */
199
200 print load_fiche_titre($langs->trans("BatchLotNumberingModules"), '', '');
201
202 print '<table class="noborder centpercent">';
203 print '<tr class="liste_titre">';
204 print '<td>'.$langs->trans("Name").'</td>';
205 print '<td>'.$langs->trans("Description").'</td>';
206 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
207 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
208 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
209 print '</tr>'."\n";
210
211 clearstatcache();
212
213 foreach ($dirmodels as $reldir) {
214 $dir = dol_buildpath($reldir."core/modules/product_batch/");
215
216 if (is_dir($dir)) {
217 $handle = opendir($dir);
218 if (is_resource($handle)) {
219 while (($file = readdir($handle)) !== false) {
220 if (substr($file, 0, 8) == 'mod_lot_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
221 $file = substr($file, 0, dol_strlen($file) - 4);
222
223 require_once $dir.$file.'.php';
224
225 $module = new $file($db);
226 '@phan-var-force ModeleNumRefBatch $module';
227
228 // Show modules according to features level
229 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
230 continue;
231 }
232 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
233 continue;
234 }
235
236 if ($module->isEnabled()) {
237 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
238 print $module->info($langs);
239 print '</td>';
240
241 // Show example of numbering model
242 print '<td class="nowrap">';
243 $tmp = $module->getExample();
244 if (preg_match('/^Error/', $tmp)) {
245 print '<div class="error">'.$langs->trans($tmp).'</div>';
246 } elseif ($tmp == 'NotConfigured') {
247 print $langs->trans($tmp);
248 } else {
249 print $tmp;
250 }
251 print '</td>'."\n";
252
253 print '<td class="center">';
254 if ($conf->global->PRODUCTBATCH_LOT_ADDON == $file) {
255 print img_picto($langs->trans("Activated"), 'switch_on');
256 } else {
257 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodlot&token='.newToken().'&value='.urlencode($file).'">';
258 print img_picto($langs->trans("Disabled"), 'switch_off');
259 print '</a>';
260 }
261 print '</td>';
262
263 $batch = new Productlot($db);
264 $batch->initAsSpecimen();
265
266 // Info
267 $htmltooltip = '';
268 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
269 $nextval = $module->getNextValue($mysoc, $batch);
270 if ((string) $nextval != $langs->trans("NotAvailable")) { // Keep " on nextval
271 $htmltooltip .= ''.$langs->trans("NextValue").': ';
272 if ($nextval) {
273 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
274 $nextval = $langs->trans($nextval);
275 }
276 $htmltooltip .= $nextval.'<br>';
277 } else {
278 $htmltooltip .= $langs->trans($module->error).'<br>';
279 }
280 }
281
282 print '<td class="center">';
283 print $form->textwithpicto('', $htmltooltip, 1, 0);
284 print '</td>';
285
286 print "</tr>\n";
287 }
288 }
289 }
290 closedir($handle);
291 }
292 }
293 }
294
295 print "</table><br>\n";
296
297
298 /*
299 * Serials Numbering models
300 */
301
302 print load_fiche_titre($langs->trans("BatchSerialNumberingModules"), '', '');
303
304 print '<table class="noborder centpercent">';
305 print '<tr class="liste_titre">';
306 print '<td>'.$langs->trans("Name").'</td>';
307 print '<td>'.$langs->trans("Description").'</td>';
308 print '<td class="nowrap">'.$langs->trans("Example").'</td>';
309 print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
310 print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
311 print '</tr>'."\n";
312
313 clearstatcache();
314
315 foreach ($dirmodels as $reldir) {
316 $dir = dol_buildpath($reldir."core/modules/product_batch/");
317
318 if (is_dir($dir)) {
319 $handle = opendir($dir);
320 if (is_resource($handle)) {
321 while (($file = readdir($handle)) !== false) {
322 if (substr($file, 0, 7) == 'mod_sn_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
323 $file = substr($file, 0, dol_strlen($file) - 4);
324
325 require_once $dir.$file.'.php';
326
327 $module = new $file($db);
328 '@phan-var-force ModeleNumRefBatch $module';
329
330 // Show modules according to features level
331 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
332 continue;
333 }
334 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
335 continue;
336 }
337
338 if ($module->isEnabled()) {
339 print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
340 print $module->info($langs);
341 print '</td>';
342
343 // Show example of numbering model
344 print '<td class="nowrap">';
345 $tmp = $module->getExample();
346 if (preg_match('/^Error/', $tmp)) {
347 print '<div class="error">'.$langs->trans($tmp).'</div>';
348 } elseif ($tmp == 'NotConfigured') {
349 print $langs->trans($tmp);
350 } else {
351 print $tmp;
352 }
353 print '</td>'."\n";
354
355 print '<td class="center">';
356 if ($conf->global->PRODUCTBATCH_SN_ADDON == $file) {
357 print img_picto($langs->trans("Activated"), 'switch_on');
358 } else {
359 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodsn&token='.newToken().'&value='.urlencode($file).'">';
360 print img_picto($langs->trans("Disabled"), 'switch_off');
361 print '</a>';
362 }
363 print '</td>';
364
365 $batch = new Productlot($db);
366 $batch->initAsSpecimen();
367
368 // Info
369 $htmltooltip = '';
370 $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
371 $nextval = $module->getNextValue($mysoc, $batch);
372 if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
373 $htmltooltip .= ''.$langs->trans("NextValue").': ';
374 if ($nextval) {
375 if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
376 $nextval = $langs->trans($nextval);
377 }
378 $htmltooltip .= $nextval.'<br>';
379 } else {
380 $htmltooltip .= $langs->trans($module->error).'<br>';
381 }
382 }
383
384 print '<td class="center">';
385 print $form->textwithpicto('', $htmltooltip, 1, 0);
386 print '</td>';
387
388 print "</tr>\n";
389 }
390 }
391 }
392 closedir($handle);
393 }
394 }
395 }
396
397 print "</table><br>\n";
398}
399
400// Module to build doc
401$def = array();
402$sql = "SELECT nom";
403$sql .= " FROM " . MAIN_DB_PREFIX . "document_model";
404$sql .= " WHERE type = '" . $db->escape($type) . "'";
405$sql .= " AND entity = " . $conf->entity;
406$resql = $db->query($sql);
407if ($resql) {
408 $i = 0;
409 $num_rows = $db->num_rows($resql);
410 while ($i < $num_rows) {
411 $array = $db->fetch_array($resql);
412 if (is_array($array)) {
413 array_push($def, $array[0]);
414 }
415 $i++;
416 }
417} else {
418 dol_print_error($db);
419}
420
421print '<br>';
422
423print load_fiche_titre($langs->trans("ProductBatchDocumentTemplates"), '', '');
424
425print '<div class="div-table-responsive-no-min">';
426print '<table class="noborder centpercent">';
427print '<tr class="liste_titre">';
428print '<td>' . $langs->trans("Name") . '</td>';
429print '<td>' . $langs->trans("Description") . '</td>';
430print '<td class="center" width="60">' . $langs->trans("Status") . "</td>\n";
431print '<td class="center" width="60">' . $langs->trans("Default") . "</td>\n";
432print '<td class="center"></td>';
433print '<td class="center" width="80">' . $langs->trans("Preview") . '</td>';
434print "</tr>\n";
435
436clearstatcache();
437
438$filelist = array();
439foreach ($dirmodels as $reldir) {
440 foreach (array('', '/doc') as $valdir) {
441 $dir = dol_buildpath($reldir . "core/modules/product_batch" . $valdir);
442 if (is_dir($dir)) {
443 $handle = opendir($dir);
444 if (is_resource($handle)) {
445 while (($file = readdir($handle)) !== false) {
446 $filelist[] = $file;
447 }
448 closedir($handle);
449 arsort($filelist);
450
451 foreach ($filelist as $file) {
452 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
453 if (file_exists($dir . '/' . $file)) {
454 $name = substr($file, 4, dol_strlen($file) - 16);
455 $classname = substr($file, 0, dol_strlen($file) - 12);
456
457 require_once $dir . '/' . $file;
458 $module = new $classname($db);
459 '@phan-var-force ModelePDFProductBatch $module';
460
461 $modulequalified = 1;
462 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
463 $modulequalified = 0;
464 }
465 if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
466 $modulequalified = 0;
467 }
468
469 if ($modulequalified) {
470 print '<tr class="oddeven"><td width="100">';
471 print(empty($module->name) ? $name : $module->name);
472 print "</td><td>\n";
473 if (method_exists($module, 'info')) {
474 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
475 } else {
476 print $module->description;
477 }
478 print '</td>';
479
480 // Active
481 if (in_array($name, $def)) {
482 print '<td class="center">' . "\n";
483 print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&token=' . newToken() . '&value=' . urlencode($name) . '">';
484 print img_picto($langs->trans("Enabled"), 'switch_on');
485 print '</a>';
486 print '</td>';
487 } else {
488 print '<td class="center">' . "\n";
489 print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&token=' . newToken() . '&value=' . urlencode($name) . '&scan_dir=' . urlencode($module->scandir) . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
490 print "</td>";
491 }
492
493 // Default
494 print '<td class="center">';
495 if (getDolGlobalString('PRODUCT_BATCH_ADDON_PDF') == $name) {
496 print img_picto($langs->trans("Default"), 'on');
497 } else {
498 print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&token=' . newToken() . '&value=' . urlencode($name) . '&scan_dir=' . urlencode($module->scandir) . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
499 }
500 print '</td>';
501
502 // Info
503 $htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name;
504 $htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown"));
505 if ($module->type == 'pdf') {
506 $htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
507 }
508 $htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
509 $htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
510 $htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
511
512
513 print '<td class="center">';
514 print $form->textwithpicto('', $htmltooltip, 1, 0);
515 print '</td>';
516
517 // Preview
518 print '<td class="center">';
519 if ($module->type == 'pdf') {
520 print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'contract') . '</a>';
521 } else {
522 print img_object($langs->trans("PreviewNotAvailable"), 'generic');
523 }
524 print '</td>';
525
526 print "</tr>\n";
527 }
528 }
529 }
530 }
531 }
532 }
533 }
534}
535
536print '</table>';
537print '</div>';
538
539// End of page
540llxFooter();
541$db->close();
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
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:71
Class to manage generation of HTML components Only common components must be here.
Class with list of lots and properties.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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.
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 a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
product_lot_admin_prepare_head()
Return array head with list of tabs to view object information.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:152
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.