dolibarr 21.0.0-beta
knowledgerecord_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2023 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2023 Anthony Berton <anthony.berton@bb2a.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.'/core/class/html.formadmin.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
34require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
35
44// Load translation files required by the page
45$langs->loadLangs(array("knowledgemanagement", "other"));
46
47$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
48$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
49$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
50$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
51$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
52$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
53$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordlist'; // To manage different context of search
54$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
55$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
56$mode = GETPOST('mode', 'aZ09');
57
58$id = GETPOSTINT('id');
59
60$searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array');
61$searchCategoryKnowledgemanagementOperator = 0;
62if (GETPOSTISSET('formfilteraction')) {
63 $searchCategoryKnowledgemanagementOperator = GETPOSTINT('search_category_knowledgemanagement_operator');
64} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) {
65 $searchCategoryKnowledgemanagementOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT');
66}
67// Load variable for pagination
68$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
69$sortfield = GETPOST('sortfield', 'aZ09comma');
70$sortorder = GETPOST('sortorder', 'aZ09comma');
71$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
72if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
73 // If $page is not defined, or '' or -1 or if we click on clear filters
74 $page = 0;
75}
76$offset = $limit * $page;
77$pageprev = $page - 1;
78$pagenext = $page + 1;
79
80// Initialize a technical objects
81$object = new KnowledgeRecord($db);
82$extrafields = new ExtraFields($db);
83$diroutputmassaction = $conf->knowledgemanagement->dir_output.'/temp/massgeneration/'.$user->id;
84$hookmanager->initHooks(array('knowledgerecordlist')); // Note that conf->hooks_modules contains array
85
86// Fetch optionals attributes and labels
87$extrafields->fetch_name_optionals_label($object->table_element);
88//$extrafields->fetch_name_optionals_label($object->table_element_line);
89
90$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
91
92// Default sort order (if not yet defined by previous GETPOST)
93if (!$sortfield) {
94 reset($object->fields); // Reset is required to avoid key() to return null.
95 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
96}
97if (!$sortorder) {
98 $sortorder = "ASC";
99}
100
101// Initialize array of search criteria
102$search_all = GETPOST('search_all', 'alphanohtml');
103$search = array();
104foreach ($object->fields as $key => $val) {
105 if ($key == "lang") {
106 $search[$key] = GETPOST('search_'.$key, 'alpha') != '0' ? GETPOST('search_'.$key, 'alpha') : '';
107 } else {
108 $search[$key] = GETPOST('search_'.$key, 'alpha');
109 }
110
111 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
112 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
113 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
114 }
115}
116
117// List of fields to search into when doing a "search in all"
118$fieldstosearchall = array();
119foreach ($object->fields as $key => $val) {
120 if (!empty($val['searchall'])) {
121 $fieldstosearchall['t.'.$key] = $val['label'];
122 }
123}
124
125// Definition of array of fields for columns
126$arrayfields = array();
127foreach ($object->fields as $key => $val) {
128 // If $val['visible']==0, then we never show the field
129 if (!empty($val['visible'])) {
130 $visible = (int) dol_eval((string) $val['visible'], 1);
131 $arrayfields['t.'.$key] = array(
132 'label'=>$val['label'],
133 'checked'=>(($visible < 0) ? 0 : 1),
134 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
135 'position'=>$val['position'],
136 'help'=> isset($val['help']) ? $val['help'] : ''
137 );
138 }
139}
140// Extra fields
141include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
142
143$object->fields = dol_sort_array($object->fields, 'position');
144$arrayfields = dol_sort_array($arrayfields, 'position');
145
146$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read');
147$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
148$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete');
149$permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('knowledgemanagement', 'knowledgerecord_advance', 'validate')));
150
151
152// Security check
153if (empty($conf->knowledgemanagement->enabled)) {
154 accessforbidden('Module not enabled');
155}
156$socid = 0;
157if ($user->socid > 0) { // Protection if external user
158 //$socid = $user->socid;
160}
161$result = restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord');
162//if (!$permissiontoread) accessforbidden();
163
164
165
166/*
167 * Actions
168 */
169
170if (GETPOST('cancel', 'alpha')) {
171 $action = 'list';
172 $massaction = '';
173}
174if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
175 $massaction = '';
176}
177
178$parameters = array();
179$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
180if ($reshook < 0) {
181 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
182}
183
184if (empty($reshook)) {
185 // Selection of new fields
186 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
187
188 // Purge search criteria
189 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
190 foreach ($object->fields as $key => $val) {
191 $search[$key] = '';
192 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
193 $search[$key.'_dtstart'] = '';
194 $search[$key.'_dtend'] = '';
195 }
196 }
197 $toselect = array();
198 $search_array_options = array();
199 }
200 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
201 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
202 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
203 }
204 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
205 $searchCategoryKnowledgemanagementOperator = 0;
206 $searchCategoryKnowledgemanagementList = array();
207 }
208
209 // Mass actions
210 $objectclass = 'KnowledgeRecord';
211 $objectlabel = 'KnowledgeRecord';
212 $uploaddir = $conf->knowledgemanagement->dir_output;
213 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
214}
215
216
217
218/*
219 * View
220 */
221
222$form = new Form($db);
223$user_temp = new User($db);
224$formadmin = new FormAdmin($db);
225
226$now = dol_now();
227
228//$help_url="EN:Module_KnowledgeRecord|FR:Module_KnowledgeRecord_FR|ES:Módulo_KnowledgeRecord";
229$help_url = '';
230$title = $langs->trans('KnowledgeRecords');
231$morejs = array();
232$morecss = array();
233
234
235// Build and execute select
236// --------------------------------------------------------------------
237$sql = 'SELECT ';
238$sql .= $object->getFieldList('t');
239// Add fields from extrafields
240if (!empty($extrafields->attributes[$object->table_element]['label'])) {
241 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
242 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
243 }
244}
245// Add fields from hooks
246$parameters = array();
247$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
248$sql .= $hookmanager->resPrint;
249$sql = preg_replace('/,\s*$/', '', $sql);
250
251$sqlfields = $sql; // $sql fields to remove for count total
252
253$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
254if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
255 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
256}
257// Add table from hooks
258$parameters = array();
259$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
260$sql .= $hookmanager->resPrint;
261if ($object->ismultientitymanaged == 1) {
262 $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
263} else {
264 $sql .= " WHERE 1 = 1";
265}
266foreach ($search as $key => $val) {
267 if (array_key_exists($key, $object->fields)) {
268 if ($key == 'status' && $search[$key] == -1) {
269 continue;
270 }
271 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
272 if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
273 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
274 $search[$key] = '';
275 }
276 $mode_search = 2;
277 }
278 if ($search[$key] != '') {
279 $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
280 }
281 } else {
282 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
283 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
284 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
285 if (preg_match('/_dtstart$/', $key)) {
286 $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
287 }
288 if (preg_match('/_dtend$/', $key)) {
289 $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
290 }
291 }
292 }
293 }
294}
295
296// Search for tag/category ($searchCategoryKnowledgemanagementList is an array of ID)
297if (!empty($searchCategoryKnowledgemanagementList)) {
298 $searchCategoryKnowledgemanagementSqlList = array();
299 $listofcategoryid = '';
300 foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
301 if (intval($searchCategoryKnowledgemanagement) == -2) {
302 $searchCategoryKnowledgemanagementSqlList[] = "NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
303 } elseif (intval($searchCategoryKnowledgemanagement) > 0) {
304 if (empty($searchCategoryKnowledgemanagementOperator)) {
305 $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")";
306 } else {
307 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement);
308 }
309 }
310 }
311 if ($listofcategoryid) {
312 $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
313 }
314 if ($searchCategoryKnowledgemanagementOperator == 1) {
315 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
316 $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")";
317 }
318 } else {
319 if (!empty($searchCategoryKnowledgemanagementSqlList)) {
320 $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")";
321 }
322 }
323}
324
325if ($search_all) {
326 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
327}
328//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
329// Add where from extra fields
330include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
331// Add where from hooks
332$parameters = array();
333$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
334$sql .= $hookmanager->resPrint;
335
336/* If a group by is required
337$sql.= " GROUP BY ";
338foreach($object->fields as $key => $val) {
339 $sql .= "t.".$key.", ";
340}
341// Add fields from extrafields
342if (!empty($extrafields->attributes[$object->table_element]['label'])) {
343 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
344}
345// Add where from hooks
346$parameters=array();
347$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook
348$sql.=$hookmanager->resPrint;
349$sql=preg_replace('/,\s*$/','', $sql);
350*/
351
352// Count total nb of records
353$nbtotalofrecords = '';
354if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
355 /* The fast and low memory method to get and count full list converts the sql into a sql count */
356 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
357 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
358 $resql = $db->query($sqlforcount);
359 if ($resql) {
360 $objforcount = $db->fetch_object($resql);
361 $nbtotalofrecords = $objforcount->nbtotalofrecords;
362 } else {
363 dol_print_error($db);
364 }
365
366 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
367 $page = 0;
368 $offset = 0;
369 }
370 $db->free($resql);
371}
372
373// Complete request and execute it with limit
374$sql .= $db->order($sortfield, $sortorder);
375if ($limit) {
376 $sql .= $db->plimit($limit + 1, $offset);
377}
378
379$resql = $db->query($sql);
380if (!$resql) {
381 dol_print_error($db);
382 exit;
383}
384
385$num = $db->num_rows($resql);
386
387
388// Direct jump if only one record found
389if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
390 $obj = $db->fetch_object($resql);
391 $id = $obj->rowid;
392 header("Location: ".dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$id);
393 exit;
394}
395
396
397// Output page
398// --------------------------------------------------------------------
399
400llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-knowledgemanagement page-list bodyforlist');
401
402
403$arrayofselected = is_array($toselect) ? $toselect : array();
404
405$param = '';
406if (!empty($mode)) {
407 $param .= '&mode='.urlencode($mode);
408}
409if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
410 $param .= '&contextpage='.urlencode($contextpage);
411}
412if ($limit > 0 && $limit != $conf->liste_limit) {
413 $param .= '&limit='.((int) $limit);
414}
415foreach ($search as $key => $val) {
416 if (is_array($search[$key])) {
417 foreach ($search[$key] as $skey) {
418 if ($skey != '') {
419 $param .= '&search_'.$key.'[]='.urlencode($skey);
420 }
421 }
422 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
423 $param .= '&search_'.$key.'month='.(GETPOSTINT('search_'.$key.'month'));
424 $param .= '&search_'.$key.'day='.(GETPOSTINT('search_'.$key.'day'));
425 $param .= '&search_'.$key.'year='.(GETPOSTINT('search_'.$key.'year'));
426 } elseif ($search[$key] != '') {
427 $param .= '&search_'.$key.'='.urlencode($search[$key]);
428 }
429}
430if ($optioncss != '') {
431 $param .= '&optioncss='.urlencode($optioncss);
432}
433// Add $param from extra fields
434include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
435// Add $param from hooks
436$parameters = array('param' => &$param);
437$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
438$param .= $hookmanager->resPrint;
439
440// List of mass actions available
441$arrayofmassactions = array(
442 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
443 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
444 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
445);
446if ($permissiontovalidate) {
447 $arrayofmassactions['validate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate");
448}
449if (isModEnabled('category') && $permissiontoadd) {
450 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
451}
452if (!empty($permissiontodelete)) {
453 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
454}
455if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
456 $arrayofmassactions = array();
457}
458$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
459
460print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
461if ($optioncss != '') {
462 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
463}
464print '<input type="hidden" name="token" value="'.newToken().'">';
465print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
466print '<input type="hidden" name="action" value="list">';
467print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
468print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
469print '<input type="hidden" name="page" value="'.$page.'">';
470print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
471print '<input type="hidden" name="page_y" value="">';
472print '<input type="hidden" name="mode" value="'.$mode.'">';
473
474$newcardbutton = '';
475$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'));
476$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'));
477$newcardbutton .= dolGetButtonTitleSeparator();
478$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
479
480print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
481
482// Add code for pre mass action (confirmation or email presend form)
483$topicmail = "SendKnowledgeRecordRef";
484$modelmail = "knowledgerecord";
485$objecttmp = new KnowledgeRecord($db);
486$trackid = 'xxxx'.$object->id;
487include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
488
489if ($search_all) {
490 $setupstring = '';
491 foreach ($fieldstosearchall as $key => $val) {
492 $fieldstosearchall[$key] = $langs->trans($val);
493 $setupstring .= $key."=".$val.";";
494 }
495 print '<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
496 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
497}
498
499$moreforfilter = '';
500/*$moreforfilter.='<div class="divsearchfield">';
501$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
502$moreforfilter.= '</div>';*/
503
504// Filter on categories
505$moreforfilter = '';
506if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
507 $formcategory = new FormCategory($db);
508 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_KNOWLEDGEMANAGEMENT, $searchCategoryKnowledgemanagementList, 'minwidth300', $searchCategoryKnowledgemanagementList ? $searchCategoryKnowledgemanagementList : 0);
509 /*
510 $moreforfilter .= '<div class="divsearchfield">';
511 $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
512 $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 3);
513 $categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -';
514 $moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300');
515 $moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_knowledgemanagement_operator" name="search_category_knowledgemanagement_operator" value="1"'.($searchCategoryKnowledgemanagementOperator == 1 ? ' checked="checked"' : '').'/><label class="none valignmiddle" for="search_category_knowledgemanagement_operator">'.$langs->trans('UseOrOperatorForCategories').'</label>';
516 $moreforfilter .= '</div>';
517 */
518}
519
520$parameters = array();
521$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
522if (empty($reshook)) {
523 $moreforfilter .= $hookmanager->resPrint;
524} else {
525 $moreforfilter = $hookmanager->resPrint;
526}
527
528if (!empty($moreforfilter)) {
529 print '<div class="liste_titre liste_titre_bydiv centpercent">';
530 print $moreforfilter;
531 print '</div>';
532}
533
534$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
535$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
536$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
537
538print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
539print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
540
541
542// Fields title search
543// --------------------------------------------------------------------
544print '<tr class="liste_titre_filter">';
545// Action column
546if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
547 print '<td class="liste_titre maxwidthsearch center">';
548 $searchpicto = $form->showFilterButtons('left');
549 print $searchpicto;
550 print '</td>';
551}
552foreach ($object->fields as $key => $val) {
553 $searchkey = empty($search[$key]) ? '' : $search[$key];
554 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
555 if ($key == 'status') {
556 $cssforfield .= ($cssforfield ? ' ' : '').'center';
557 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
558 $cssforfield .= ($cssforfield ? ' ' : '').'center';
559 } elseif (in_array($val['type'], array('timestamp'))) {
560 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
561 } 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'])) {
562 $cssforfield .= ($cssforfield ? ' ' : '').'right';
563 }
564 if (!empty($arrayfields['t.'.$key]['checked'])) {
565 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
566 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
567 print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
568 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
569 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
570 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
571 print '<div class="nowrap">';
572 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
573 print '</div>';
574 print '<div class="nowrap">';
575 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
576 print '</div>';
577 } elseif ($key == 'lang') {
578 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
579 $formadmin = new FormAdmin($db);
580 print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
581 } else {
582 print '<input type="text" class="flat maxwidth'.($val['type'] == 'integer' ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
583 }
584 print '</td>';
585 }
586}
587// Extra fields
588include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
589
590// Fields from hook
591$parameters = array('arrayfields'=>$arrayfields);
592$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
593print $hookmanager->resPrint;
594// Action column
595if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
596 print '<td class="liste_titre center maxwidthsearch">';
597 $searchpicto = $form->showFilterButtons();
598 print $searchpicto;
599 print '</td>';
600}
601print '</tr>'."\n";
602
603$totalarray = array();
604$totalarray['nbfield'] = 0;
605
606// Fields title label
607// --------------------------------------------------------------------
608print '<tr class="liste_titre">';
609if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
610 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
611 $totalarray['nbfield']++;
612}
613foreach ($object->fields as $key => $val) {
614 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
615 if ($key == 'status') {
616 $cssforfield .= ($cssforfield ? ' ' : '').'center';
617 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
618 $cssforfield .= ($cssforfield ? ' ' : '').'center';
619 } elseif (in_array($val['type'], array('timestamp'))) {
620 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
621 } 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'])) {
622 $cssforfield .= ($cssforfield ? ' ' : '').'right';
623 }
624 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
625 if (!empty($arrayfields['t.'.$key]['checked'])) {
626 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";
627 $totalarray['nbfield']++;
628 }
629}
630// Extra fields
631include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
632// Hook fields
633$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
634$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
635print $hookmanager->resPrint;
636// Action column
637if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
638 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
639 $totalarray['nbfield']++;
640}
641print '</tr>'."\n";
642
643// Detect if we need a fetch on each output line
644$needToFetchEachLine = 0;
645if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
646 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
647 if (!is_null($val) && preg_match('/\$object/', $val)) {
648 $needToFetchEachLine++; // There is at least one compute field that use $object
649 }
650 }
651}
652
653
654// Loop on record
655// --------------------------------------------------------------------
656$i = 0;
657$savnbfield = $totalarray['nbfield'];
658$totalarray = array();
659$totalarray['nbfield'] = 0;
660$imaxinloop = ($limit ? min($num, $limit) : $num);
661while ($i < $imaxinloop) {
662 $obj = $db->fetch_object($resql);
663 if (empty($obj)) {
664 break; // Should not happen
665 }
666
667 // Store properties in $object
668 $object->setVarsFromFetchObj($obj);
669
670 if ($mode == 'kanban') {
671 if ($i == 0) {
672 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
673 print '<div class="box-flex-container kanban">';
674 }
675 // Output Kanban
676 $selected = -1;
677 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
678 $selected = 0;
679 if (in_array($object->id, $arrayofselected)) {
680 $selected = 1;
681 }
682 }
683 print $object->getKanbanView('', array('selected' => $selected));
684 if ($i == ($imaxinloop - 1)) {
685 print '</div>';
686 print '</td></tr>';
687 }
688 } else {
689 // Show here line of result
690 $j = 0;
691 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
692 // Action column
693 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
694 print '<td class="nowrap center">';
695 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
696 $selected = 0;
697 if (in_array($object->id, $arrayofselected)) {
698 $selected = 1;
699 }
700 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
701 }
702 print '</td>';
703 if (!$i) {
704 $totalarray['nbfield']++;
705 }
706 }
707 foreach ($object->fields as $key => $val) {
708 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
709 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
710 $cssforfield .= ($cssforfield ? ' ' : '').'center';
711 } elseif ($key == 'status') {
712 $cssforfield .= ($cssforfield ? ' ' : '').'center';
713 }
714
715 if (in_array($val['type'], array('timestamp'))) {
716 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
717 } elseif ($key == 'ref') {
718 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
719 }
720
721 if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
722 $cssforfield .= ($cssforfield ? ' ' : '').'right';
723 }
724 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
725 if (!empty($arrayfields['t.'.$key]['checked'])) {
726 print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
727 if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
728 print ' title="'.dol_escape_htmltag(dol_nl2br($object->$key, 1)).'"'; // We add dol_nl2br for the question and answer fields
729 }
730 print '>';
731 if ($key == 'status') {
732 print $object->getLibStatut(5);
733 } elseif ($key == 'rowid') {
734 print $object->showOutputField($val, $key, $object->id, '');
735 } elseif ($key == 'fk_user_creat') {
736 if ($object->fk_user_creat > 0) {
737 if (isset($conf->cache['user'][$object->fk_user_creat])) {
738 $user_temp = $conf->cache['user'][$object->fk_user_creat];
739 } else {
740 $user_temp = new User($db);
741 $user_temp->fetch($object->fk_user_creat);
742 $conf->cache['user'][$object->fk_user_creat] = $user_temp;
743 }
744 print $user_temp->getNomUrl(-1);
745 }
746 } elseif ($key == 'fk_user_modif') {
747 if ($object->fk_user_modif > 0) {
748 if (isset($conf->cache['user'][$object->fk_user_modif])) {
749 $user_temp = $conf->cache['user'][$object->fk_user_modif];
750 } else {
751 $user_temp = new User($db);
752 $user_temp->fetch($object->fk_user_modif);
753 $conf->cache['user'][$object->fk_user_modif] = $user_temp;
754 }
755 print $user_temp->getNomUrl(-1);
756 }
757 } elseif ($key == 'fk_user_valid') {
758 if ($object->fk_user_valid > 0) {
759 if (isset($conf->cache['user'][$object->fk_user_valid])) {
760 $user_temp = $conf->cache['user'][$object->fk_user_valid];
761 } else {
762 $user_temp = new User($db);
763 $user_temp->fetch($object->fk_user_valid);
764 $conf->cache['user'][$object->fk_user_valid] = $user_temp;
765 }
766 print $user_temp->getNomUrl(-1);
767 }
768 } elseif ($key == 'lang') {
769 $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
770 print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
771 print $labellang;
772 } elseif ($key == 'question') {
773 print dolGetFirstLineOfText($object->$key);
774 } else {
775 print $object->showOutputField($val, $key, $object->$key, '');
776 }
777 print '</td>';
778 if (!$i) {
779 $totalarray['nbfield']++;
780 }
781 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
782 if (!$i) {
783 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
784 }
785 if (!isset($totalarray['val'])) {
786 $totalarray['val'] = array();
787 }
788 if (!isset($totalarray['val']['t.'.$key])) {
789 $totalarray['val']['t.'.$key] = 0;
790 }
791 $totalarray['val']['t.'.$key] += $object->$key;
792 }
793 }
794 }
795 // Extra fields
796 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
797 // Fields from hook
798 $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
799 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
800 print $hookmanager->resPrint;
801 // Action column
802 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
803 print '<td class="nowrap center">';
804 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
805 $selected = 0;
806 if (in_array($object->id, $arrayofselected)) {
807 $selected = 1;
808 }
809 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
810 }
811 print '</td>';
812 if (!$i) {
813 $totalarray['nbfield']++;
814 }
815 }
816
817 print '</tr>'."\n";
818 }
819 $i++;
820}
821
822// Show total line
823include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
824
825// If no record found
826if ($num == 0) {
827 $colspan = 1;
828 foreach ($arrayfields as $key => $val) {
829 if (!empty($val['checked'])) {
830 $colspan++;
831 }
832 }
833 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
834}
835
836
837$db->free($resql);
838
839$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
840$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
841print $hookmanager->resPrint;
842
843print '</table>'."\n";
844print '</div>'."\n";
845
846print '</form>'."\n";
847
848if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
849 $hidegeneratedfilelistifempty = 1;
850 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
851 $hidegeneratedfilelistifempty = 0;
852 }
853
854 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
855 $formfile = new FormFile($db);
856
857 // Show list of available documents
858 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
859 $urlsource .= str_replace('&amp;', '&', $param);
860
861 $filedir = $diroutputmassaction;
862 $genallowed = $permissiontoread;
863 $delallowed = $permissiontoadd;
864
865 print $formfile->showdocuments('massfilesarea_knowledgemanagement', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
866}
867
868// End of page
869llxFooter();
870$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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 standard extra fields.
Class to generate html code for admin pages.
Class to manage forms for categories.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class for KnowledgeRecord.
Class to manage Dolibarr users.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
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.
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_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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
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.