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 // The generic mass delete does not know private memos: remove from selection those the user is not allowed to delete
224 if (($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete && !empty($toselect)) {
225 foreach ($toselect as $key => $idMemo) {
226 $tmpMemo = new Memo($db);
227 if ($tmpMemo->fetch($idMemo) <= 0) {
228 unset($toselect[$key]);
229 continue;
230 }
231 $isPrivate = ($tmpMemo->status == Memo::STATUS_TPL ? $tmpMemo->private_tpl : $tmpMemo->private);
232 if ($isPrivate && $user->id != $tmpMemo->fk_user_creat) {
233 setEventMessage($langs->trans($tmpMemo->status == Memo::STATUS_TPL ? 'QuickMemoCantDeleteThisPrivateModel' : 'QuickMemoCantDeleteThisPrivateNote').' : '.((int) $idMemo), 'errors');
234 unset($toselect[$key]);
235 }
236 }
237 }
238
239 global $error;
240 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
241
242 // You can add more action here
243 // if ($action == 'xxx' && $permissiontoxxx) ...
244
245 if ($massaction === 'unarchive' && $permissiontoadd) {
246 if (!empty($toselect)) {
247 $countUnarchived = 0;
248 foreach ($toselect as $idMemo) {
249 // TODO Recover the memo - be careful to not recover a model - models can not be recovered.
250 $selectdModel = new Memo($db);
251 if ($selectdModel->fetch($idMemo) <= 0 || !$selectdModel->isInCurrentEntity()) {
252 $idMemo = (int) $idMemo; // sanitize
253 setEventMessage($langs->trans('QuickMemoLoadMemosError').' : '. (int) $idMemo, 'errors');
254 continue;
255 }
256
257 if ($selectdModel->status !== Memo::STATUS_ARCHIVED) {
258 setEventMessage($langs->trans('QuickMemoCantChangeThisPrivateNote').' : '. (int) $idMemo, 'errors');
259 continue;
260 }
261
262 if ($user->id != $selectdModel->fk_user_creat && $selectdModel->private) {
263 setEventMessage($langs->trans('QuickMemoCantChangeThisPrivateNote').' : '. (int) $idMemo, 'errors');
264 continue;
265 }
266
267 if ($selectdModel->setUnArchived($user) <= 0) {
268 setEventMessage($langs->trans('QuickMemoUnArchiveError').' : '. (int) $idMemo, 'errors');
269 continue;
270 }
271
272 $countUnarchived++;
273 }
274
275 if ($countUnarchived > 0) {
276 setEventMessage($langs->trans($countUnarchived > 1 ? 'QuickMemoUnArchiveCount' : 'QuickMemoUnArchived', $countUnarchived));
277 }
278 } else {
279 setEventMessage($langs->trans('PleaseSelectAtLeastOneRow'), 'warnings');
280 }
281 }
282}
283
284
285
286/*
287 * View
288 */
289
290$form = new Form($db);
291
292$now = dol_now();
293
294$title = $langs->trans("Memos");
295//$help_url = "EN:Module_Memo|FR:Module_Memo_FR|ES:Módulo_Memo";
296$help_url = '';
297$morejs = array();
298$morecss = array(
299 'quickmemo/css/memo.css'
300);
301
302
303// Build and execute select
304// --------------------------------------------------------------------
305$sql = "SELECT";
306$sql .= " ".$object->getFieldList('t');
307// Add fields from extrafields
308if (!empty($extrafields->attributes[$object->table_element]['label'])) {
309 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
310 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
311 }
312}
313// Add fields from hooks
314$parameters = array();
315$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
316$sql .= $hookmanager->resPrint;
317$sql = preg_replace('/,\s*$/', '', $sql);
318
319$sqlfields = $sql; // $sql fields to remove for count total
320
321$sql .= " FROM ".$db->prefix().$object->table_element." as t";
322//$sql .= " LEFT JOIN ".$db->prefix()."anothertable as rc ON rc.parent = t.rowid";
323if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
324 $sql .= " LEFT JOIN ".$db->prefix().$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
325}
326// Add table from hooks
327$parameters = array();
328$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
329$sql .= $hookmanager->resPrint;
330
331if (!empty($object->ismultientitymanaged) && (int) $object->ismultientitymanaged == 1) {
332 // Memos linked to an object follow the sharing of the object type (archives of an object card)
333 $entityElementKey = (!empty($search['element_type']) ? Memo::getEntityElementKey($search['element_type']) : $object->element);
334 $sql .= " WHERE t.entity IN (".getEntity($entityElementKey, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
335} elseif (preg_match('/^\w+@\w+$/', (string) $object->ismultientitymanaged)) {
336 $tmparray = explode('@', (string) $object->ismultientitymanaged);
337 $sql .= " LEFT JOIN ".$object->db->prefix().$db->sanitize($tmparray[1])." as pt ON t.".$db->sanitize($tmparray[0])." = pt.rowid";
338 $sql .= " WHERE pt.entity IN (".getEntity($object->element, (GETPOSTINT('search_current_entity') ? 0 : 1)).")";
339} else {
340 $sql .= " WHERE 1 = 1";
341}
342
343$sql .= ' AND ('.implode(' OR ', [
344 '( t.status = '.Memo::STATUS_ARCHIVED.' AND t.private = 0 OR t.fk_user_creat = '.(int) $user->id.' )',
345 '( t.status = '.Memo::STATUS_VALIDATED.' AND t.private = 0 OR t.fk_user_creat = '.(int) $user->id.' )',
346 '( t.status = '.Memo::STATUS_TPL.' AND t.private_tpl = 0 OR t.fk_user_creat = '.(int) $user->id.' )',
347]).') ';
348
349
350
351
352foreach ($search as $key => $val) {
353 if (array_key_exists($key, $object->fields)) {
354 if ($key == 'status' && $search[$key] == -1) {
355 continue;
356 }
357
358 if (empty($object->fields[$key])) {
359 continue;
360 }
361
362 $field_spec = $object->fields[$key];
363 $mode_search = (($object->isInt($field_spec) || $object->isFloat($field_spec)) ? 1 : 0);
364 if ((strpos($field_spec['type'], 'integer:') === 0) || (strpos($field_spec['type'], 'sellist:') === 0) || !empty($field_spec['arrayofkeyval'])) {
365 if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($field_spec['arrayofkeyval']) || !array_key_exists('0', $field_spec['arrayofkeyval'])))) {
366 $search[$key] = '';
367 }
368 $mode_search = 2;
369 }
370 if ($field_spec['type'] === 'boolean') {
371 $mode_search = 1;
372 if ($search[$key] == '-1') {
373 $search[$key] = '';
374 }
375 }
376 if (empty($field_spec['searchmulti'])) {
377 if (!is_array($search[$key]) && $search[$key] != '') {
378 $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
379 }
380 } else {
381 if (is_array($search[$key]) && !empty($search[$key])) {
382 $sql .= natural_search("t.".$db->escape($key), implode(',', $search[$key]), (($key == 'status') ? 2 : $mode_search));
383 }
384 }
385 } else {
386 if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
387 $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
388 if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
389 if (preg_match('/_dtstart$/', $key)) {
390 $sql .= " AND t.".$db->sanitize($columnName)." >= '".$db->idate($search[$key])."'";
391 }
392 if (preg_match('/_dtend$/', $key)) {
393 $sql .= " AND t.".$db->sanitize($columnName)." <= '".$db->idate($search[$key])."'";
394 }
395 }
396 }
397 }
398}
399if ($search_all) {
400 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
401}
402/*
403// If the internal user must only see his customers, force searching by him
404$search_sale = 0;
405if (!$user->hasRight('societe', 'client', 'voir')) {
406 $search_sale = $user->id;
407}
408// Search on sale representative
409if ($search_sale && $search_sale != '-1') {
410 if ($search_sale == -2) {
411 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".$db->prefix()."societe_commerciaux as sc WHERE sc.fk_soc = t.fk_soc)";
412 } elseif ($search_sale > 0) {
413 $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).")";
414 }
415}
416// Search on socid
417if ($socid) {
418 $sql .= " AND t.fk_soc = ".((int) $socid);
419}
420*/
421//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
422// Add where from extra fields
423include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
424// Add where from hooks
425$parameters = array();
426$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
427$sql .= $hookmanager->resPrint;
428
429/* If a group by is required
430$sql .= " GROUP BY ";
431foreach($object->fields as $key => $val) {
432 $sql .= "t.".$db->sanitize($key).", ";
433}
434// Add fields from extrafields
435if (!empty($extrafields->attributes[$object->table_element]['label'])) {
436 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
437 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
438 }
439}
440// Add groupby from hooks
441$parameters = array();
442$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
443if (empty($reshook)) {
444 $sql .= $hookmanager->resPrint;
445} else {
446 $sql = $hookmanager->resPrint;
447}
448
449$sql = preg_replace('/,\s*$/', '', $sql);
450*/
451
452// Add HAVING from hooks
453/*
454$parameters = array();
455$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
456if (empty($reshook)) {
457 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
458} else {
459 $sql = $hookmanager->resPrint;
460}
461*/
462
463// Count total nb of records
464$nbtotalofrecords = '';
465if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
466 /* The fast and low memory method to get and count full list converts the sql into a sql count */
467 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
468 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
469
470 $resql = $db->query($sqlforcount);
471 if ($resql) {
472 $objforcount = $db->fetch_object($resql);
473 $nbtotalofrecords = $objforcount->nbtotalofrecords;
474 } else {
475 dol_print_error($db);
476 }
477
478 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
479 $page = 0;
480 $offset = 0;
481 }
482 $db->free($resql);
483}
484
485// Complete request and execute it with limit
486$sql .= $db->order($sortfield, $sortorder);
487if ($limit) {
488 $sql .= $db->plimit($limit + 1, $offset);
489}
490
491$resql = $db->query($sql);
492if (!$resql) {
493 dol_print_error($db);
494 exit;
495}
496
497$num = $db->num_rows($resql);
498
499
500// Direct jump if only one record found
501if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
502 $obj = $db->fetch_object($resql);
503 $id = $obj->rowid;
504 header("Location: ".dol_buildpath('/quickmemo/memo_card.php', 1).'?id='.((int) $id));
505 exit;
506}
507
508
509// Output page
510// --------------------------------------------------------------------
511
512llxHeader('', $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
513
514$arrayofselected = is_array($toselect) ? $toselect : array();
515
516$param = '';
517if (!empty($mode)) {
518 $param .= '&mode='.urlencode($mode);
519}
520if (!empty($contextpage) && $contextpage != getDolDefaultContextPage(__FILE__)) {
521 $param .= '&contextpage='.urlencode($contextpage);
522}
523if ($limit > 0 && $limit != $conf->liste_limit) {
524 $param .= '&limit='.((int) $limit);
525}
526if ($optioncss != '') {
527 $param .= '&optioncss='.urlencode($optioncss);
528}
529if ($groupby != '') {
530 $param .= '&groupby='.urlencode($groupby);
531}
532foreach ($search as $key => $val) {
533 if (is_array($search[$key])) {
534 foreach ($search[$key] as $skey) {
535 if ($skey != '') {
536 $param .= '&search_'.$key.'[]='.urlencode($skey);
537 }
538 }
539 } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
540 $param .= '&search_'.$key.'month='.GETPOSTINT('search_'.$key.'month');
541 $param .= '&search_'.$key.'day='.GETPOSTINT('search_'.$key.'day');
542 $param .= '&search_'.$key.'year='.GETPOSTINT('search_'.$key.'year');
543 } elseif ($search[$key] != '') {
544 $param .= '&search_'.$key.'='.urlencode((string) $search[$key]);
545 }
546}
547// Add $param from extra fields
548include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
549// Add $param from hooks
550$parameters = array('param' => &$param);
551$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
552$param .= $hookmanager->resPrint;
553
554// List of mass actions available
555$arrayofmassactions = array(
556 'unarchive' => $langs->trans("UnarchiveMemo"),
557 //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
558 //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
559 //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
560);
561if (!empty($permissiontodelete)) {
562 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
563}
564if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
565 $arrayofmassactions = array();
566}
567$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
568
569print '<form method="POST" id="searchFormList" spellcheck="false" action="'.$_SERVER["PHP_SELF"].'">'."\n";
570if ($optioncss != '') {
571 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
572}
573print '<input type="hidden" name="token" value="'.newToken().'">';
574print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
575print '<input type="hidden" name="action" value="list">';
576print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
577print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
578print '<input type="hidden" name="page" value="'.$page.'">';
579print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
580print '<input type="hidden" name="page_y" value="">';
581print '<input type="hidden" name="mode" value="'.$mode.'">';
582
583
584$newcardbutton = '';
585$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'));
586$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'));
587//$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'));
588//$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'));
589//$newcardbutton .= dolGetButtonTitleSeparator();
590//$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/quickmemo/memo_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
591
592print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
593
594// Add code for pre mass action (confirmation or email presend form)
595$topicmail = "SendMemoRef";
596$modelmail = "memo";
597$objecttmp = new Memo($db);
598$trackid = 'xxxx'.$object->id;
599include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
600
601if ($search_all) {
602 $setupstring = '';
603 // @phan-suppress-next-line PhanEmptyForeach
604 foreach ($fieldstosearchall as $key => $val) {
605 $fieldstosearchall[$key] = $langs->trans($val);
606 $setupstring .= $key."=".$val.";";
607 }
608 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
609 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
610}
611
612$moreforfilter = '';
613/*$moreforfilter.='<div class="divsearchfield">';
614$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
615$moreforfilter.= '</div>';*/
616
617$parameters = array();
618$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
619if (empty($reshook)) {
620 $moreforfilter .= $hookmanager->resPrint;
621} else {
622 $moreforfilter = $hookmanager->resPrint;
623}
624$parameters = array(
625 'arrayfields' => &$arrayfields,
626);
627
628if (!empty($moreforfilter)) {
629 print '<div class="liste_titre liste_titre_bydiv centpercent">';
630 print $moreforfilter;
631 print '</div>';
632}
633
634$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
635$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
636$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
637$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
638
639print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
640print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
641
642// Fields title search
643// --------------------------------------------------------------------
644print '<tr class="liste_titre_filter">';
645// Action column
646if ($conf->main_checkbox_left_column) {
647 print '<td class="liste_titre center maxwidthsearch">';
648 $searchpicto = $form->showFilterButtons('left');
649 print $searchpicto;
650 print '</td>';
651}
652foreach ($object->fields as $key => $val) {
653 //$searchkey = empty($search[$key]) ? '' : $search[$key];
654 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
655 if ($key == 'status') {
656 $cssforfield .= ($cssforfield ? ' ' : '').'center';
657 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
658 $cssforfield .= ($cssforfield ? ' ' : '').'center';
659 } elseif (in_array($val['type'], array('timestamp'))) {
660 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
661 } 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'])) {
662 $cssforfield .= ($cssforfield ? ' ' : '').'right';
663 }
664 if (!empty($arrayfields['t.'.$key]['checked'])) {
665 print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
666 if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
667 if (empty($val['searchmulti'])) {
668 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);
669 } else {
670 print $form->multiselectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 0, 0, 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
671 }
672 } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
673 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
674 } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
675 print '<div class="nowrap">';
676 print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
677 print '</div>';
678 print '<div class="nowrap">';
679 print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
680 print '</div>';
681 } elseif ($key == 'lang') {
682 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
683 $formadmin = new FormAdmin($db);
684 print $formadmin->select_language((isset($search[$key]) ? $search[$key] : ''), 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
685 } elseif ($val['type'] === 'boolean') {
686 print $form->selectyesno('search_' . $key, $search[$key] ?? '', 1, false, 1);
687 } else {
688 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] : '').'">';
689 }
690 print '</td>';
691 }
692}
693// Extra fields
694include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
695
696// Fields from hook
697$parameters = array('arrayfields' => $arrayfields);
698$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
699print $hookmanager->resPrint;
700/*if (!empty($arrayfields['anotherfield']['checked'])) {
701 print '<td class="liste_titre"></td>';
702}*/
703// Action column
704if (!$conf->main_checkbox_left_column) {
705 print '<td class="liste_titre center maxwidthsearch">';
706 $searchpicto = $form->showFilterButtons();
707 print $searchpicto;
708 print '</td>';
709}
710print '</tr>'."\n";
711
712$totalarray = array();
713$totalarray['nbfield'] = 0;
714
715// Fields title label
716// --------------------------------------------------------------------
717print '<tr class="liste_titre">';
718// Action column
719if ($conf->main_checkbox_left_column) {
720 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
721 $totalarray['nbfield']++;
722}
723foreach ($object->fields as $key => $val) {
724 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
725 if ($key == 'status') {
726 $cssforfield .= ($cssforfield ? ' ' : '').'center';
727 } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
728 $cssforfield .= ($cssforfield ? ' ' : '').'center';
729 } elseif (in_array($val['type'], array('timestamp'))) {
730 $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
731 } 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'])) {
732 $cssforfield .= ($cssforfield ? ' ' : '').'right';
733 }
734 $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
735 if (!empty($arrayfields['t.'.$key]['checked'])) {
736 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";
737 $totalarray['nbfield']++;
738 }
739}
740// Extra fields
741include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
742// Hook fields
743$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
744$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
745print $hookmanager->resPrint;
746/*if (!empty($arrayfields['anotherfield']['checked'])) {
747 print '<th class="liste_titre">'.$langs->trans("AnotherField").'</th>';
748 $totalarray['nbfield']++;
749}*/
750// Action column
751if (!$conf->main_checkbox_left_column) {
752 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
753 $totalarray['nbfield']++;
754}
755print '</tr>'."\n";
756
757// Detect if we need a fetch on each output line
758$needToFetchEachLine = 0;
759if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
760 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
761 if (!is_null($val) && preg_match('/\$object/', $val)) {
762 $needToFetchEachLine++; // There is at least one compute field that use $object
763 }
764 }
765}
766
767
768// Loop on record
769// --------------------------------------------------------------------
770$i = 0;
771$savnbfield = $totalarray['nbfield'];
772$totalarray = array();
773$totalarray['nbfield'] = 0;
774$imaxinloop = ($limit ? min($num, $limit) : $num);
775while ($i < $imaxinloop) {
776 $obj = $db->fetch_object($resql);
777 if (empty($obj)) {
778 break; // Should not happen
779 }
780
781 // Store properties in $object
782 $object->setVarsFromFetchObj($obj);
783
784 /*
785 $object->thirdparty = null;
786 if ($obj->fk_soc > 0) {
787 if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
788 $companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
789 } else {
790 $companyobj = new Societe($db);
791 $companyobj->fetch($obj->fk_soc);
792 $conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
793 }
794
795 $object->thirdparty = $companyobj;
796 }*/
797
798 if ($mode == 'kanban' || $mode == 'kanbangroupby') {
799 if ($i == 0) {
800 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
801 print '<div class="box-flex-container kanban">';
802 }
803 // Output Kanban
804 $selected = -1;
805 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
806 $selected = 0;
807 if (in_array($object->id, $arrayofselected)) {
808 $selected = 1;
809 }
810 }
811 //print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
812 print $object->getKanbanView('', array('selected' => $selected));
813 if ($i == ($imaxinloop - 1)) {
814 print '</div>';
815 print '</td></tr>';
816 }
817 } else {
818 // Show line of result
819 $j = 0;
820 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
821
822 // Action column
823 if ($conf->main_checkbox_left_column) {
824 print '<td class="nowrap center">';
825 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
826 $selected = 0;
827 if (in_array($object->id, $arrayofselected)) {
828 $selected = 1;
829 }
830 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
831 }
832 print '</td>';
833 if (!$i) {
834 $totalarray['nbfield']++;
835 }
836 }
837 // Fields
838 foreach ($object->fields as $key => $val) {
839 $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
840 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
841 $cssforfield .= ($cssforfield ? ' ' : '').'center';
842 } elseif ($key == 'status') {
843 $cssforfield .= ($cssforfield ? ' ' : '').'center';
844 }
845
846 if (in_array($val['type'], array('timestamp'))) {
847 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
848 } elseif ($key == 'ref') {
849 $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
850 }
851
852 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'])) {
853 $cssforfield .= ($cssforfield ? ' ' : '').'right';
854 }
855 //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
856
857 if (!empty($arrayfields['t.'.$key]['checked'])) {
858 print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
859 if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key) && !in_array($key, array('ref'))) {
860 print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
861 }
862 print '>';
863 if ($key == 'status') {
864 print $object->getLibStatut(5);
865 } elseif ($key == 'rowid') {
866 print $object->showOutputField($val, $key, (string) $object->id, '');
867 } else {
868 if ($val['type'] == 'html') {
869 print '<div class="small lineheightsmall twolinesmax-normallineheight">';
870 }
871 print $object->showOutputField($val, $key, (string) $object->$key, '');
872 if ($val['type'] == 'html') {
873 print '</div>';
874 }
875 }
876 print '</td>';
877 if (!$i) {
878 $totalarray['nbfield']++;
879 }
880 if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
881 if (!$i) {
882 $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
883 }
884 if (!isset($totalarray['val'])) {
885 $totalarray['val'] = array();
886 }
887 if (!isset($totalarray['val']['t.'.$key])) {
888 $totalarray['val']['t.'.$key] = 0;
889 }
890 $totalarray['val']['t.'.$key] += $object->$key;
891 }
892 }
893 }
894 // Extra fields
895 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
896 // Fields from hook
897 $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
898 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
899 print $hookmanager->resPrint;
900
901 /*if (!empty($arrayfields['anotherfield']['checked'])) {
902 print '<td class="right">'.$obj->anotherfield.'</td>';
903 }*/
904
905 // Action column
906 if (empty($conf->main_checkbox_left_column)) {
907 print '<td class="nowrap center">';
908 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
909 $selected = 0;
910 if (in_array($object->id, $arrayofselected)) {
911 $selected = 1;
912 }
913 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
914 }
915 print '</td>';
916 if (!$i) {
917 $totalarray['nbfield']++;
918 }
919 }
920
921 print '</tr>'."\n";
922 }
923
924 $i++;
925}
926
927// Show total line
928include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
929
930// If no record found
931if ($num == 0) {
932 $colspan = 1;
933 foreach ($arrayfields as $key => $val) {
934 if (!empty($val['checked'])) {
935 $colspan++;
936 }
937 }
938 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
939}
940
941
942$db->free($resql);
943
944$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
945$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
946print $hookmanager->resPrint;
947
948print '</table>'."\n";
949print '</div>'."\n";
950
951print '</form>'."\n";
952
953if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
954 $hidegeneratedfilelistifempty = 1;
955 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
956 $hidegeneratedfilelistifempty = 0;
957 }
958
959 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
960 $formfile = new FormFile($db);
961
962 // Show list of available documents
963 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
964 $urlsource .= str_replace('&amp;', '&', $param);
965
966 $filedir = $diroutputmassaction;
967 $genallowed = $permissiontoread;
968 $delallowed = $permissiontoadd;
969
970 print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
971}
972
973// End of page
974llxFooter();
975$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
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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
static getEntityElementKey($element_type)
Element key to use with getEntity() for memos of an element type.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:183
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.