dolibarr 21.0.0-alpha
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
3 * Copyright (C) 2019-2020 Open-DSI <support@open-dsi.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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
27// General defined Options
28//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
29//if (! defined('MAIN_AUTHENTICATION_MODE')) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
30//if (! defined('MAIN_LANG_DEFAULT')) define('MAIN_LANG_DEFAULT', 'auto'); // Force LANG (language) to a particular value
31//if (! defined('MAIN_SECURITY_FORCECSP')) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
32//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
33//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34//if (! defined('NOLOGIN')) define('NOLOGIN', '1'); // Do not use login - if this page is public (can be called outside logged session). This includes the NOIPCHECK too.
35//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
36//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
37//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // Do not load html.form.class.php
38//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // Do not load and show top and left menu
39//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
40//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
41//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
42//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
43//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
44//if (! defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions
45//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
46//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
47
48
49// Load Dolibarr environment
50require '../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
53require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
54
55// Load translation files required by the page
56$langs->loadLangs(array('intracommreport'));
57
58// Get parameters
59$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
60$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
61$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
62$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
63$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
64$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
65$optioncss = GETPOST('optioncss', 'alpha');
66$mode = GETPOST('mode', 'aZ');
67
68$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
69$search_ref = GETPOST("search_ref", 'alpha');
70$search_type = GETPOST("search_type", 'int');
71
72// Initialize context for list
73$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'intracommreportlist';
74if ((string) $type == '1') {
75 $contextpage = 'DESlist';
76 if ($search_type == '') {
77 $search_type = '1';
78 }
79}
80if ((string) $type == '0') {
81 $contextpage = 'DEBlist';
82 if ($search_type == '') {
83 $search_type = '0';
84 }
85}
86
87$diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
88
89// Load variable for pagination
90$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
91$sortfield = GETPOST('sortfield', 'aZ09comma');
92$sortorder = GETPOST('sortorder', 'aZ09comma');
93$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
94if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
95 // If $page is not defined, or '' or -1 or if we click on clear filters
96 $page = 0;
97}
98$offset = $limit * $page;
99$pageprev = $page - 1;
100$pagenext = $page + 1;
101
102
103// Initialize a technical objects
104$object = new IntracommReport($db);
105$extrafields = new ExtraFields($db);
106$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
107$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
108
109// Fetch optionals attributes and labels
110$extrafields->fetch_name_optionals_label($object->table_element);
111//$extrafields->fetch_name_optionals_label($object->table_element_line);
112
113$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
114
115// Default sort order (if not yet defined by previous GETPOST)
116if (!$sortfield) {
117 reset($object->fields); // Reset is required to avoid key() to return null.
118 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
119}
120if (!$sortorder) {
121 $sortorder = "ASC";
122}
123
124// Initialize array of search criteria
125$search_all = trim(GETPOST('search_all', 'alphanohtml'));
126$search = array();
127foreach ($object->fields as $key => $val) {
128 if (GETPOST('search_'.$key, 'alpha') !== '') {
129 $search[$key] = GETPOST('search_'.$key, 'alpha');
130 }
131 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
132 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
133 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
134 }
135}
136
137$fieldstosearchall = array(
138 't.ref' => "Ref",
139);
140
141// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
142$object = new IntracommReport($db);
143$hookmanager->initHooks(array('intracommreportlist'));
144$extrafields = new ExtraFields($db);
145$form = new Form($db);
146
147/*
148// fetch optionals attributes and labels
149$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
150$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
151*/
152
153if (empty($action)) {
154 $action = 'list';
155}
156
157
158
159// Definition of array of fields for columns
160$arrayfields = array();
161foreach ($object->fields as $key => $val) {
162 // If $val['visible']==0, then we never show the field
163 if (!empty($val['visible'])) {
164 $visible = (int) dol_eval($val['visible'], 1);
165 $arrayfields['t.'.$key] = array(
166 'label' => $val['label'],
167 'checked' => (($visible < 0) ? 0 : 1),
168 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
169 'position' => $val['position'],
170 'help' => isset($val['help']) ? $val['help'] : ''
171 );
172 }
173}
174// Extra fields
175include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
176
177$object->fields = dol_sort_array($object->fields, 'position');
178//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
179$arrayfields = dol_sort_array($arrayfields, 'position');
180
181
182//$isInEEC = isInEEC($mysoc);
183
184
185$permissiontoread = $user->hasRight('intracommreport', 'read');
186$permissiontoadd = $user->hasRight('intracommreport', 'write');
187$permissiontodelete = $user->hasRight('intracommreport', 'delete');
188
189// Security check
190if ($search_type == '0') {
191 $result = restrictedArea($user, 'produit', '', '', '', '', '', 0);
192} elseif ($search_type == '1') {
193 $result = restrictedArea($user, 'service', '', '', '', '', '', 0);
194} else {
195 $result = restrictedArea($user, 'produit|service', '', '', '', '', '', 0);
196}
197
198if (!isModEnabled("intracommreport")) {
199 accessforbidden('Module intracommreport not enabled');
200}
201
202
203
204/*
205 * Actions
206 */
207
208if (GETPOST('cancel', 'alpha')) {
209 $action = 'list';
210 $massaction = '';
211}
212if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
213 $massaction = '';
214}
215
216$parameters = array();
217$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
218if ($reshook < 0) {
219 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
220}
221
222if (empty($reshook)) {
223 // Selection of new fields
224 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
225
226 // Purge search criteria
227 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
228 $search_all = "";
229 $search_ref = "";
230 //$search_label = "";
231 //$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
232
233 //$show_childproducts = '';
234 $search_array_options = array();
235 }
236
237 // Mass actions
238 $objectclass = 'Product';
239 if ((string) $search_type == '1') {
240 $objectlabel = 'Services';
241 }
242 if ((string) $search_type == '0') {
243 $objectlabel = 'Products';
244 }
245
246 $uploaddir = $conf->product->dir_output;
247 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
248}
249
250
251/*
252 * View
253 */
254
255$form = new Form($db);
256
257$now = dol_now();
258
259$title = $langs->trans("IntraCommReports");
260//$help_url = "EN:Module_IntraCommReport|FR:Module_IntraCommReport_FR|ES:Módulo_IntraCommReport";
261$help_url = '';
262$morejs = array();
263$morecss = array();
264
265
266// Build and execute select
267// --------------------------------------------------------------------
268$sql = 'SELECT ';
269$sql .= $object->getFieldList('t');
270// Add fields from extrafields
271if (!empty($extrafields->attributes[$object->table_element]['label'])) {
272 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
273 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
274 }
275}
276// Add fields from hooks
277$parameters = array();
278$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
279$sql .= $hookmanager->resPrint;
280$sql = preg_replace('/,\s*$/', '', $sql);
281
282$sqlfields = $sql; // $sql fields to remove for count total
283
284$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
285//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
286if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
287 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
288}
289// Add table from hooks
290$parameters = array();
291$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
292$sql .= $hookmanager->resPrint;
293if ($object->ismultientitymanaged == 1) {
294 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOST('search_current_entity', 'int') ? 0 : 1)).")";
295} else {
296 $sql .= " WHERE 1 = 1";
297}
298foreach ($search as $key => $val) {
299 if (array_key_exists($key, $object->fields)) {
300 if ($key == 'status' && $search[$key] == -1) {
301 continue;
302 }
303 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
304 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
305 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
306 $search[$key] = '';
307 }
308 $mode_search = 2;
309 }
310 if ($search[$key] != '') {
311 $sql .= natural_search("t.".$db->sanitize($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
312 }
313 } else {
314 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
315 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
316 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
317 if (preg_match('/_dtstart$/', $key)) {
318 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
319 }
320 if (preg_match('/_dtend$/', $key)) {
321 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
322 }
323 }
324 }
325 }
326}
327if ($search_all) {
328 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
329}
330/*
331 // If the internal user must only see his customers, force searching by him
332 $search_sale = 0;
333 if (!$user->hasRight('societe', 'client', 'voir')) {
334 $search_sale = $user->id;
335 }
336 // Search on sale representative
337 if ($search_sale && $search_sale != '-1') {
338 if ($search_sale == -2) {
339 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
340 } elseif ($search_sale > 0) {
341 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
342 }
343 }
344 // Search on socid
345 if ($socid) {
346 $sql .= " AND t.fk_soc = ".((int) $socid);
347 }
348 */
349//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
350// Add where from extra fields
351include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
352// Add where from hooks
353$parameters = array();
354$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
355$sql .= $hookmanager->resPrint;
356
357/* If a group by is required
358 $sql .= " GROUP BY ";
359 foreach($object->fields as $key => $val) {
360 $sql .= "t.".$db->sanitize($key).", ";
361 }
362 // Add fields from extrafields
363 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
364 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
365 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
366 }
367 }
368 // Add groupby from hooks
369 $parameters = array();
370 $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
371 $sql .= $hookmanager->resPrint;
372 $sql = preg_replace('/,\s*$/', '', $sql);
373 */
374
375// Add HAVING from hooks
376/*
377 $parameters = array();
378 $reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
379 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
380 */
381
382// Count total nb of records
383$nbtotalofrecords = '';
384if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
385 /* The fast and low memory method to get and count full list converts the sql into a sql count */
386 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
387 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
388
389 $resql = $db->query($sqlforcount);
390 if ($resql) {
391 $objforcount = $db->fetch_object($resql);
392 $nbtotalofrecords = $objforcount->nbtotalofrecords;
393 } else {
394 dol_print_error($db);
395 }
396
397 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
398 $page = 0;
399 $offset = 0;
400 }
401 $db->free($resql);
402}
403
404// Complete request and execute it with limit
405$sql .= $db->order($sortfield, $sortorder);
406if ($limit) {
407 $sql .= $db->plimit($limit + 1, $offset);
408}
409
410$resql = $db->query($sql);
411if (!$resql) {
412 dol_print_error($db);
413 exit;
414}
415
416$num = $db->num_rows($resql);
417
418
419// Direct jump if only one record found
420if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
421 $obj = $db->fetch_object($resql);
422 $id = $obj->rowid;
423 header("Location: ".dol_buildpath('/intracommreport/card.php', 1).'?id='.((int) $id));
424 exit;
425}
426
427
428// Output page
429// --------------------------------------------------------------------
430
431llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-mymodule page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
432
433// Example : Adding jquery code
434// print '<script type="text/javascript">
435// jQuery(document).ready(function() {
436// function init_myfunc()
437// {
438// jQuery("#myid").removeAttr(\'disabled\');
439// jQuery("#myid").attr(\'disabled\',\'disabled\');
440// }
441// init_myfunc();
442// jQuery("#mybutton").click(function() {
443// init_myfunc();
444// });
445// });
446// </script>';
447
448$arrayofselected = is_array($toselect) ? $toselect : array();
449
450$param = '';
451if (!empty($mode)) {
452 $param .= '&mode='.urlencode($mode);
453}
454if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
455 $param .= '&contextpage='.urlencode($contextpage);
456}
457if ($limit > 0 && $limit != $conf->liste_limit) {
458 $param .= '&limit='.((int) $limit);
459}
460if ($optioncss != '') {
461 $param .= '&optioncss='.urlencode($optioncss);
462}
463if ($groupby != '') {
464 $param .= '&groupby='.urlencode($groupby);
465}
466foreach ($search as $key => $val) {
467 if (is_array($search[$key])) {
468 foreach ($search[$key] as $skey) {
469 if ($skey != '') {
470 $param .= '&search_'.$key.'[]='.urlencode($skey);
471 }
472 }
473 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
474 $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
475 $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
476 $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
477 } elseif ($search[$key] != '') {
478 $param .= '&search_'.$key.'='.urlencode($search[$key]);
479 }
480}
481// Add $param from extra fields
482include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
483// Add $param from hooks
484$parameters = array('param' => &$param);
485$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
486$param .= $hookmanager->resPrint;
487
488// List of mass actions available
489$arrayofmassactions = array(
490 //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
491 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
492 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
493 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
494);
495if (!empty($permissiontodelete)) {
496 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
497}
498if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
499 $arrayofmassactions = array();
500}
501$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
502
503print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
504if ($optioncss != '') {
505 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
506}
507print '<input type="hidden" name="token" value="'.newToken().'">';
508print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
509print '<input type="hidden" name="action" value="list">';
510print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
511print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
512print '<input type="hidden" name="page" value="'.$page.'">';
513print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
514print '<input type="hidden" name="page_y" value="">';
515print '<input type="hidden" name="mode" value="'.$mode.'">';
516
517
518$newcardbutton = '';
519$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
520$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
521$newcardbutton .= dolGetButtonTitleSeparator();
522$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/intracommreport/card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
523
524print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
525
526// Add code for pre mass action (confirmation or email presend form)
527$topicmail = "SendIntraCommReportRef";
528$modelmail = "intracommreport";
529$objecttmp = new IntracommReport($db);
530$trackid = 'xxxx'.$object->id;
531include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
532
533if ($search_all) {
534 $setupstring = '';
535 foreach ($fieldstosearchall as $key => $val) {
536 $fieldstosearchall[$key] = $langs->trans($val);
537 $setupstring .= $key."=".$val.";";
538 }
539 print '<!-- Search done like if INTRACOMMREPORT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
540 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
541}
542
543$moreforfilter = '';
544/*$moreforfilter.='<div class="divsearchfield">';
545 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
546 $moreforfilter.= '</div>';*/
547
548$parameters = array();
549$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
550if (empty($reshook)) {
551 $moreforfilter .= $hookmanager->resPrint;
552} else {
553 $moreforfilter = $hookmanager->resPrint;
554}
555
556if (!empty($moreforfilter)) {
557 print '<div class="liste_titre liste_titre_bydiv centpercent">';
558 print $moreforfilter;
559 $parameters = array();
560 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
561 print $hookmanager->resPrint;
562 print '</div>';
563}
564
565$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
566$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
567$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
568$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
569
570print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
571print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
572
573// Fields title search
574// --------------------------------------------------------------------
575print '<tr class="liste_titre_filter">';
576// Action column
577if ($conf->main_checkbox_left_column) {
578 print '<td class="liste_titre center maxwidthsearch">';
579 $searchpicto = $form->showFilterButtons('left');
580 print $searchpicto;
581 print '</td>';
582}
583foreach ($object->fields as $key => $val) {
584 //$searchkey = empty($search[$key]) ? '' : $search[$key];
585 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
586 if ($key == 'status') {
587 $cssforfield .= ($cssforfield ? ' ' : '').'center';
588 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
589 $cssforfield .= ($cssforfield ? ' ' : '').'center';
590 } elseif (in_array($val['type'], array('timestamp'))) {
591 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
592 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
593 $cssforfield .= ($cssforfield ? ' ' : '').'right';
594 }
595 if (!empty($arrayfields['t.'.$key]['checked'])) {
596 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
597 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
598 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
599 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
600 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
601 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
602 print '<div class="nowrap">';
603 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
604 print '</div>';
605 print '<div class="nowrap">';
606 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
607 print '</div>';
608 } elseif ($key == 'lang') {
609 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
610 $formadmin = new FormAdmin($db);
611 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
612 } else {
613 print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
614 }
615 print '</td>';
616 }
617}
618// Extra fields
619include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
620
621// Fields from hook
622$parameters = array('arrayfields' => $arrayfields);
623$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
624print $hookmanager->resPrint;
625/*if (!empty($arrayfields['anotherfield']['checked'])) {
626 print '<td class="liste_titre"></td>';
627 }*/
628// Action column
629if (!$conf->main_checkbox_left_column) {
630 print '<td class="liste_titre center maxwidthsearch">';
631 $searchpicto = $form->showFilterButtons();
632 print $searchpicto;
633 print '</td>';
634}
635print '</tr>'."\n";
636
637$totalarray = array();
638$totalarray['nbfield'] = 0;
639
640// Fields title label
641// --------------------------------------------------------------------
642print '<tr class="liste_titre">';
643// Action column
644if ($conf->main_checkbox_left_column) {
645 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
646 $totalarray['nbfield']++;
647}
648foreach ($object->fields as $key => $val) {
649 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
650 if ($key == 'status') {
651 $cssforfield .= ($cssforfield ? ' ' : '').'center';
652 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
653 $cssforfield .= ($cssforfield ? ' ' : '').'center';
654 } elseif (in_array($val['type'], array('timestamp'))) {
655 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
656 } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
657 $cssforfield .= ($cssforfield ? ' ' : '').'right';
658 }
659 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
660 if (!empty($arrayfields['t.'.$key]['checked'])) {
661 print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
662 $totalarray['nbfield']++;
663 }
664}
665// Extra fields
666include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
667// Hook fields
668$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
669$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
670print $hookmanager->resPrint;
671/*if (!empty($arrayfields['anotherfield']['checked'])) {
672 print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
673 $totalarray['nbfield']++;
674 }*/
675// Action column
676if (!$conf->main_checkbox_left_column) {
677 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
678 $totalarray['nbfield']++;
679}
680print '</tr>'."\n";
681
682// Detect if we need a fetch on each output line
683$needToFetchEachLine = 0;
684if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
685 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
686 if (!is_null($val) && preg_match('/\$object/', $val)) {
687 $needToFetchEachLine++; // There is at least one compute field that use $object
688 }
689 }
690}
691
692
693// Loop on record
694// --------------------------------------------------------------------
695$i = 0;
696$savnbfield = $totalarray['nbfield'];
697$totalarray = array();
698$totalarray['nbfield'] = 0;
699$imaxinloop = ($limit ? min($num, $limit) : $num);
700while ($i < $imaxinloop) {
701 $obj = $db->fetch_object($resql);
702 if (empty($obj)) {
703 break; // Should not happen
704 }
705
706 // Store properties in $object
707 $object->setVarsFromFetchObj($obj);
708
709 /*
710 $object->thirdparty = null;
711 if ($obj->fk_soc > 0) {
712 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
713 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
714 } else {
715 $companyobj = new Societe($db);
716 $companyobj->fetch($obj->fk_soc);
717 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
718 }
719
720 $object->thirdparty = $companyobj;
721 }*/
722
723 if ($mode == 'kanban') {
724 if ($i == 0) {
725 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
726 print '<div class="box-flex-container kanban">';
727 }
728 // Output Kanban
729 $selected = -1;
730 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
731 $selected = 0;
732 if (in_array($object->id, $arrayofselected)) {
733 $selected = 1;
734 }
735 }
736 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
737 print $object->getKanbanView('', array('selected' => $selected));
738 if ($i == ($imaxinloop - 1)) {
739 print '</div>';
740 print '</td></tr>';
741 }
742 } else {
743 // Show line of result
744 $j = 0;
745 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
746
747 // Action column
748 if ($conf->main_checkbox_left_column) {
749 print '<td class="nowrap center">';
750 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
751 $selected = 0;
752 if (in_array($object->id, $arrayofselected)) {
753 $selected = 1;
754 }
755 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
756 }
757 print '</td>';
758 if (!$i) {
759 $totalarray['nbfield']++;
760 }
761 }
762 // Fields
763 foreach ($object->fields as $key => $val) {
764 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
765 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
766 $cssforfield .= ($cssforfield ? ' ' : '').'center';
767 } elseif ($key == 'status') {
768 $cssforfield .= ($cssforfield ? ' ' : '').'center';
769 }
770
771 if (in_array($val['type'], array('timestamp'))) {
772 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
773 } elseif ($key == 'ref') {
774 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
775 }
776
777 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
778 $cssforfield .= ($cssforfield ? ' ' : '').'right';
779 }
780 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
781
782 if (!empty($arrayfields['t.'.$key]['checked'])) {
783 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
784 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
785 print ' title="'.dol_escape_htmltag($object->$key).'"';
786 }
787 print '>';
788 if ($key == 'status') {
789 print $object->getLibStatut(5);
790 } elseif ($key == 'rowid') {
791 print $object->showOutputField($val, $key, $object->id, '');
792 } else {
793 print $object->showOutputField($val, $key, $object->$key, '');
794 }
795 print '</td>';
796 if (!$i) {
797 $totalarray['nbfield']++;
798 }
799 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
800 if (!$i) {
801 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
802 }
803 if (!isset($totalarray['val'])) {
804 $totalarray['val'] = array();
805 }
806 if (!isset($totalarray['val']['t.'.$key])) {
807 $totalarray['val']['t.'.$key] = 0;
808 }
809 $totalarray['val']['t.'.$key] += $object->$key;
810 }
811 }
812 }
813 // Extra fields
814 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
815 // Fields from hook
816 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
817 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
818 print $hookmanager->resPrint;
819
820 /*if (!empty($arrayfields['anotherfield']['checked'])) {
821 print '<td class="right">'.$obj->anotherfield.'</td>';
822 }*/
823
824 // Action column
825 if (empty($conf->main_checkbox_left_column)) {
826 print '<td class="nowrap center">';
827 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
828 $selected = 0;
829 if (in_array($object->id, $arrayofselected)) {
830 $selected = 1;
831 }
832 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
833 }
834 print '</td>';
835 if (!$i) {
836 $totalarray['nbfield']++;
837 }
838 }
839
840 print '</tr>'."\n";
841 }
842
843 $i++;
844}
845
846// Show total line
847include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
848
849// If no record found
850if ($num == 0) {
851 $colspan = 1;
852 foreach ($arrayfields as $key => $val) {
853 if (!empty($val['checked'])) {
854 $colspan++;
855 }
856 }
857 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
858}
859
860
861$db->free($resql);
862
863$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
864$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
865print $hookmanager->resPrint;
866
867print '</table>'."\n";
868print '</div>'."\n";
869
870print '</form>'."\n";
871
872if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
873 $hidegeneratedfilelistifempty = 1;
874 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
875 $hidegeneratedfilelistifempty = 0;
876 }
877
878 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
879 $formfile = new FormFile($db);
880
881 // Show list of available documents
882 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
883 $urlsource .= str_replace('&amp;', '&', $param);
884
885 $filedir = $diroutputmassaction;
886 $genallowed = $permissiontoread;
887 $delallowed = $permissiontoadd;
888
889 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
890}
891
892// End of page
893llxFooter();
894$db->close();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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 standard extra fields.
Class to generate html code for admin pages.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage intracomm report.
llxFooter()
Footer empty.
Definition document.php:107
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...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $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.
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.
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...
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...
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.