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