dolibarr 19.0.4
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
5 * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
7 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
8 * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
9 * Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
10 * Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
32// Load Dolibarr environment
33require '../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formexpensereport.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
42
43// Load translation files required by the page
44$langs->loadLangs(array('companies', 'users', 'trips'));
45
46$action = GETPOST('action', 'aZ09');
47$massaction = GETPOST('massaction', 'alpha');
48$show_files = GETPOST('show_files', 'int');
49$confirm = GETPOST('confirm', 'alpha');
50$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
51$toselect = GETPOST('toselect', 'array');
52$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist';
53$mode = GETPOST('mode', 'alpha');
54
55$childids = $user->getAllChildIds(1);
56
57// Security check
58$socid = GETPOST('socid', 'int');
59if ($user->socid) {
60 $socid = $user->socid;
61}
62$result = restrictedArea($user, 'expensereport', '', '');
63$id = GETPOST('id', 'int');
64// If we are on the view of a specific user
65if ($id > 0) {
66 $canread = 0;
67 if ($id == $user->id) {
68 $canread = 1;
69 }
70 if ($user->hasRight('expensereport', 'readall')) {
71 $canread = 1;
72 }
73 if ($user->hasRight('expensereport', 'lire') && in_array($id, $childids)) {
74 $canread = 1;
75 }
76 if (!$canread) {
78 }
79}
80
81$diroutputmassaction = $conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id;
82
83
84// Load variable for pagination
85$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
86$sortfield = GETPOST('sortfield', 'aZ09comma');
87$sortorder = GETPOST('sortorder', 'aZ09comma');
88$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
89if (empty($page) || $page == -1) {
90 $page = 0;
91} // If $page is not defined, or '' or -1
92$offset = $limit * $page;
93$pageprev = $page - 1;
94$pagenext = $page + 1;
95if (!$sortorder) {
96 $sortorder = "DESC";
97}
98if (!$sortfield) {
99 $sortfield = "d.date_debut";
100}
101
102
103$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
104
105$search_ref = GETPOST('search_ref', 'alpha');
106$search_user = GETPOST('search_user', 'int');
107$search_amount_ht = GETPOST('search_amount_ht', 'alpha');
108$search_amount_vat = GETPOST('search_amount_vat', 'alpha');
109$search_amount_ttc = GETPOST('search_amount_ttc', 'alpha');
110$search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma'));
111
112$search_date_startday = GETPOST('search_date_startday', 'int');
113$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
114$search_date_startyear = GETPOST('search_date_startyear', 'int');
115$search_date_startendday = GETPOST('search_date_startendday', 'int');
116$search_date_startendmonth = GETPOST('search_date_startendmonth', 'int');
117$search_date_startendyear = GETPOST('search_date_startendyear', 'int');
118$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
119$search_date_startend = dol_mktime(23, 59, 59, $search_date_startendmonth, $search_date_startendday, $search_date_startendyear);
120
121$search_date_endday = GETPOST('search_date_endday', 'int');
122$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
123$search_date_endyear = GETPOST('search_date_endyear', 'int');
124$search_date_endendday = GETPOST('search_date_endendday', 'int');
125$search_date_endendmonth = GETPOST('search_date_endendmonth', 'int');
126$search_date_endendyear = GETPOST('search_date_endendyear', 'int');
127$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Use tzserver
128$search_date_endend = dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear);
129
130$optioncss = GETPOST('optioncss', 'alpha');
131
132if ($search_status == '') {
133 $search_status = -1;
134}
135if ($search_user == '') {
136 $search_user = -1;
137}
138
139// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
140$object = new ExpenseReport($db);
141$hookmanager->initHooks(array('expensereportlist'));
142$extrafields = new ExtraFields($db);
143
144// fetch optionals attributes and labels
145$extrafields->fetch_name_optionals_label($object->table_element);
146
147$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
148
149
150// List of fields to search into when doing a "search in all"
151$fieldstosearchall = array(
152 'd.ref'=>'Ref',
153 'd.note_public'=>"NotePublic",
154 'u.lastname'=>'EmployeeLastname',
155 'u.firstname'=>"EmployeeFirstname",
156 'u.login'=>"Login",
157);
158if (empty($user->socid)) {
159 $fieldstosearchall["d.note_private"] = "NotePrivate";
160}
161
162$arrayfields = array(
163 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
164 'user'=>array('label'=>$langs->trans("User"), 'checked'=>1),
165 'd.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1),
166 'd.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
167 'd.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1),
168 'd.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1),
169 'd.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
170 'd.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1),
171 'd.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
172 'd.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
173 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
174 'd.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
175);
176// Extra fields
177include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
178
179$canedituser = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer'));
180
181$objectuser = new User($db);
182
183
184/*
185 * Actions
186 */
187
188if (GETPOST('cancel', 'alpha')) {
189 $action = 'list';
190 $massaction = '';
191}
192if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
193 $massaction = '';
194}
195
196$parameters = array('socid'=>$socid);
197$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
198if ($reshook < 0) {
199 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
200}
201
202if (empty($reshook)) {
203 // Selection of new fields
204 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
205
206 // Purge search criteria
207 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
208 $search_ref = "";
209 $search_user = "";
210 $search_amount_ht = "";
211 $search_amount_vat = "";
212 $search_amount_ttc = "";
213 $search_status = "";
214 $search_date_startday = '';
215 $search_date_startmonth = '';
216 $search_date_startyear = '';
217 $search_date_startendday = '';
218 $search_date_startendmonth = '';
219 $search_date_startendyear = '';
220 $search_date_start = '';
221 $search_date_startend = '';
222 $search_date_endday = '';
223 $search_date_endmonth = '';
224 $search_date_endyear = '';
225 $search_date_endendday = '';
226 $search_date_endendmonth = '';
227 $search_date_endendyear = '';
228 $search_date_end = '';
229 $search_date_endend = '';
230 $toselect = array();
231 $search_array_options = array();
232 }
233 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
234 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
235 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
236 }
237
238 // Mass actions
239 $objectclass = 'ExpenseReport';
240 $objectlabel = 'ExpenseReport';
241 $permissiontoread = $user->rights->expensereport->lire;
242 $permissiontodelete = $user->rights->expensereport->supprimer;
243 $uploaddir = $conf->expensereport->dir_output;
244 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
245}
246
247
248/*
249 * View
250 */
251
252$form = new Form($db);
253$formother = new FormOther($db);
254$formfile = new FormFile($db);
255$formexpensereport = new FormExpenseReport($db);
256
257$fuser = new User($db);
258
259$title = $langs->trans("TripsAndExpenses");
260llxHeader('', $title);
261
262$max_year = 5;
263$min_year = 10;
264
265// Get current user id
266$user_id = $user->id;
267
268if ($id > 0) {
269 // Charge utilisateur edite
270 $fuser->fetch($id, '', '', 1);
271 $fuser->getrights();
272 $user_id = $fuser->id;
273
274 $search_user = $user_id;
275}
276
277$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
278$sql .= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
279$sql .= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut as user_status, u.photo";
280// Add fields from extrafields
281if (!empty($extrafields->attributes[$object->table_element]['label'])) {
282 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
283 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
284 }
285}
286// Add fields from hooks
287$parameters = array();
288$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
289$sql .= $hookmanager->resPrint;
290
291$sqlfields = $sql; // $sql fields to remove for count total
292
293$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d";
294if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
295 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
296}
297$sql .= ", ".MAIN_DB_PREFIX."user as u";
298$sql .= " WHERE d.fk_user_author = u.rowid AND d.entity IN (".getEntity('expensereport').")";
299// Search all
300if (!empty($sall)) {
301 $sql .= natural_search(array_keys($fieldstosearchall), $sall);
302}
303// Ref
304if (!empty($search_ref)) {
305 $sql .= natural_search('d.ref', $search_ref);
306}
307// Date Start
308if ($search_date_start) {
309 $sql .= " AND d.date_debut >= '".$db->idate($search_date_start)."'";
310}
311if ($search_date_startend) {
312 $sql .= " AND d.date_debut <= '".$db->idate($search_date_startend)."'";
313}
314// Date End
315if ($search_date_end) {
316 $sql .= " AND d.date_fin >= '".$db->idate($search_date_end)."'";
317}
318if ($search_date_endend) {
319 $sql .= " AND d.date_fin <= '".$db->idate($search_date_endend)."'";
320}
321
322if ($search_amount_ht != '') {
323 $sql .= natural_search('d.total_ht', $search_amount_ht, 1);
324}
325if ($search_amount_ttc != '') {
326 $sql .= natural_search('d.total_ttc', $search_amount_ttc, 1);
327}
328// User
329if ($search_user != '' && $search_user >= 0) {
330 $sql .= " AND u.rowid = '".$db->escape($search_user)."'";
331}
332// Status
333if ($search_status != '' && $search_status >= 0) {
334 $sql .= " AND d.fk_statut IN (".$db->sanitize($search_status).")";
335}
336// RESTRICT RIGHTS
337if (!$user->hasRight('expensereport', 'readall') && !$user->hasRight('expensereport', 'lire_tous')
338 && (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || !$user->hasRight('expensereport', 'writeall_advance'))) {
339 $sql .= " AND d.fk_user_author IN (".$db->sanitize(join(',', $childids)).")\n";
340}
341// Add where from extra fields
342include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
343// Add where from hooks
344$parameters = array();
345$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
346$sql .= $hookmanager->resPrint;
347
348// Count total nb of records
349$nbtotalofrecords = '';
350if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
351 /* The fast and low memory method to get and count full list converts the sql into a sql count */
352 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
353 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
354 $resql = $db->query($sqlforcount);
355 if ($resql) {
356 $objforcount = $db->fetch_object($resql);
357 $nbtotalofrecords = $objforcount->nbtotalofrecords;
358 } else {
359 dol_print_error($db);
360 }
361
362 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
363 $page = 0;
364 $offset = 0;
365 }
366 $db->free($resql);
367}
368
369// Complete request and execute it with limit
370$sql .= $db->order($sortfield, $sortorder);
371if ($limit) {
372 $sql .= $db->plimit($limit + 1, $offset);
373}
374
375//print $sql;
376$resql = $db->query($sql);
377if ($resql) {
378 $num = $db->num_rows($resql);
379
380 $arrayofselected = is_array($toselect) ? $toselect : array();
381
382 $param = '';
383 if (!empty($mode)) {
384 $param .= '&mode='.urlencode($mode);
385 }
386 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
387 $param .= '&contextpage='.urlencode($contextpage);
388 }
389 if ($limit > 0 && $limit != $conf->liste_limit) {
390 $param .= '&limit='.((int) $limit);
391 }
392 if ($sall) {
393 $param .= "&sall=".urlencode($sall);
394 }
395 if ($search_ref) {
396 $param .= "&search_ref=".urlencode($search_ref);
397 }
398 // Start date
399 if ($search_date_startday) {
400 $param .= '&search_date_startday='.urlencode($search_date_startday);
401 }
402 if ($search_date_startmonth) {
403 $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
404 }
405 if ($search_date_startyear) {
406 $param .= '&search_date_startyear='.urlencode($search_date_startyear);
407 }
408 if ($search_date_startendday) {
409 $param .= '&search_date_startendday='.urlencode($search_date_startendday);
410 }
411 if ($search_date_startendmonth) {
412 $param .= '&search_date_startendmonth='.urlencode($search_date_startendmonth);
413 }
414 if ($search_date_startendyear) {
415 $param .= '&search_date_startendyear='.urlencode($search_date_startendyear);
416 }
417 // End date
418 if ($search_date_endday) {
419 $param .= '&search_date_endday='.urlencode($search_date_endday);
420 }
421 if ($search_date_endmonth) {
422 $param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
423 }
424 if ($search_date_endyear) {
425 $param .= '&search_date_endyear='.urlencode($search_date_endyear);
426 }
427 if ($search_date_endendday) {
428 $param .= '&search_date_endendday='.urlencode($search_date_endendday);
429 }
430 if ($search_date_endendmonth) {
431 $param .= '&search_date_endendmonth='.urlencode($search_date_endendmonth);
432 }
433 if ($search_date_endendyear) {
434 $param .= '&search_date_endendyear='.urlencode($search_date_endendyear);
435 }
436 if ($search_user) {
437 $param .= "&search_user=".urlencode($search_user);
438 }
439 if ($search_amount_ht) {
440 $param .= "&search_amount_ht=".urlencode($search_amount_ht);
441 }
442 if ($search_amount_ttc) {
443 $param .= "&search_amount_ttc=".urlencode($search_amount_ttc);
444 }
445 if ($search_status >= 0) {
446 $param .= "&search_status=".urlencode($search_status);
447 }
448 if ($optioncss != '') {
449 $param .= '&optioncss='.urlencode($optioncss);
450 }
451 // Add $param from extra fields
452 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
453
454 // List of mass actions available
455 $arrayofmassactions = array(
456 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
457 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
458 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
459 );
460 if ($user->hasRight('expensereport', 'supprimer')) {
461 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
462 }
463 if (in_array($massaction, array('presend', 'predelete'))) {
464 $arrayofmassactions = array();
465 }
466 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
467
468 // Lines of title fields
469 print '<form id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
470 if ($optioncss != '') {
471 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
472 }
473 print '<input type="hidden" name="token" value="'.newToken().'">';
474 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
475 print '<input type="hidden" name="action" value="'.($action == 'edit' ? 'update' : 'list').'">';
476 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
477 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
478 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
479 print '<input type="hidden" name="mode" value="'.$mode.'">';
480 if ($id > 0) {
481 print '<input type="hidden" name="id" value="'.$id.'">';
482 }
483
484 if ($id > 0) { // For user tab
485 $title = $langs->trans("User");
486 $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
487 $head = user_prepare_head($fuser);
488
489 print dol_get_fiche_head($head, 'expensereport', $title, -1, 'user');
490
491 dol_banner_tab($fuser, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin);
492
493 print dol_get_fiche_end();
494
495 if ($action != 'edit') {
496 print '<div class="tabsAction">';
497
498 $childids = $user->getAllChildIds(1);
499
500 $canedit = ((in_array($user_id, $childids) && $user->rights->expensereport->creer)
501 || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance));
502
503 // Buttons for actions
504 if ($canedit) {
505 print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
506 } else {
507 print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddTrip").'</a>';
508 }
509
510 print '</div>';
511 } else {
512 print $form->buttonsSaveCancel("Save", '');
513 }
514 } else {
515 $title = $langs->trans("ListTripsAndExpenses");
516
517 $url = DOL_URL_ROOT.'/expensereport/card.php?action=create';
518 if (!empty($socid)) {
519 $url .= '&socid='.$socid;
520 }
521 $newcardbutton = '';
522 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
523 $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
524 $newcardbutton .= dolGetButtonTitleSeparator();
525 $newcardbutton .= dolGetButtonTitle($langs->trans('NewTrip'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('expensereport', 'creer'));
526
527 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'expensereport', 0, $newcardbutton, '', $limit, 0, 0, 1);
528 }
529
530 $topicmail = "SendExpenseReport";
531 $modelmail = "expensereport";
532 $objecttmp = new ExpenseReport($db);
533 $trackid = 'exp'.$object->id;
534 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
535
536 if ($sall) {
537 foreach ($fieldstosearchall as $key => $val) {
538 $fieldstosearchall[$key] = $langs->trans($val);
539 }
540 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
541 }
542
543 $moreforfilter = '';
544
545 $parameters = array();
546 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
547 if (empty($reshook)) {
548 $moreforfilter .= $hookmanager->resPrint;
549 } else {
550 $moreforfilter = $hookmanager->resPrint;
551 }
552
553 if (!empty($moreforfilter)) {
554 print '<div class="liste_titre liste_titre_bydiv centpercent">';
555 print $moreforfilter;
556 print '</div>';
557 }
558
559 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
560 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
561 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
562
563 print '<div class="div-table-responsive">';
564 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
565
566 // Filters
567 print '<tr class="liste_titre_filter">';
568 // Action column
569 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
570 print '<td class="liste_titre maxwidthsearch">';
571 $searchpicto = $form->showFilterButtons('left');
572 print $searchpicto;
573 print '</td>';
574 }
575 if (!empty($arrayfields['d.ref']['checked'])) {
576 print '<td class="liste_titre" align="left">';
577 print '<input class="flat" size="15" type="text" name="search_ref" value="'.$search_ref.'">';
578 print '</td>';
579 }
580 // User
581 if (!empty($arrayfields['user']['checked'])) {
582 if ($user->hasRight('expensereport', 'readall') || $user->hasRight('expensereport', 'lire_tous')) {
583 print '<td class="liste_titre maxwidthonspartphone" align="left">';
584 print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
585 print '</td>';
586 } else {
587 print '<td class="liste_titre">&nbsp;</td>';
588 }
589 }
590 // Date start
591 if (!empty($arrayfields['d.date_debut']['checked'])) {
592 print '<td class="liste_titre" align="center">';
593 print '<div class="nowrapfordate">';
594 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
595 print '</div>';
596 print '<div class="nowrapfordate">';
597 print $form->selectDate($search_date_startend ? $search_date_startend : -1, 'search_date_startend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
598 print '</div>';
599 print '</td>';
600 }
601 // Date end
602 if (!empty($arrayfields['d.date_fin']['checked'])) {
603 print '<td class="liste_titre" align="center">';
604 print '<div class="nowrapfordate">';
605 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
606 print '</div>';
607 print '<div class="nowrapfordate">';
608 print $form->selectDate($search_date_endend ? $search_date_endend : -1, 'search_date_endend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
609 print '</div>';
610 print '</td>';
611 }
612 // Date valid
613 if (!empty($arrayfields['d.date_valid']['checked'])) {
614 print '<td class="liste_titre" align="center">';
615 //print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
616 //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
617 print '</td>';
618 }
619 // Date approve
620 if (!empty($arrayfields['d.date_approve']['checked'])) {
621 print '<td class="liste_titre" align="center">';
622 //print '<input class="flat" type="text" size="1" maxlength="2" name="month_end" value="'.$month_end.'">';
623 //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year);
624 print '</td>';
625 }
626 // Amount with no tax
627 if (!empty($arrayfields['d.total_ht']['checked'])) {
628 print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ht" value="'.$search_amount_ht.'"></td>';
629 }
630 if (!empty($arrayfields['d.total_vat']['checked'])) {
631 print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_vat" value="'.$search_amount_vat.'"></td>';
632 }
633 // Amount with all taxes
634 if (!empty($arrayfields['d.total_ttc']['checked'])) {
635 print '<td class="liste_titre right"><input class="flat" type="text" size="5" name="search_amount_ttc" value="'.$search_amount_ttc.'"></td>';
636 }
637 // Extra fields
638 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
639
640 // Fields from hook
641 $parameters = array('arrayfields'=>$arrayfields);
642 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
643 print $hookmanager->resPrint;
644 // Date creation
645 if (!empty($arrayfields['d.date_create']['checked'])) {
646 print '<td class="liste_titre">';
647 print '</td>';
648 }
649 // Date modification
650 if (!empty($arrayfields['d.tms']['checked'])) {
651 print '<td class="liste_titre">';
652 print '</td>';
653 }
654 // Status
655 if (!empty($arrayfields['d.fk_statut']['checked'])) {
656 print '<td class="liste_titre center parentonrightofpage">';
657 $formexpensereport->selectExpensereportStatus($search_status, 'search_status', 1, 1);
658 print '</td>';
659 }
660 // Action column
661 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
662 print '<td class="liste_titre maxwidthsearch">';
663 $searchpicto = $form->showFilterButtons();
664 print $searchpicto;
665 print '</td>';
666 }
667
668 print "</tr>\n";
669
670 $totalarray = array();
671 $totalarray['nbfield'] = 0;
672
673 print '<tr class="liste_titre">';
674 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
675 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
676 $totalarray['nbfield']++;
677 }
678 if (!empty($arrayfields['d.ref']['checked'])) {
679 print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "d.ref", "", $param, '', $sortfield, $sortorder);
680 $totalarray['nbfield']++;
681 }
682 if (!empty($arrayfields['user']['checked'])) {
683 print_liste_field_titre($arrayfields['user']['label'], $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder);
684 $totalarray['nbfield']++;
685 }
686 if (!empty($arrayfields['d.date_debut']['checked'])) {
687 print_liste_field_titre($arrayfields['d.date_debut']['label'], $_SERVER["PHP_SELF"], "d.date_debut", "", $param, '', $sortfield, $sortorder, 'center ');
688 $totalarray['nbfield']++;
689 }
690 if (!empty($arrayfields['d.date_fin']['checked'])) {
691 print_liste_field_titre($arrayfields['d.date_fin']['label'], $_SERVER["PHP_SELF"], "d.date_fin", "", $param, '', $sortfield, $sortorder, 'center ');
692 $totalarray['nbfield']++;
693 }
694 if (!empty($arrayfields['d.date_valid']['checked'])) {
695 print_liste_field_titre($arrayfields['d.date_valid']['label'], $_SERVER["PHP_SELF"], "d.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
696 $totalarray['nbfield']++;
697 }
698 if (!empty($arrayfields['d.date_approve']['checked'])) {
699 print_liste_field_titre($arrayfields['d.date_approve']['label'], $_SERVER["PHP_SELF"], "d.date_approve", "", $param, '', $sortfield, $sortorder, 'center ');
700 $totalarray['nbfield']++;
701 }
702 if (!empty($arrayfields['d.total_ht']['checked'])) {
703 print_liste_field_titre($arrayfields['d.total_ht']['label'], $_SERVER["PHP_SELF"], "d.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
704 $totalarray['nbfield']++;
705 }
706 if (!empty($arrayfields['d.total_vat']['checked'])) {
707 print_liste_field_titre($arrayfields['d.total_vat']['label'], $_SERVER["PHP_SELF"], "d.total_tva", "", $param, '', $sortfield, $sortorder, 'right ');
708 $totalarray['nbfield']++;
709 }
710 if (!empty($arrayfields['d.total_ttc']['checked'])) {
711 print_liste_field_titre($arrayfields['d.total_ttc']['label'], $_SERVER["PHP_SELF"], "d.total_ttc", "", $param, '', $sortfield, $sortorder, 'right ');
712 $totalarray['nbfield']++;
713 }
714 // Extra fields
715 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
716 // Hook fields
717 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
718 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
719 print $hookmanager->resPrint;
720 if (!empty($arrayfields['d.date_create']['checked'])) {
721 print_liste_field_titre($arrayfields['d.date_create']['label'], $_SERVER["PHP_SELF"], "d.date_create", "", $param, '', $sortfield, $sortorder, 'nowraponall center');
722 $totalarray['nbfield']++;
723 }
724 if (!empty($arrayfields['d.tms']['checked'])) {
725 print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, '', $sortfield, $sortorder, 'nowraponall center');
726 $totalarray['nbfield']++;
727 }
728 if (!empty($arrayfields['d.fk_statut']['checked'])) {
729 print_liste_field_titre($arrayfields['d.fk_statut']['label'], $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
730 $totalarray['nbfield']++;
731 }
732 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
733 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
734 $totalarray['nbfield']++;
735 }
736 print "</tr>\n";
737
738 $total_total_ht = 0;
739 $total_total_ttc = 0;
740 $total_total_tva = 0;
741
742 $expensereportstatic = new ExpenseReport($db);
743 $usertmp = new User($db);
744
745 if ($num > 0) {
746 $i = 0;
747 $savnbfield = $totalarray['nbfield'];
748 $totalarray = array();
749 $totalarray['nbfield'] = 0;
750 $totalarray['val'] = array();
751 $totalarray['val']['d.total_ht'] = 0;
752 $totalarray['val']['d.total_tva'] = 0;
753 $totalarray['val']['d.total_ttc'] = 0;
754 $totalarray['totalizable'] = array();
755
756 $imaxinloop = ($limit ? min($num, $limit) : $num);
757 while ($i < min($num, $limit)) {
758 $obj = $db->fetch_object($resql);
759
760 $expensereportstatic->id = $obj->rowid;
761 $expensereportstatic->ref = $obj->ref;
762 $expensereportstatic->status = $obj->status;
763 $expensereportstatic->date_debut = $db->jdate($obj->date_debut);
764 $expensereportstatic->date_fin = $db->jdate($obj->date_fin);
765 $expensereportstatic->date_create = $db->jdate($obj->date_create);
766 $expensereportstatic->date_modif = $db->jdate($obj->date_modif);
767 $expensereportstatic->date_valid = $db->jdate($obj->date_valid);
768 $expensereportstatic->date_approve = $db->jdate($obj->date_approve);
769 $expensereportstatic->note_private = $obj->note_private;
770 $expensereportstatic->note_public = $obj->note_public;
771 $expensereportstatic->fk_user = $obj->id_user;
772
773 $usertmp->id = $obj->id_user;
774 $usertmp->lastname = $obj->lastname;
775 $usertmp->firstname = $obj->firstname;
776 $usertmp->login = $obj->login;
777 $usertmp->statut = $obj->user_status;
778 $usertmp->status = $obj->user_status;
779 $usertmp->photo = $obj->photo;
780 $usertmp->email = $obj->email;
781
782 if ($mode == 'kanban') {
783 if ($i == 0) {
784 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
785 print '<div class="box-flex-container kanban">';
786 }
787 // TODO Use a cache on user
788 $usertmp->fetch($obj->id_user);
789
790 // Output Kanban
791 if ($massactionbutton || $massaction) {
792 $selected = 0;
793
794 print $expensereportstatic->getKanbanView('', array('userauthor' => $usertmp, 'selected' => in_array($expensereportstatic->id, $arrayofselected)));
795 }
796 if ($i == ($imaxinloop - 1)) {
797 print '</div>';
798 print '</td></tr>';
799 }
800 } else {
801 print '<tr class="oddeven">';
802 // Action column
803 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
804 print '<td class="nowrap center">';
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($obj->rowid, $arrayofselected)) {
808 $selected = 1;
809 }
810 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
811 }
812 print '</td>';
813 if (!$i) {
814 $totalarray['nbfield']++;
815 }
816 }
817 // Ref
818 if (!empty($arrayfields['d.ref']['checked'])) {
819 print '<td>';
820 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
821 print '<td class="nobordernopadding nowrap">';
822 print $expensereportstatic->getNomUrl(1);
823 print '</td>';
824 // Warning late icon and note
825 print '<td class="nobordernopadding nowrap">';
826 if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) {
827 print img_warning($langs->trans("Late"));
828 }
829 if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) {
830 print img_warning($langs->trans("Late"));
831 }
832 if (!empty($obj->note_private) || !empty($obj->note_public)) {
833 print ' <span class="note">';
834 print '<a href="'.DOL_URL_ROOT.'/expensereport/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
835 print '</span>';
836 }
837 print '</td>';
838 print '<td width="16" class="nobordernopadding hideonsmartphone right">';
839 $filename = dol_sanitizeFileName($obj->ref);
840 $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($obj->ref);
841 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
842 print $formfile->getDocumentsLink($expensereportstatic->element, $filename, $filedir);
843 print '</td>';
844 print '</tr></table>';
845 print '</td>';
846 if (!$i) {
847 $totalarray['nbfield']++;
848 }
849 }
850 // User
851 if (!empty($arrayfields['user']['checked'])) {
852 print '<td class="left">';
853 print $usertmp->getNomUrl(-1);
854 print '</td>';
855 if (!$i) {
856 $totalarray['nbfield']++;
857 }
858 }
859 // Start date
860 if (!empty($arrayfields['d.date_debut']['checked'])) {
861 print '<td class="center">'.($obj->date_debut > 0 ? dol_print_date($db->jdate($obj->date_debut), 'day') : '').'</td>';
862 if (!$i) {
863 $totalarray['nbfield']++;
864 }
865 }
866 // End date
867 if (!empty($arrayfields['d.date_fin']['checked'])) {
868 print '<td class="center">'.($obj->date_fin > 0 ? dol_print_date($db->jdate($obj->date_fin), 'day') : '').'</td>';
869 if (!$i) {
870 $totalarray['nbfield']++;
871 }
872 }
873 // Date validation
874 if (!empty($arrayfields['d.date_valid']['checked'])) {
875 print '<td class="center">'.($obj->date_valid > 0 ? dol_print_date($db->jdate($obj->date_valid), 'day') : '').'</td>';
876 if (!$i) {
877 $totalarray['nbfield']++;
878 }
879 }
880 // Date approval
881 if (!empty($arrayfields['d.date_approve']['checked'])) {
882 print '<td class="center">'.($obj->date_approve > 0 ? dol_print_date($db->jdate($obj->date_approve), 'day') : '').'</td>';
883 if (!$i) {
884 $totalarray['nbfield']++;
885 }
886 }
887 // Amount HT
888 if (!empty($arrayfields['d.total_ht']['checked'])) {
889 print '<td class="right">'.price($obj->total_ht)."</td>\n";
890 if (!$i) {
891 $totalarray['nbfield']++;
892 }
893 if (!$i) {
894 $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ht';
895 }
896 $totalarray['val']['d.total_ht'] += $obj->total_ht;
897 }
898 // Amount VAT
899 if (!empty($arrayfields['d.total_vat']['checked'])) {
900 print '<td class="right">'.price($obj->total_tva)."</td>\n";
901 if (!$i) {
902 $totalarray['nbfield']++;
903 }
904 if (!$i) {
905 $totalarray['pos'][$totalarray['nbfield']] = 'd.total_tva';
906 }
907 $totalarray['val']['d.total_tva'] += $obj->total_tva;
908 }
909 // Amount TTC
910 if (!empty($arrayfields['d.total_ttc']['checked'])) {
911 print '<td class="right">'.price($obj->total_ttc)."</td>\n";
912 if (!$i) {
913 $totalarray['nbfield']++;
914 }
915 if (!$i) {
916 $totalarray['pos'][$totalarray['nbfield']] = 'd.total_ttc';
917 }
918 $totalarray['val']['d.total_ttc'] += $obj->total_ttc;
919 }
920
921 // Extra fields
922 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
923 // Fields from hook
924 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
925 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
926 print $hookmanager->resPrint;
927
928 // Date creation
929 if (!empty($arrayfields['d.date_create']['checked'])) {
930 print '<td class="nowrap center">';
931 print dol_print_date($db->jdate($obj->date_create), 'dayhour');
932 print '</td>';
933 if (!$i) {
934 $totalarray['nbfield']++;
935 }
936 }
937 // Date modification
938 if (!empty($arrayfields['d.tms']['checked'])) {
939 print '<td class="nowrap center">';
940 print dol_print_date($db->jdate($obj->date_modif), 'dayhour');
941 print '</td>';
942 if (!$i) {
943 $totalarray['nbfield']++;
944 }
945 }
946 // Status
947 if (!empty($arrayfields['d.fk_statut']['checked'])) {
948 print '<td class="nowrap center">'.$expensereportstatic->getLibStatut(5).'</td>';
949 if (!$i) {
950 $totalarray['nbfield']++;
951 }
952 }
953 // Action column
954 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
955 print '<td class="nowrap center">';
956 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
957 $selected = 0;
958 if (in_array($obj->rowid, $arrayofselected)) {
959 $selected = 1;
960 }
961 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
962 }
963 print '</td>';
964 if (!$i) {
965 $totalarray['nbfield']++;
966 }
967 }
968
969 print "</tr>\n";
970 }
971
972 $total_total_ht = $total_total_ht + $obj->total_ht;
973 $total_total_tva = $total_total_tva + $obj->total_tva;
974 $total_total_ttc = $total_total_ttc + $obj->total_ttc;
975
976 $i++;
977 }
978 } else {
979 $colspan = 1;
980 foreach ($arrayfields as $key => $val) {
981 if (!empty($val['checked'])) {
982 $colspan++;
983 }
984 }
985 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
986 }
987
988 // Show total line
989 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
990
991 $db->free($resql);
992
993 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
994 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
995 print $hookmanager->resPrint;
996
997 print '</table>'."\n";
998 print '</div>';
999
1000 print '</form>'."\n";
1001
1002 if (empty($id)) {
1003 $hidegeneratedfilelistifempty = 1;
1004 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1005 $hidegeneratedfilelistifempty = 0;
1006 }
1007
1008 // Show list of available documents
1009 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1010 $urlsource .= str_replace('&amp;', '&', $param);
1011
1012 $filedir = $diroutputmassaction;
1013 $genallowed = $user->rights->expensereport->lire;
1014 $delallowed = $user->rights->expensereport->creer;
1015
1016 print $formfile->showdocuments('massfilesarea_expensereport', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1017 }
1018} else {
1019 dol_print_error($db);
1020}
1021
1022// End of page
1023llxFooter();
1024$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage Trips and Expenses.
Class to manage standard extra fields.
Class to manage generation of HTML components for contract module.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage Dolibarr users.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.