dolibarr 25.0.0-alpha
memo_list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2026 John BOTELLA
5 * Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require '../main.inc.php';
38include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
39include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
41// load module libraries
42include_once __DIR__.'/class/memo.class.php';
43// for other modules
44//dol_include_once('/othermodule/class/otherobject.class.php');
45
46// Load translation files required by the page
47$langs->loadLangs(array("quickmemo", "other"));
48
49// Get parameters
50$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
51$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
52$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
53$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
54$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
55$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list
56$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : getDolDefaultContextPage(__FILE__); // To manage different context of search
57$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
58$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
59$mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
60$groupby = GETPOST('groupby', 'aZ09'); // Example: $groupby = 'p.fk_opp_status' or $groupby = 'p.fk_statut'
61
62$id = GETPOSTINT('id');
63$ref = GETPOST('ref', 'alpha');
64
65// Load variable for pagination
66$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
67$sortfield = GETPOST('sortfield', 'aZ09comma');
68$sortorder = GETPOST('sortorder', 'aZ09comma');
69$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
70if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
71 // If $page is not defined, or '' or -1 or if we click on clear filters
72 $page = 0;
73}
74$offset = $limit * $page;
75$pageprev = $page - 1;
76$pagenext = $page + 1;
77
78// Initialize technical objects
79$object = new Memo($db);
80$diroutputmassaction = $conf->quickmemo->dir_output.'/temp/massgeneration/'.$user->id;
81$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
82
83// Fetch optionals attributes and labels
84$extrafields->fetch_name_optionals_label($object->table_element);
85
86$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
87
88// Default sort order (if not yet defined by previous GETPOST)
89if (!$sortfield) {
90 reset($object->fields); // Reset is required to avoid key() to return null.
91 $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
92}
93if (!$sortorder) {
94 $sortorder = "ASC";
95}
96
97// Initialize array of search criteria
98$search_all = trim(GETPOST('search_all', 'alphanohtml'));
99$search = array();
100foreach ($object->fields as $key => $val) {
101 if (GETPOST('search_'.$key, 'alpha') !== '') {
102 $search[$key] = GETPOST('search_'.$key, 'alpha');
103 }
104 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
105 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear'));
106 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear'));
107 }
108}
109
110// List of fields to search into when doing a "search in all"
111$fieldstosearchall = array();
112// foreach ($object->fields as $key => $val) {
113// if (!empty($val['searchall'])) {
114// $fieldstosearchall['t.'.$key] = $val['label'];
115// }
116// }
117// $parameters = array('fieldstosearchall'=>$fieldstosearchall);
118// $reshook = $hookmanager->executeHooks('completeFieldsToSearchAll', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
119// if ($reshook > 0) {
120// $fieldstosearchall = empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall'];
121// } elseif ($reshook == 0) {
122// $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray['fieldstosearchall']) ? array() : $hookmanager->resArray['fieldstosearchall']);
123// }
124
125// Definition of array of fields for columns from ->fields
126$tableprefix = 't';
127$arrayfields = array();
128foreach ($object->fields as $key => $val) {
129 // If $val['visible']==0, then we never show the field
130 if (!empty($val['visible'])) {
131 $visible = (int) dol_eval((string) $val['visible'], 1);
132 $arrayfields[$tableprefix.'.'.$key] = array(
133 'label' => $val['label'],
134 'checked' => (($visible < 0) ? '0' : '1'),
135 'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval((string) $val['enabled'], 1)),
136 'position' => $val['position'],
137 'help' => isset($val['help']) ? $val['help'] : ''
138 );
139 }
140}
141
142// Extra fields
143include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
144// Add hook to complete $arrayfield
145$parameters = array('arrayfields' => &$arrayfields);
146$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
147
148// Complete arrayfields with special fields
149/*$arrayfields = array_merge($arrayfields, array(
150 'anotherfield' => array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>'1', 'enabled'=>'1', 'position'=>'90', 'csslist'=>'right'),
151));*/
152
153$object->fields = dol_sort_array($object->fields, 'position');
154$arrayfields = dol_sort_array($arrayfields, 'position');
155
156// There is several ways to check permission.
157$permissiontoread = $user->hasRight('quickmemo', 'memo', 'read');
158$permissiontoadd = $user->hasRight('quickmemo', 'memo', 'write');
159$permissiontodelete = $user->hasRight('quickmemo', 'memo', 'delete');
160
161
162// Security check (enable the most restrictive one)
163if ($user->socid > 0) {
165}
166//if ($user->socid > 0) accessforbidden();
167//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
168//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
169//restrictedArea($user, $object->module, 0, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft);
170if (!isModEnabled("quickmemo")) {
171 accessforbidden('Module quickmemo not enabled');
172}
173if (!$permissiontoread) {
175}
176
177
178/*
179 * Actions
180 */
181
182if (GETPOST('cancel', 'alpha')) {
183 $action = 'list';
184 $massaction = '';
185}
186if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
187 $massaction = '';
188}
189
190$parameters = array('arrayfields' => &$arrayfields);
191$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
192if ($reshook < 0) {
193 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
194}
195
196if (empty($reshook)) {
197 // Selection of new fields
198 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
199
200 // Purge search criteria
201 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
202 foreach ($object->fields as $key => $val) {
203 $search[$key] = '';
204 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
205 $search[$key.'_dtstart'] = '';
206 $search[$key.'_dtend'] = '';
207 }
208 }
209 $search_all = '';
210 $toselect = array();
211 $search_array_options = array();
212 }
213 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
214 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
215 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
216 }
217
218 // Mass actions
219 $objectclass = 'Memo';
220 $objectlabel = 'Memo';
221 $uploaddir = $conf->quickmemo->dir_output;
222
223 global $error;
224 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
225
226 // You can add more action here
227 // if ($action == 'xxx' && $permissiontoxxx) ...
228
229 if ($massaction === 'unarchive' && $permissiontoadd) {
230 if (!empty($toselect)) {
231 $countUnarchived = 0;
232 foreach ($toselect as $idMemo) {
233 // TODO Recover the memo - be careful to not recover a model - models can not be recovered.
234 $selectdModel = new Memo($db);
235 if ($selectdModel->fetch($idMemo) <= 0) {
236 $idMemo = (int) $idMemo; // sanitize
237 setEventMessage($langs->trans('QuickMemoLoadMemosError').' : '. (int) $idMemo, 'errors');
238 continue;
239 }
240
241 if ($selectdModel->status !== Memo::STATUS_ARCHIVED) {
242 setEventMessage($langs->trans('QuickMemoCantChangeThisPrivateNote').' : '. (int) $idMemo, 'errors');
243 continue;
244 }
245
246 if ($user->id != $selectdModel->fk_user_creat && $selectdModel->private) {
247 setEventMessage($langs->trans('QuickMemoCantChangeThisPrivateNote').' : '. (int) $idMemo, 'errors');
248 continue;
249 }
250
251 if ($selectdModel->setUnArchived($user) <= 0) {
252 setEventMessage($langs->trans('QuickMemoUnArchiveError').' : '. (int) $idMemo, 'errors');
253 continue;
254 }
255
256 $countUnarchived++;
257 }
258
259 if ($countUnarchived > 0) {
260 setEventMessage($langs->trans($countUnarchived > 1 ? 'QuickMemoUnArchiveCount' : 'QuickMemoUnArchived', $countUnarchived));
261 }
262 } else {
263 setEventMessage($langs->trans('PleaseSelectAtLeastOneRow'), 'warnings');
264 }
265 }
266}
267
268
269
270/*
271 * View
272 */
273
274$form = new Form($db);
275
276$now = dol_now();
277
278$title = $langs->trans("Memos");
279//$help_url = "EN:Module_Memo|FR:Module_Memo_FR|ES:Módulo_Memo";
280$help_url = '';
281$morejs = array();
282$morecss = array(
283 'quickmemo/css/memo.css'
284);
285
286
287// Build and execute select
288// --------------------------------------------------------------------
289$sql = "SELECT";
290$sql .= " ".$object->getFieldList('t');
291// Add fields from extrafields
292if (!empty($extrafields->attributes[$object->table_element]['label'])) {
293 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
294 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
295 }
296}
297// Add fields from hooks
298$parameters = array();
299$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
300$sql .= $hookmanager->resPrint;
301$sql = preg_replace('/,\s*$/', '', $sql);
302
303$sqlfields = $sql; // $sql fields to remove for count total
304
305$sql .= " FROM ".$db->prefix().$object->table_element." as t";
306//$sql .= " LEFT JOIN ".$db->prefix()."anothertable as rc ON rc.parent = t.rowid";
307if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
308 $sql .= " LEFT JOIN ".$db->prefix().$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
309}
310// Add table from hooks
311$parameters = array();
312$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
313$sql .= $hookmanager->resPrint;
314
315if (!empty($object->ismultientitymanaged) && (int) $object->ismultientitymanaged == 1) {
316 $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
317} elseif (preg_match('/^\w+@\w+$/', (string) $object->ismultientitymanaged)) {
318 $tmparray = explode('@', (string) $object->ismultientitymanaged);
319 $sql .= " LEFT JOIN ".$object->db->prefix().$db->sanitize($tmparray[1])." as pt ON t.".$db->sanitize($tmparray[0])." = pt.rowid";
320 $sql .= " WHERE pt.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
321} else {
322 $sql .= " WHERE 1 = 1";
323}
324
325$sql .= ' AND ('.implode(' OR ', [
326 '( t.status = '.Memo::STATUS_ARCHIVED.' AND t.private = 0 OR t.fk_user_creat = '.(int) $user->id.' )',
327 '( t.status = '.Memo::STATUS_VALIDATED.' AND t.private = 0 OR t.fk_user_creat = '.(int) $user->id.' )',
328 '( t.status = '.Memo::STATUS_TPL.' AND t.private_tpl = 0 OR t.fk_user_creat = '.(int) $user->id.' )',
329]).') ';
330
331
332
333
334foreach ($search as $key => $val) {
335 if (array_key_exists($key, $object->fields)) {
336 if ($key == 'status' && $search[$key] == -1) {
337 continue;
338 }
339
340 if (empty($object->fields[$key])) {
341 continue;
342 }
343
344 $field_spec = $object->fields[$key];
345 $mode_search = (($object->isInt($field_spec) || $object->isFloat($field_spec)) ? 1 : 0);
346 if ((strpos($field_spec['type'], 'integer:') === 0) || (strpos($field_spec['type'], 'sellist:') === 0) || !empty($field_spec['arrayofkeyval'])) {
347 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($field_spec['arrayofkeyval']) || !array_key_exists('0', $field_spec['arrayofkeyval'])))) {
348 $search[$key] = '';
349 }
350 $mode_search = 2;
351 }
352 if ($field_spec['type'] === 'boolean') {
353 $mode_search = 1;
354 if ($search[$key] == '-1') {
355 $search[$key] = '';
356 }
357 }
358 if (empty($field_spec['searchmulti'])) {
359 if (!is_array($search[$key]) && $search[$key] != '') {
360 $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
361 }
362 } else {
363 if (is_array($search[$key]) && !empty($search[$key])) {
364 $sql .= natural_search("t.".$db->escape($key), implode(',', $search[$key]), (($key == 'status') ? 2 : $mode_search));
365 }
366 }
367 } else {
368 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
369 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
370 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
371 if (preg_match('/_dtstart$/', $key)) {
372 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
373 }
374 if (preg_match('/_dtend$/', $key)) {
375 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
376 }
377 }
378 }
379 }
380}
381if ($search_all) {
382 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
383}
384/*
385// If the internal user must only see his customers, force searching by him
386$search_sale = 0;
387if (!$user->hasRight('societe', 'client', 'voir')) {
388 $search_sale = $user->id;
389}
390// Search on sale representative
391if ($search_sale && $search_sale != '-1') {
392 if ($search_sale == -2) {
393 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix()."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
394 } elseif ($search_sale > 0) {
395 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".$db->prefix()."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
396 }
397}
398// Search on socid
399if ($socid) {
400 $sql .= " AND t.fk_soc = ".((int) $socid);
401}
402*/
403//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
404// Add where from extra fields
405include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
406// Add where from hooks
407$parameters = array();
408$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
409$sql .= $hookmanager->resPrint;
410
411/* If a group by is required
412$sql .= " GROUP BY ";
413foreach($object->fields as $key => $val) {
414 $sql .= "t.".$db->sanitize($key).", ";
415}
416// Add fields from extrafields
417if (!empty($extrafields->attributes[$object->table_element]['label'])) {
418 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
419 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
420 }
421}
422// Add groupby from hooks
423$parameters = array();
424$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
425if (empty($reshook)) {
426 $sql .= $hookmanager->resPrint;
427} else {
428 $sql = $hookmanager->resPrint;
429}
430
431$sql = preg_replace('/,\s*$/', '', $sql);
432*/
433
434// Add HAVING from hooks
435/*
436$parameters = array();
437$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
438if (empty($reshook)) {
439 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
440} else {
441 $sql = $hookmanager->resPrint;
442}
443*/
444
445// Count total nb of records
446$nbtotalofrecords = '';
447if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
448 /* The fast and low memory method to get and count full list converts the sql into a sql count */
449 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
450 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
451
452 $resql = $db->query($sqlforcount);
453 if ($resql) {
454 $objforcount = $db->fetch_object($resql);
455 $nbtotalofrecords = $objforcount->nbtotalofrecords;
456 } else {
458 }
459
460 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
461 $page = 0;
462 $offset = 0;
463 }
464 $db->free($resql);
465}
466
467// Complete request and execute it with limit
468$sql .= $db->order($sortfield, $sortorder);
469if ($limit) {
470 $sql .= $db->plimit($limit + 1, $offset);
471}
472
473$resql = $db->query($sql);
474if (!$resql) {
476 exit;
477}
478
479$num = $db->num_rows($resql);
480
481
482// Direct jump if only one record found
483if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
484 $obj = $db->fetch_object($resql);
485 $id = $obj->rowid;
486 header("Location: ".dol_buildpath('/quickmemo/memo_card.php', 1).'?id='.((int) $id));
487 exit;
488}
489
490
491// Output page
492// --------------------------------------------------------------------
493
494llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-quickmemo page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for a horizontal scroll in the table instead of page
495
496$arrayofselected = is_array($toselect) ? $toselect : array();
497
498$param = '';
499if (!empty($mode)) {
500 $param .= '&mode='.urlencode($mode);
501}
502if (!empty($contextpage) && $contextpage != getDolDefaultContextPage(__FILE__)) {
503 $param .= '&contextpage='.urlencode($contextpage);
504}
505if ($limit > 0 && $limit != $conf->liste_limit) {
506 $param .= '&limit='.((int) $limit);
507}
508if ($optioncss != '') {
509 $param .= '&optioncss='.urlencode($optioncss);
510}
511if ($groupby != '') {
512 $param .= '&groupby='.urlencode($groupby);
513}
514foreach ($search as $key => $val) {
515 if (is_array($search[$key])) {
516 foreach ($search[$key] as $skey) {
517 if ($skey != '') {
518 $param .= '&search_'.$key.'[]='.urlencode($skey);
519 }
520 }
521 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
522 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
523 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
524 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
525 } elseif ($search[$key] != '') {
526 $param .= '&search_'.$key.'='.urlencode((string) $search[$key]);
527 }
528}
529// Add $param from extra fields
530include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
531// Add $param from hooks
532$parameters = array('param' => &$param);
533$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
534$param .= $hookmanager->resPrint;
535
536// List of mass actions available
537$arrayofmassactions = array(
538 'unarchive' => $langs->trans("UnarchiveMemo"),
539 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
540 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
541 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
542);
543if (!empty($permissiontodelete)) {
544 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
545}
546if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
547 $arrayofmassactions = array();
548}
549$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
550
551print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
552if ($optioncss != '') {
553 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
554}
555print '<input type="hidden" name="token" value="'.newToken().'">';
556print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
557print '<input type="hidden" name="action" value="list">';
558print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
559print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
560print '<input type="hidden" name="page" value="'.$page.'">';
561print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
562print '<input type="hidden" name="page_y" value="">';
563print '<input type="hidden" name="mode" value="'.$mode.'">';
564
565
566$newcardbutton = '';
567$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
568$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));
569//$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanbanGroupBy'), '', 'fa fa-grip-vertical imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanbangroupby&groupby=p.fk_opp_status'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'kanbangroupby' ? 2 : 1), array('morecss' => 'reposition'));
570//$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=hierarchy'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss' => 'reposition'));
571//$newcardbutton .= dolGetButtonTitleSeparator();
572//$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/quickmemo/memo_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
573
574print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
575
576// Add code for pre mass action (confirmation or email presend form)
577$topicmail = "SendMemoRef";
578$modelmail = "memo";
579$objecttmp = new Memo($db);
580$trackid = 'xxxx'.$object->id;
581include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
582
583if ($search_all) {
584 $setupstring = '';
585 // @phan-suppress-next-line PhanEmptyForeach
586 foreach ($fieldstosearchall as $key => $val) {
587 $fieldstosearchall[$key] = $langs->trans($val);
588 $setupstring .= $key."=".$val.";";
589 }
590 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
591 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
592}
593
594$moreforfilter = '';
595/*$moreforfilter.='<div class="divsearchfield">';
596$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
597$moreforfilter.= '</div>';*/
598
599$parameters = array();
600$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
601if (empty($reshook)) {
602 $moreforfilter .= $hookmanager->resPrint;
603} else {
604 $moreforfilter = $hookmanager->resPrint;
605}
606$parameters = array(
607 'arrayfields' => &$arrayfields,
608);
609
610if (!empty($moreforfilter)) {
611 print '<div class="liste_titre liste_titre_bydiv centpercent">';
612 print $moreforfilter;
613 print '</div>';
614}
615
616$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
617$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
618$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
619$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
620
621print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
622print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
623
624// Fields title search
625// --------------------------------------------------------------------
626print '<tr class="liste_titre_filter">';
627// Action column
628if ($conf->main_checkbox_left_column) {
629 print '<td class="liste_titre center maxwidthsearch">';
630 $searchpicto = $form->showFilterButtons('left');
631 print $searchpicto;
632 print '</td>';
633}
634foreach ($object->fields as $key => $val) {
635 //$searchkey = empty($search[$key]) ? '' : $search[$key];
636 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
637 if ($key == 'status') {
638 $cssforfield .= ($cssforfield ? ' ' : '').'center';
639 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
640 $cssforfield .= ($cssforfield ? ' ' : '').'center';
641 } elseif (in_array($val['type'], array('timestamp'))) {
642 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
643 } 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'])) {
644 $cssforfield .= ($cssforfield ? ' ' : '').'right';
645 }
646 if (!empty($arrayfields['t.'.$key]['checked'])) {
647 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
648 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
649 if (empty($val['searchmulti'])) {
650 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);
651 } else {
652 print $form->multiselectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 0, 0, 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
653 }
654 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
655 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
656 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
657 print '<div class="nowrap">';
658 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
659 print '</div>';
660 print '<div class="nowrap">';
661 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
662 print '</div>';
663 } elseif ($key == 'lang') {
664 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
665 $formadmin = new FormAdmin($db);
666 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
667 } elseif ($val['type'] === 'boolean') {
668 print $form->selectyesno('search_' . $key, $search[$key] ?? '', 1, false, 1);
669 } else {
670 print '<input type="text" class="flat maxwidth'.(in_array($val['type'], array('integer', 'price')) ? '50' : '75').'" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
671 }
672 print '</td>';
673 }
674}
675// Extra fields
676include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
677
678// Fields from hook
679$parameters = array('arrayfields' => $arrayfields);
680$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
681print $hookmanager->resPrint;
682/*if (!empty($arrayfields['anotherfield']['checked'])) {
683 print '<td class="liste_titre"></td>';
684}*/
685// Action column
686if (!$conf->main_checkbox_left_column) {
687 print '<td class="liste_titre center maxwidthsearch">';
688 $searchpicto = $form->showFilterButtons();
689 print $searchpicto;
690 print '</td>';
691}
692print '</tr>'."\n";
693
694$totalarray = array();
695$totalarray['nbfield'] = 0;
696
697// Fields title label
698// --------------------------------------------------------------------
699print '<tr class="liste_titre">';
700// Action column
701if ($conf->main_checkbox_left_column) {
702 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
703 $totalarray['nbfield']++;
704}
705foreach ($object->fields as $key => $val) {
706 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
707 if ($key == 'status') {
708 $cssforfield .= ($cssforfield ? ' ' : '').'center';
709 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
710 $cssforfield .= ($cssforfield ? ' ' : '').'center';
711 } elseif (in_array($val['type'], array('timestamp'))) {
712 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
713 } 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'])) {
714 $cssforfield .= ($cssforfield ? ' ' : '').'right';
715 }
716 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
717 if (!empty($arrayfields['t.'.$key]['checked'])) {
718 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";
719 $totalarray['nbfield']++;
720 }
721}
722// Extra fields
723include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
724// Hook fields
725$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
726$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
727print $hookmanager->resPrint;
728/*if (!empty($arrayfields['anotherfield']['checked'])) {
729 print '<th class="liste_titre">'.$langs->trans("AnotherField").'</th>';
730 $totalarray['nbfield']++;
731}*/
732// Action column
733if (!$conf->main_checkbox_left_column) {
734 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
735 $totalarray['nbfield']++;
736}
737print '</tr>'."\n";
738
739// Detect if we need a fetch on each output line
740$needToFetchEachLine = 0;
741if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
742 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
743 if (!is_null($val) && preg_match('/\$object/', $val)) {
744 $needToFetchEachLine++; // There is at least one compute field that use $object
745 }
746 }
747}
748
749
750// Loop on record
751// --------------------------------------------------------------------
752$i = 0;
753$savnbfield = $totalarray['nbfield'];
754$totalarray = array();
755$totalarray['nbfield'] = 0;
756$imaxinloop = ($limit ? min($num, $limit) : $num);
757while ($i < $imaxinloop) {
758 $obj = $db->fetch_object($resql);
759 if (empty($obj)) {
760 break; // Should not happen
761 }
762
763 // Store properties in $object
764 $object->setVarsFromFetchObj($obj);
765
766 /*
767 $object->thirdparty = null;
768 if ($obj->fk_soc > 0) {
769 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
770 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
771 } else {
772 $companyobj = new Societe($db);
773 $companyobj->fetch($obj->fk_soc);
774 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
775 }
776
777 $object->thirdparty = $companyobj;
778 }*/
779
780 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
781 if ($i == 0) {
782 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
783 print '<div class="box-flex-container kanban">';
784 }
785 // Output Kanban
786 $selected = -1;
787 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
788 $selected = 0;
789 if (in_array($object->id, $arrayofselected)) {
790 $selected = 1;
791 }
792 }
793 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
794 print $object->getKanbanView('', array('selected' => $selected));
795 if ($i == ($imaxinloop - 1)) {
796 print '</div>';
797 print '</td></tr>';
798 }
799 } else {
800 // Show line of result
801 $j = 0;
802 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
803
804 // Action column
805 if ($conf->main_checkbox_left_column) {
806 print '<td class="nowrap center">';
807 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
808 $selected = 0;
809 if (in_array($object->id, $arrayofselected)) {
810 $selected = 1;
811 }
812 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
813 }
814 print '</td>';
815 if (!$i) {
816 $totalarray['nbfield']++;
817 }
818 }
819 // Fields
820 foreach ($object->fields as $key => $val) {
821 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
822 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
823 $cssforfield .= ($cssforfield ? ' ' : '').'center';
824 } elseif ($key == 'status') {
825 $cssforfield .= ($cssforfield ? ' ' : '').'center';
826 }
827
828 if (in_array($val['type'], array('timestamp'))) {
829 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
830 } elseif ($key == 'ref') {
831 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
832 }
833
834 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'])) {
835 $cssforfield .= ($cssforfield ? ' ' : '').'right';
836 }
837 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
838
839 if (!empty($arrayfields['t.'.$key]['checked'])) {
840 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
841 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key) && !in_array($key, array('ref'))) {
842 print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
843 }
844 print '>';
845 if ($key == 'status') {
846 print $object->getLibStatut(5);
847 } elseif ($key == 'rowid') {
848 print $object->showOutputField($val, $key, (string) $object->id, '');
849 } else {
850 if ($val['type'] == 'html') {
851 print '<div class="small lineheightsmall twolinesmax-normallineheight">';
852 }
853 print $object->showOutputField($val, $key, (string) $object->$key, '');
854 if ($val['type'] == 'html') {
855 print '</div>';
856 }
857 }
858 print '</td>';
859 if (!$i) {
860 $totalarray['nbfield']++;
861 }
862 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
863 if (!$i) {
864 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
865 }
866 if (!isset($totalarray['val'])) {
867 $totalarray['val'] = array();
868 }
869 if (!isset($totalarray['val']['t.'.$key])) {
870 $totalarray['val']['t.'.$key] = 0;
871 }
872 $totalarray['val']['t.'.$key] += $object->$key;
873 }
874 }
875 }
876 // Extra fields
877 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
878 // Fields from hook
879 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
880 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
881 print $hookmanager->resPrint;
882
883 /*if (!empty($arrayfields['anotherfield']['checked'])) {
884 print '<td class="right">'.$obj->anotherfield.'</td>';
885 }*/
886
887 // Action column
888 if (empty($conf->main_checkbox_left_column)) {
889 print '<td class="nowrap center">';
890 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
891 $selected = 0;
892 if (in_array($object->id, $arrayofselected)) {
893 $selected = 1;
894 }
895 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
896 }
897 print '</td>';
898 if (!$i) {
899 $totalarray['nbfield']++;
900 }
901 }
902
903 print '</tr>'."\n";
904 }
905
906 $i++;
907}
908
909// Show total line
910include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
911
912// If no record found
913if ($num == 0) {
914 $colspan = 1;
915 foreach ($arrayfields as $key => $val) {
916 if (!empty($val['checked'])) {
917 $colspan++;
918 }
919 }
920 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
921}
922
923
924$db->free($resql);
925
926$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
927$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
928print $hookmanager->resPrint;
929
930print '</table>'."\n";
931print '</div>'."\n";
932
933print '</form>'."\n";
934
935if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
936 $hidegeneratedfilelistifempty = 1;
937 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
938 $hidegeneratedfilelistifempty = 0;
939 }
940
941 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
942 $formfile = new FormFile($db);
943
944 // Show list of available documents
945 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
946 $urlsource .= str_replace('&amp;', '&', $param);
947
948 $filedir = $diroutputmassaction;
949 $genallowed = $permissiontoread;
950 $delallowed = $permissiontoadd;
951
952 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
953}
954
955// End of page
956llxFooter();
957$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:501
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
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 for Memo.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
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...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolDefaultContextPage($s)
Return the default context page string.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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...
Definition html.lib.php:172
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.