dolibarr 21.0.0-alpha
agenda_other.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
5 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
6 * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
7 * Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
8 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
9 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31// Load Dolibarr environment
32require '../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';
37require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
38
39if (!$user->admin) {
41}
42
43// Load translation files required by the page
44$langs->loadLangs(array('admin', 'other', 'agenda', 'users'));
45
46$action = GETPOST('action', 'aZ09');
47$value = GETPOST('value', 'alpha');
48$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
49
50$param = GETPOST('param', 'alpha');
51$cancel = GETPOST('cancel', 'alpha');
52$scandir = GETPOST('scan_dir', 'alpha');
53$type = 'action';
54
55
56/*
57 * Actions
58 */
59
60$error = 0;
61$errors = array();
62
63include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
64
65$reg = array();
66if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
67 $code = $reg[1];
68 $value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
69 if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) {
70 header("Location: ".$_SERVER["PHP_SELF"]);
71 exit;
72 } else {
73 dol_print_error($db);
74 }
75}
76
77if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
78 $code = $reg[1];
79 if (dolibarr_del_const($db, $code, $conf->entity) > 0) {
80 header("Location: ".$_SERVER["PHP_SELF"]);
81 exit;
82 } else {
83 dol_print_error($db);
84 }
85}
86if ($action == 'set') {
87 $getDefaultFilter = GETPOST('AGENDA_DEFAULT_FILTER_TYPE');
88 $defaultfilter = (is_array($getDefaultFilter)) ? implode(',', $getDefaultFilter) : $getDefaultFilter;
89 dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
90 dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity);
91 dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
92 dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
93
94 $defaultValues = new DefaultValues($db);
95 $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity));
96 if (!is_array($result) && $result < 0) {
97 setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
98 } elseif (count($result) > 0) {
99 foreach ($result as $defval) {
100 $defaultValues->id = $defval->id;
101 $resultDel = $defaultValues->delete($user);
102 if ($resultDel < 0) {
103 setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
104 }
105 }
106 }
107 $defaultValues->type = 'createform';
108 $defaultValues->entity = $conf->entity;
109 $defaultValues->user_id = 0;
110 $defaultValues->page = 'comm/action/card.php';
111 $defaultValues->param = 'complete';
112 $defaultValues->value = GETPOST('AGENDA_EVENT_DEFAULT_STATUS');
113 $resultCreat = $defaultValues->create($user);
114 if ($resultCreat < 0) {
115 setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
116 } else {
117 setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
118 }
119} elseif ($action == 'specimen') { // For actioncomm
120 $modele = GETPOST('module', 'alpha');
121
122 $action = new ActionComm($db);
123 $action->initAsSpecimen();
124 $specimenthirdparty = new Societe($db);
125 $specimenthirdparty->initAsSpecimen();
126 $action->thirdparty = $specimenthirdparty;
127
128 // Search template files
129 $file = '';
130 $classname = '';
131 $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
132 foreach ($dirmodels as $reldir) {
133 $file = dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php", 0);
134 if (file_exists($file)) {
135 $classname = "pdf_".$modele;
136 break;
137 }
138 }
139
140 if ($classname !== '') {
141 require_once $file;
142
143 $module = new $classname($db, $action);
144 '@phan-var-force pdf_standard_actions $module';
145
146 if ($module->write_file($action, $langs) > 0) {
147 header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
148 return;
149 } else {
150 setEventMessages($module->error, $module->errors, 'errors');
151 dol_syslog($module->error, LOG_ERR);
152 }
153 } else {
154 setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
155 dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
156 }
157} elseif ($action == 'setmodel') {
158 // Activate a model
159 //print "sssd".$value;
160 $ret = addDocumentModel($value, $type, $label, $scandir);
161} elseif ($action == 'del') {
162 $ret = delDocumentModel($value, $type);
163 if ($ret > 0) {
164 if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") {
165 dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF', $conf->entity);
166 }
167 }
168} elseif ($action == 'setdoc') {
169 // Set default model
170 if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
171 // La constante qui a ete lue en avant du nouveau set
172 // on passe donc par une variable pour avoir un affichage coherent
173 $conf->global->ACTION_EVENT_ADDON_PDF = $value;
174 }
175
176 // On active le modele
177 $ret = delDocumentModel($value, $type);
178 if ($ret > 0) {
179 $ret = addDocumentModel($value, $type, $label, $scandir);
180 }
181}
182
183
188$form = new Form($db);
189$formactions = new FormActions($db);
190
191$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
192
193$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
194llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-agenda_other');
195
196$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
197print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
198
199
200
201$head = agenda_prepare_head();
202
203print dol_get_fiche_head($head, 'other', $langs->trans("Agenda"), -1, 'action');
204
205
206/*
207 * Miscellaneous
208 */
209
210// Define an array def of models
211$def = array();
212
213$sql = "SELECT nom";
214$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
215$sql .= " WHERE type = 'action'";
216$sql .= " AND entity = ".$conf->entity;
217
218$resql = $db->query($sql);
219if ($resql) {
220 $i = 0;
221 $num_rows = $db->num_rows($resql);
222 while ($i < $num_rows) {
223 $array = $db->fetch_array($resql);
224 if (is_array($array)) {
225 array_push($def, $array[0]);
226 }
227 $i++;
228 }
229} else {
230 dol_print_error($db);
231}
232
233if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
234 print load_fiche_titre($langs->trans("AgendaModelModule"), '', '');
235
236 print '<table class="noborder centpercent">'."\n";
237 print '<tr class="liste_titre">'."\n";
238 print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
239 print '<td>'.$langs->trans("Description").'</td>'."\n";
240 print '<td class="center" width="60">'.$langs->trans("Status").'</td>'."\n";
241 print '<td class="center" width="60">'.$langs->trans("Default").'</td>'."\n";
242 print '<td class="center" width="40">'.$langs->trans("ShortInfo").'</td>';
243 print '<td class="center" width="40">'.$langs->trans("Preview").'</td>';
244 print '</tr>'."\n";
245
246 clearstatcache();
247
248 $specimenthirdparty = new Societe($db);
249 $specimenthirdparty->initAsSpecimen();
250
251 foreach ($dirmodels as $reldir) {
252 $dir = dol_buildpath($reldir."core/modules/action/doc");
253
254 if (is_dir($dir)) {
255 $handle = opendir($dir);
256 if (is_resource($handle)) {
257 while (($file = readdir($handle)) !== false) {
258 if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
259 $name = substr($file, 4, dol_strlen($file) - 16);
260 $classname = substr($file, 0, dol_strlen($file) - 12);
261 require_once $dir.'/'.$file;
262 $module = new $classname($db, new ActionComm($db));
263
264 '@phan-var-force ModeleAction $module';
265
266 print '<tr class="oddeven">'."\n";
267 print "<td>";
268 print(empty($module->name) ? $name : $module->name);
269 print "</td>\n";
270 print "<td>\n";
271 require_once $dir.'/'.$file;
272 $module = new $classname($db, $specimenthirdparty);
273 '@phan-var-force ModeleAction $module';
274 if (method_exists($module, 'info')) {
275 print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
276 } else {
277 print $module->description;
278 }
279 print "</td>\n";
280
281 // Active
282 if (in_array($name, $def)) {
283 print '<td class="center">'."\n";
284 if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") {
285 print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">';
286 print img_picto($langs->trans("Enabled"), 'switch_on');
287 print '</a>';
288 } else {
289 print img_picto($langs->trans("Enabled"), 'switch_on');
290 }
291 print "</td>";
292 } else {
293 print '<td class="center">'."\n";
294 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
295 print "</td>";
296 }
297
298 // Default
299 print '<td class="center">';
300 if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") {
301 print img_picto($langs->trans("Default"), 'on');
302 } else {
303 print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&amp;scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
304 }
305 print '</td>';
306
307 // Info
308 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
309 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
310 $htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
311 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
312 $htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
313 print '<td class="center">';
314 print $form->textwithpicto('', $htmltooltip, 1, 0);
315 print '</td>';
316 print '<td class="center">';
317 print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
318 print '</td>';
319
320 print "</tr>\n";
321 }
322 }
323 closedir($handle);
324 }
325 }
326 }
327 print '</table><br>';
328
329 print load_fiche_titre($langs->trans('MiscellaneousOptions'), '', '');
330}
331
332
333print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
334print '<input type="hidden" name="token" value="'.newToken().'">';
335print '<input type="hidden" name="action" value="set">';
336
337print '<table class="noborder allwidth">'."\n";
338print '<tr class="liste_titre">'."\n";
339print '<td>'.$langs->trans("Parameters").'</td>'."\n";
340print '<td class="center">&nbsp;</td>'."\n";
341print '<td class="right">'.$langs->trans("Value").'</td>'."\n";
342print '</tr>'."\n";
343
344// AGENDA_DEFAULT_VIEW
345print '<tr class="oddeven">'."\n";
346$htmltext = $langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup"));
347print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'</td>'."\n";
348print '<td class="center">&nbsp;</td>'."\n";
349print '<td class="right">'."\n";
350$tmplist = array('' => '&nbsp;', 'show_list' => $langs->trans("ViewList"), 'show_month' => $langs->trans("ViewCal"), 'show_week' => $langs->trans("ViewWeek"), 'show_day' => $langs->trans("ViewDay"), 'show_peruser' => $langs->trans("ViewPerUser"));
351print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW'));
352print '</td></tr>'."\n";
353
354// Manual or automatic
355
356print '<tr class="oddeven">'."\n";
357print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE").'</td>'."\n";
358print '<td class="center">&nbsp;</td>'."\n";
359print '<td class="right">'."\n";
360//print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list
361if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
362 print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
363} else {
364 print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE&token='.newToken().'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
365}
366print '</td></tr>'."\n";
367
368if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
369 print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
370 print '<tr class="oddeven">'."\n";
371 print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
372 print '<td class="center">&nbsp;</td>'."\n";
373 print '<td class="right nowrap">'."\n";
374 print $formactions->select_type_actions(getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT'), "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1, 0, 1, 'minwidth300', 1);
375 print '</td></tr>'."\n";
376}
377
378// AGENDA_EVENT_DEFAULT_STATUS
379print '<tr class="oddeven">'."\n";
380print '<td>'.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").'</td>'."\n";
381print '<td class="center">&nbsp;</td>'."\n";
382print '<td class="right nowrap">'."\n";
383$defval = 'na';
384$defaultValues = new DefaultValues($db);
385$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => $conf->entity));
386if (!is_array($result) && $result < 0) {
387 setEventMessages($defaultValues->error, $defaultValues->errors, 'errors');
388} elseif (count($result) > 0) {
389 $defval = reset($result)->value;
390}
391$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200 onrightofpage');
392print '</td></tr>'."\n";
393
394// AGENDA_DEFAULT_FILTER_TYPE
395print '<tr class="oddeven">'."\n";
396print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").'</td>'."\n";
397print '<td class="center">&nbsp;</td>'."\n";
398print '<td class="right nowrap">'."\n";
399$multiselect = 0;
400if (getDolGlobalString('MAIN_ENABLE_MULTISELECT_TYPE')) {
401 // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
402 $multiselect = (getDolGlobalString('AGENDA_USE_EVENT_TYPE'));
403}
404print $formactions->select_type_actions(getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE'), "AGENDA_DEFAULT_FILTER_TYPE", '', (getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? -1 : 1), 1, $multiselect, 1, 'minwidth300', 1);
405print '</td></tr>'."\n";
406
407// AGENDA_DEFAULT_FILTER_STATUS
408// TODO Remove to use the default generic feature
409print '<tr class="oddeven">'."\n";
410print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
411print '<td class="center">&nbsp;</td>'."\n";
412print '<td class="right">'."\n";
413$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
414print '</td></tr>'."\n";
415
416print '</table>';
417
418print $form->buttonsSaveCancel("Save", '');
419
420print '</form>';
421
422
423print dol_get_fiche_end();
424
425// End of page
426llxFooter();
427$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.
agenda_prepare_head()
Prepare array with list of tabs.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $form
View.
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:70
Class to manage agenda events (actions)
Class for MyObject.
Class to manage building of HTML components.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
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_get_fiche_end($notab=0)
Return tab footer of a card.
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.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.