dolibarr 21.0.3
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
7 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
8 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
9 * Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
10 * Copyright (C) 2022 Charlène Benke <charlene@patas-monkey.com>
11 * Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
12 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
13 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 */
28
35// Load Dolibarr environment
36require '../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
39require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41if (isModEnabled('project')) {
42 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
43}
44if (isModEnabled('contract')) {
45 require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
46}
47
56// Load translation files required by the page
57$langs->loadLangs(array('companies', 'bills', 'interventions'));
58if (isModEnabled('project')) {
59 $langs->load("projects");
60}
61if (isModEnabled('contract')) {
62 $langs->load("contracts");
63}
64
65$action = GETPOST('action', 'aZ09');
66$massaction = GETPOST('massaction', 'alpha');
67$show_files = GETPOSTINT('show_files');
68$confirm = GETPOST('confirm', 'alpha');
69$toselect = GETPOST('toselect', 'array');
70$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'interventionlist';
71$mode = GETPOST('mode', 'alpha');
72
73if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
74 $userschilds = $user->getAllChildIds();
75} else {
76 $userschilds = array();
77}
78
79$search_ref = GETPOST('search_ref') ? GETPOST('search_ref', 'alpha') : GETPOST('search_inter', 'alpha');
80$search_ref_client = GETPOST('search_ref_client', 'alpha');
81$search_company = GETPOST('search_company', 'alpha');
82$search_desc = GETPOST('search_desc', 'alpha');
83$search_projet_ref = GETPOST('search_projet_ref', 'alpha');
84$search_contrat_ref = GETPOST('search_contrat_ref', 'alpha');
85$search_status = GETPOST('search_status', 'alpha');
86$search_signed_status = GETPOST('search_signed_status', 'alpha');
87$search_all = trim(GETPOST('search_all', 'alphanohtml'));
88$search_date_startday = GETPOSTINT('search_date_startday');
89$search_date_startmonth = GETPOSTINT('search_date_startmonth');
90$search_date_startyear = GETPOSTINT('search_date_startyear');
91$search_date_endday = GETPOSTINT('search_date_endday');
92$search_date_endmonth = GETPOSTINT('search_date_endmonth');
93$search_date_endyear = GETPOSTINT('search_date_endyear');
94$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
95$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
96$optioncss = GETPOST('optioncss', 'alpha');
97$socid = GETPOSTINT('socid');
98
99$diroutputmassaction = $conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id;
100
101// Load variable for pagination
102$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
103$sortfield = GETPOST('sortfield', 'aZ09comma');
104$sortorder = GETPOST('sortorder', 'aZ09comma');
105$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
106if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
107 // If $page is not defined, or '' or -1 or if we click on clear filters
108 $page = 0;
109}
110$offset = $limit * $page;
111$pageprev = $page - 1;
112$pagenext = $page + 1;
113if (!$sortorder) {
114 $sortorder = "DESC";
115}
116if (!$sortfield) {
117 $sortfield = "f.ref";
118}
119
120// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
121$object = new Fichinter($db);
122$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
123
124$extrafields = new ExtraFields($db);
125
126// Fetch optionals attributes and labels
127$extrafields->fetch_name_optionals_label($object->table_element);
128
129$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
130
131// List of fields to search into when doing a "search in all"
132$fieldstosearchall = array(
133 'f.ref' => 'Ref',
134 's.nom' => "ThirdParty",
135 'f.description' => 'Description',
136 'f.note_public' => 'NotePublic',
137 'fd.description' => 'DescriptionOfLine',
138);
139if (empty($user->socid)) {
140 $fieldstosearchall["f.note_private"] = "NotePrivate";
141}
142if (getDolGlobalString('FICHINTER_DISABLE_DETAILS')) {
143 unset($fieldstosearchall['fd.description']);
144}
145
146// Definition of fields for list
147$arrayfields = array(
148 'f.ref' => array('label' => 'Ref', 'checked' => 1),
149 'f.ref_client' => array('label' => 'RefCustomer', 'checked' => 1),
150 's.nom' => array('label' => 'ThirdParty', 'checked' => 1),
151 'pr.ref' => array('label' => 'Project', 'checked' => 1, 'enabled' => (!isModEnabled('project') ? 0 : 1)),
152 'c.ref' => array('label' => 'Contract', 'checked' => 1, 'enabled' => (empty($conf->contrat->enabled) ? 0 : 1)),
153 'f.description' => array('label' => 'Description', 'checked' => 1),
154 'f.datec' => array('label' => 'DateCreation', 'checked' => 0, 'position' => 500),
155 'f.tms' => array('label' => 'DateModificationShort', 'checked' => 0, 'position' => 500),
156 'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
157 'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
158 'f.fk_statut' => array('label' => 'Status', 'checked' => 1, 'position' => 1000),
159 'f.signed_status' => array('label' => 'SignedStatus', 'checked' => 0, 'position' => 1001),
160 'fd.description' => array('label' => "DescriptionOfLine", 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0),
161 'fd.date' => array('label' => 'DateOfLine', 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0),
162 'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), //type duration is here because in database, column 'duree' is double
163);
164'@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields';
165// Extra fields
166include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
167
168$object->fields = dol_sort_array($object->fields, 'position');
169$arrayfields = dol_sort_array($arrayfields, 'position');
170'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
171
172// Security check
173$id = GETPOSTINT('id');
174if ($user->socid) {
175 $socid = $user->socid;
176}
177$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
178
179$permissiontoreadallthirdparty = $user->hasRight('societe', 'client', 'voir');
180$permissiontoread = $user->hasRight('ficheinter', 'lire');
181$permissiontoadd = $user->hasRight('ficheinter', 'creer');
182$permissiontodelete = $user->hasRight('ficheinter', 'supprimer');
183
184
185/*
186 * Actions
187 */
188
189if (GETPOST('cancel', 'alpha')) {
190 $action = 'list';
191 $massaction = '';
192}
193if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
194 $massaction = '';
195}
196
197$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
198$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
199if ($reshook < 0) {
200 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
201}
202
203if (empty($reshook)) {
204 // Selection of new fields
205 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
206
207 // Purge search criteria
208 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
209 $search_ref = "";
210 $search_ref_client = "";
211 $search_company = "";
212 $search_projet_ref = "";
213 $search_contrat_ref = "";
214 $search_desc = "";
215 $search_status = "";
216 $search_signed_status = '';
217 $search_date_startday = '';
218 $search_date_startmonth = '';
219 $search_date_startyear = '';
220 $search_date_endday = '';
221 $search_date_endmonth = '';
222 $search_date_endyear = '';
223 $search_date_start = '';
224 $search_date_end = '';
225 $toselect = array();
226 $search_array_options = array();
227 }
228
229 // Mass actions
230 $objectclass = 'Fichinter';
231 $objectlabel = 'Interventions';
232 $uploaddir = $conf->ficheinter->dir_output;
233 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
234}
235
236
237
238/*
239 * View
240 */
241
242
243$form = new Form($db);
244$formfile = new FormFile($db);
245$objectstatic = new Fichinter($db);
246$companystatic = new Societe($db);
247if (isModEnabled('project')) {
248 $projetstatic = new Project($db);
249}
250if (isModEnabled('contract')) {
251 $contratstatic = new Contrat($db);
252}
253
254$now = dol_now();
255
256$title = $langs->trans("Interventions");
257$help_url = '';
258$morejs = array();
259$morecss = array();
260
261
262$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
263$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
264
265$atleastonefieldinlines = 0;
266foreach ($arrayfields as $tmpkey => $tmpval) {
267 if (preg_match('/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey]['checked'])) {
268 $atleastonefieldinlines++;
269 break;
270 }
271}
272
273$sql = "SELECT";
274$sql .= " f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.signed_status as signed_status, f.description, f.datec as date_creation, f.tms as date_modification, f.note_public, f.note_private,";
275if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
276 $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
277}
278$sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
279if (isModEnabled('project')) {
280 $sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
281}
282if (isModEnabled('contract')) {
283 $sql .= ", c.rowid as contrat_id, c.ref as contrat_ref, c.ref_customer as contrat_ref_customer, c.ref_supplier as contrat_ref_supplier";
284}
285// Add fields from extrafields
286if (!empty($extrafields->attributes[$object->table_element]['label'])) {
287 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
288 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
289 }
290}
291// Add fields from hooks
292$parameters = array();
293$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
294$sql .= $hookmanager->resPrint;
295
296$sqlfields = $sql; // $sql fields to remove for count total
297
298$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
299if (isModEnabled('project')) {
300 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr on f.fk_projet = pr.rowid";
301}
302if (isModEnabled('contract')) {
303 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid";
304}
305if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
306 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
307}
308if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
309 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
310}
311
312// Add table from hooks
313$parameters = array();
314$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
315$sql .= $hookmanager->resPrint;
316
317if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
318 $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
319}
320$sql .= ", ".MAIN_DB_PREFIX."societe as s";
321$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
322$sql .= " AND f.fk_soc = s.rowid";
323if ($search_ref) {
324 $sql .= natural_search('f.ref', $search_ref);
325}
326if ($search_ref_client) {
327 $sql .= natural_search('f.ref_client', $search_ref_client);
328}
329if ($search_company) {
330 $sql .= natural_search('s.nom', $search_company);
331}
332if ($search_projet_ref) {
333 $sql .= natural_search('pr.ref', $search_projet_ref);
334}
335if ($search_contrat_ref) {
336 $sql .= natural_search('c.ref', $search_contrat_ref);
337}
338if ($search_desc) {
339 if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
340 $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
341 } else {
342 $sql .= natural_search(array('f.description'), $search_desc);
343 }
344}
345if ($search_status != '' && $search_status >= 0) {
346 $sql .= ' AND f.fk_statut = '.urlencode($search_status);
347}
348if ($search_signed_status != '' && $search_signed_status >= 0) {
349 $sql .= ' AND f.signed_status = '.urlencode($search_signed_status);
350}
351if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
352 if ($search_date_start) {
353 $sql .= " AND fd.date >= '".$db->idate($search_date_start)."'";
354 }
355 if ($search_date_end) {
356 $sql .= " AND fd.date <= '".$db->idate($search_date_end)."'";
357 }
358}
359if ($socid > 0) {
360 $sql .= " AND s.rowid = ".((int) $socid);
361}
362// Restriction on sale representative
363if (empty($user->socid) && !$permissiontoreadallthirdparty) {
364 $sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).")";
365 if (getDolGlobalInt('MAIN_SEE_SUBORDINATES') && $userschilds) {
366 $sql .= " OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(',', $userschilds))."))";
367 }
368 $sql .= ")";
369}
370
371if ($search_all) {
372 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
373}
374// Search on sale representative
375/*
376if ($search_sale && $search_sale != '-1') {
377 if ($search_sale == -2) {
378 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
379 } elseif ($search_sale > 0) {
380 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
381 }
382}*/
383// Add where from extra fields
384include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
385// Add where from hooks
386$parameters = array();
387$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
388$sql .= $hookmanager->resPrint;
389// Add GroupBy from hooks
390$parameters = array('search_all' => $search_all, 'fieldstosearchall' => $fieldstosearchall);
391$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
392$sql .= $hookmanager->resPrint;
393
394// Count total nb of records
395$nbtotalofrecords = '';
396if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
397 /* The fast and low memory method to get and count full list converts the sql into a sql count */
398 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
399 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
400 $resql = $db->query($sqlforcount);
401 if ($resql) {
402 $objforcount = $db->fetch_object($resql);
403 $nbtotalofrecords = $objforcount->nbtotalofrecords;
404 } else {
405 dol_print_error($db);
406 }
407
408 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
409 $page = 0;
410 $offset = 0;
411 }
412 $db->free($resql);
413}
414
415// Complete request and execute it with limit
416$sql .= $db->order($sortfield, $sortorder);
417if ($limit) {
418 $sql .= $db->plimit($limit + 1, $offset);
419}
420
421$resql = $db->query($sql);
422if (!$resql) {
423 dol_print_error($db);
424 exit;
425}
426
427$num = $db->num_rows($resql);
428
429
430// Direct jump if only one record found
431if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
432 $obj = $db->fetch_object($resql);
433 $id = $obj->rowid;
434 header("Location: ".dol_buildpath('/fichinter/card.php', 1).'?id='.$id);
435 exit;
436}
437
438
439// Output page
440// --------------------------------------------------------------------
441
442llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-fichinter page-list'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
443
444
445$arrayofselected = is_array($toselect) ? $toselect : array();
446
447if ($socid > 0) {
448 $soc = new Societe($db);
449 $soc->fetch($socid);
450 if (empty($search_company)) {
451 $search_company = $soc->name;
452 }
453}
454
455$param = '';
456if (!empty($mode)) {
457 $param .= '&mode='.urlencode($mode);
458}
459if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
460 $param .= '&contextpage='.urlencode($contextpage);
461}
462if ($limit > 0 && $limit != $conf->liste_limit) {
463 $param .= '&limit='.((int) $limit);
464}
465if ($search_all) {
466 $param .= "&search_all=".urlencode($search_all);
467}
468if ($socid) {
469 $param .= "&socid=".urlencode((string) ($socid));
470}
471if ($search_ref) {
472 $param .= "&search_ref=".urlencode($search_ref);
473}
474if ($search_ref_client) {
475 $param .= "&search_ref_client=".urlencode($search_ref_client);
476}
477if ($search_company) {
478 $param .= "&search_company=".urlencode($search_company);
479}
480if ($search_desc) {
481 $param .= "&search_desc=".urlencode($search_desc);
482}
483if ($search_status != '' && $search_status > -1) {
484 $param .= "&search_status=".urlencode($search_status);
485}
486if ($search_signed_status != '' && $search_signed_status >= 0) {
487 $param .= '&search_signed_status='.urlencode($search_signed_status);
488}
489if ($search_date_startday > 0) {
490 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
491}
492if ($search_date_startmonth > 0) {
493 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
494}
495if ($search_date_startyear > 0) {
496 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
497}
498if ($search_date_endday > 0) {
499 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
500}
501if ($search_date_endmonth > 0) {
502 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
503}
504if ($search_date_endyear > 0) {
505 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
506}
507if ($show_files) {
508 $param .= '&show_files='.urlencode((string) ($show_files));
509}
510if ($optioncss != '') {
511 $param .= '&optioncss='.urlencode($optioncss);
512}
513// Add $param from extra fields
514include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
515// Add $param from hooks
516$parameters = array('param' => &$param);
517$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
518$param .= $hookmanager->resPrint;
519
520// List of mass actions available
521$arrayofmassactions = array(
522 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
523 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
524 //'presend'=>$langs->trans("SendByMail"),
525);
526if (!empty($permissiontodelete)) {
527 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
528}
529if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
530 $arrayofmassactions = array();
531}
532$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
533
534
535print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
536if ($optioncss != '') {
537 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
538}
539print '<input type="hidden" name="token" value="'.newToken().'">';
540print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
541print '<input type="hidden" name="action" value="list">';
542print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
543print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
544print '<input type="hidden" name="page" value="'.$page.'">';
545print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
546print '<input type="hidden" name="page_y" value="">';
547print '<input type="hidden" name="mode" value="'.$mode.'">';
548
549$newcardbutton = '';
550$url = DOL_URL_ROOT.'/fichinter/card.php?action=create';
551if (!empty($socid)) {
552 $url .= '&socid='.$socid;
553}
554$newcardbutton = '';
555$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'));
556$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'));
557$newcardbutton .= dolGetButtonTitleSeparator();
558$newcardbutton .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('ficheinter', 'creer'));
559
560print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
561
562$topicmail = "Information";
563$modelmail = "intervention";
564$objecttmp = new Fichinter($db);
565$trackid = 'int'.$object->id;
566include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
567
568if ($search_all) {
569 $setupstring = '';
570 foreach ($fieldstosearchall as $key => $val) {
571 $fieldstosearchall[$key] = $langs->trans($val);
572 $setupstring .= $key."=".$val.";";
573 }
574 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
575 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
576}
577
578$moreforfilter = '';
579
580$parameters = array();
581$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
582if (empty($reshook)) {
583 $moreforfilter .= $hookmanager->resPrint;
584} else {
585 $moreforfilter = $hookmanager->resPrint;
586}
587
588if (!empty($moreforfilter)) {
589 print '<div class="liste_titre liste_titre_bydiv centpercent">';
590 print $moreforfilter;
591 print '</div>';
592}
593
594$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
595$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
596$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
597$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
598
599print '<div class="div-table-responsive">';
600print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
601
602// Fields title search
603// --------------------------------------------------------------------
604print '<tr class="liste_titre_filter">';
605// Action column
606if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
607 print '<td class="liste_titre center maxwidthsearch">';
608 $searchpicto = $form->showFilterButtons('left');
609 print $searchpicto;
610 print '</td>';
611}
612if (!empty($arrayfields['f.ref']['checked'])) {
613 print '<td class="liste_titre">';
614 print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
615 print '</td>';
616}
617if (!empty($arrayfields['f.ref_client']['checked'])) {
618 print '<td class="liste_titre">';
619 print '<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.'" size="8">';
620 print '</td>';
621}
622if (!empty($arrayfields['s.nom']['checked'])) {
623 print '<td class="liste_titre">';
624 print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
625 print '</td>';
626}
627if (!empty($arrayfields['pr.ref']['checked'])) {
628 print '<td class="liste_titre">';
629 print '<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.'" size="8">';
630 print '</td>';
631}
632if (!empty($arrayfields['c.ref']['checked'])) {
633 print '<td class="liste_titre">';
634 print '<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.'" size="8">';
635 print '</td>';
636}
637if (!empty($arrayfields['f.description']['checked'])) {
638 print '<td class="liste_titre">';
639 print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
640 print '</td>';
641}
642// Extra fields
643include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
644
645// Fields from hook
646$parameters = array('arrayfields' => $arrayfields);
647$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
648print $hookmanager->resPrint;
649if (!empty($arrayfields['f.datec']['checked'])) {
650 // Date creation
651 print '<td class="liste_titre">';
652 print '</td>';
653}
654if (!empty($arrayfields['f.tms']['checked'])) {
655 // Date modification
656 print '<td class="liste_titre">';
657 print '</td>';
658}
659if (!empty($arrayfields['f.note_public']['checked'])) {
660 // Note public
661 print '<td class="liste_titre">';
662 print '</td>';
663}
664if (!empty($arrayfields['f.note_private']['checked'])) {
665 // Note private
666 print '<td class="liste_titre">';
667 print '</td>';
668}
669// Status
670if (!empty($arrayfields['f.fk_statut']['checked'])) {
671 print '<td class="liste_titre right parentonrightofpage">';
672 $liststatus = [
673 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv('Draft'),
674 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv('Validated'),
675 $object::STATUS_BILLED => $langs->transnoentitiesnoconv('StatusInterInvoiced'),
676 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv('Done'),
677 ];
678 if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) {
679 unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
680 }
681 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
682 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
683 print '</td>';
684}
685// Signed status
686if (!empty($arrayfields['f.signed_status']['checked'])) {
687 print '<td class="liste_titre center">';
688 $list_signed_status = $object->getSignedStatusLocalisedArray();
689 print $form->selectarray('search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status');
690 print '</td>';
691}
692// Fields of detail line
693if (!empty($arrayfields['fd.description']['checked'])) {
694 print '<td class="liste_titre">&nbsp;</td>';
695}
696if (!empty($arrayfields['fd.date']['checked'])) {
697 print '<td class="liste_titre center">';
698 print '<div class="nowrapfordate">';
699 print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
700 print '</div>';
701 print '<div class="nowrapfordate">';
702 print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
703 print '</div>';
704 print '</td>';
705}
706if (!empty($arrayfields['fd.duree']['checked'])) {
707 print '<td class="liste_titre">&nbsp;</td>';
708}
709// Action column
710if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
711 print '<td class="liste_titre center maxwidthsearch">';
712 $searchpicto = $form->showFilterButtons();
713 print $searchpicto;
714 print '</td>';
715}
716print '</tr>'."\n";
717
718$totalarray = array();
719$totalarray['nbfield'] = 0;
720
721// Fields title label
722// --------------------------------------------------------------------
723print '<tr class="liste_titre">';
724// Action column
725if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
726 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
727 $totalarray['nbfield']++;
728}
729if (!empty($arrayfields['f.ref']['checked'])) {
730 // @phan-suppress-next-line PhanTypeInvalidDimOffset
731 print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
732 $totalarray['nbfield']++;
733}
734if (!empty($arrayfields['f.ref_client']['checked'])) {
735 print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder);
736 $totalarray['nbfield']++;
737}
738if (!empty($arrayfields['s.nom']['checked'])) {
739 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
740 $totalarray['nbfield']++;
741}
742if (!empty($arrayfields['pr.ref']['checked'])) {
743 print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $param, '', $sortfield, $sortorder);
744 $totalarray['nbfield']++;
745}
746if (!empty($arrayfields['c.ref']['checked'])) {
747 print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
748 $totalarray['nbfield']++;
749}
750if (!empty($arrayfields['f.description']['checked'])) {
751 print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
752 $totalarray['nbfield']++;
753}
754// Extra fields
755include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
756// Hook fields
757$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
758$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
759print $hookmanager->resPrint;
760if (!empty($arrayfields['f.datec']['checked'])) {
761 print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
762 $totalarray['nbfield']++;
763}
764if (!empty($arrayfields['f.tms']['checked'])) {
765 print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
766 $totalarray['nbfield']++;
767}
768if (!empty($arrayfields['f.note_public']['checked'])) {
769 print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
770 $totalarray['nbfield']++;
771}
772if (!empty($arrayfields['f.note_private']['checked'])) {
773 print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
774 $totalarray['nbfield']++;
775}
776if (!empty($arrayfields['f.fk_statut']['checked'])) {
777 print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
778 $totalarray['nbfield']++;
779}
780if (!empty($arrayfields['f.signed_status']['checked'])) {
781 print_liste_field_titre($arrayfields['f.signed_status']['label'], $_SERVER["PHP_SELF"], "f.signed_status", "", $param, '', $sortfield, $sortorder, 'center ');
782 $totalarray['nbfield']++;
783}
784if (!empty($arrayfields['fd.description']['checked'])) {
785 print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
786 $totalarray['nbfield']++;
787}
788if (!empty($arrayfields['fd.date']['checked'])) {
789 print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center ');
790 $totalarray['nbfield']++;
791}
792if (!empty($arrayfields['fd.duree']['checked'])) {
793 print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right ');
794 $totalarray['nbfield']++;
795}
796
797// Action column
798if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
799 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
800 $totalarray['nbfield']++;
801}
802print "</tr>\n";
803
804
805// Loop on record
806// --------------------------------------------------------------------
807$i = 0;
808$savnbfield = $totalarray['nbfield'];
809$totalarray = array();
810$totalarray['nbfield'] = 0;
811$totalarray['val'] = array();
812$totalarray['val']['fd.duree'] = 0;
813$total = 0;
814$imaxinloop = ($limit ? min($num, $limit) : $num);
815while ($i < $imaxinloop) {
816 $obj = $db->fetch_object($resql);
817 if (empty($obj)) {
818 break; // Should not happen
819 }
820
821 // Store properties in $object
822 //$object->setVarsFromFetchObj($obj);
823
824 $objectstatic->id = $obj->rowid;
825 $objectstatic->ref = $obj->ref;
826 $objectstatic->ref_client = $obj->ref_client;
827 $objectstatic->statut = $obj->status; // deprecated
828 $objectstatic->status = $obj->status;
829 $objectstatic->signed_status = $obj->signed_status;
830
831 $companystatic->name = $obj->name;
832 $companystatic->id = $obj->socid;
833 $companystatic->client = $obj->client;
834 $companystatic->fournisseur = $obj->fournisseur;
835 $companystatic->email = $obj->email;
836 $companystatic->status = $obj->thirdpartystatus;
837
838 //mode kanban
839 if ($mode == 'kanban') {
840 if ($i == 0) {
841 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
842 print '<div class="box-flex-container kanban">';
843 }
844
845 // Output Kanban
846 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
847 $selected = 0;
848 if (in_array($object->id, $arrayofselected)) {
849 $selected = 1;
850 }
851 }
852
853 $objectstatic->duration = $obj->duree;
854 $arraydata = array();
855 $arraydata['thirdparty'] = $companystatic;
856 print $objectstatic->getKanbanView('', $arraydata);
857 if ($i == ($imaxinloop - 1)) {
858 print '</div>';
859 print '</td></tr>';
860 }
861 } else {
862 // Show here line of result
863 $j = 0;
864 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
865 // Action column
866 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
867 print '<td class="nowrap center">';
868 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
869 $selected = 0;
870 if (in_array($obj->rowid, $arrayofselected)) {
871 $selected = 1;
872 }
873 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
874 }
875 print '</td>';
876 if (!$i) {
877 $totalarray['nbfield']++;
878 }
879 }
880
881 // Picto + Ref
882 if (!empty($arrayfields['f.ref']['checked'])) {
883 print "<td>";
884
885 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
886 print '<td class="nobordernopadding nowraponall">';
887 print $objectstatic->getNomUrl(1);
888 print '</td>';
889 // Warning
890 $warnornote = '';
891 //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
892 if (!empty($obj->note_private)) {
893 $warnornote .= ($warnornote ? ' ' : '');
894 $warnornote .= '<span class="note">';
895 $warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
896 $warnornote .= '</span>';
897 }
898 if ($warnornote) {
899 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
900 print $warnornote;
901 print '</td>';
902 }
903
904 // Other picto tool
905 print '<td width="16" class="right nobordernopadding hideonsmartphone">';
906 $filename = dol_sanitizeFileName($obj->ref);
907 $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref);
908 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
909 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
910 print '</td></tr></table>';
911
912 print "</td>\n";
913 if (!$i) {
914 $totalarray['nbfield']++;
915 }
916 }
917
918 // Customer ref
919 if (!empty($arrayfields['f.ref_client']['checked'])) {
920 print '<td class="nowrap tdoverflowmax200">';
921 print dol_escape_htmltag($obj->ref_client);
922 print '</td>';
923 if (!$i) {
924 $totalarray['nbfield']++;
925 }
926 }
927 // Third party
928 if (!empty($arrayfields['s.nom']['checked'])) {
929 print '<td class="tdoverflowmax125">';
930 print $companystatic->getNomUrl(1, '', 44);
931 print '</td>';
932 if (!$i) {
933 $totalarray['nbfield']++;
934 }
935 }
936 // Project ref
937 if (!empty($arrayfields['pr.ref']['checked'])) {
938 print '<td class="tdoverflowmax150">';
939 $projetstatic->id = $obj->projet_id;
940 $projetstatic->ref = $obj->projet_ref;
941 $projetstatic->title = $obj->projet_title;
942 if ($projetstatic->id > 0) {
943 print $projetstatic->getNomUrl(1, '');
944 }
945 print '</td>';
946 if (!$i) {
947 $totalarray['nbfield']++;
948 }
949 }
950 // Contract
951 if (!empty($arrayfields['c.ref']['checked'])) {
952 print '<td class="tdoverflowmax150">';
953 $contratstatic->id = $obj->contrat_id;
954 $contratstatic->ref = $obj->contrat_ref;
955 $contratstatic->ref_customer = $obj->contrat_ref_customer;
956 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
957 if ($contratstatic->id > 0) {
958 print $contratstatic->getNomUrl(1, '');
959 print '</td>';
960 }
961 if (!$i) {
962 $totalarray['nbfield']++;
963 }
964 }
965 if (!empty($arrayfields['f.description']['checked'])) {
966 print '<td>'.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).'</td>';
967 if (!$i) {
968 $totalarray['nbfield']++;
969 }
970 }
971
972 // Extra fields
973 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
974 // Fields from hook
975 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
976 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
977 print $hookmanager->resPrint;
978 // Date creation
979 if (!empty($arrayfields['f.datec']['checked'])) {
980 print '<td class="center nowraponall">';
981 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
982 print '</td>';
983 if (!$i) {
984 $totalarray['nbfield']++;
985 }
986 }
987 // Date modification
988 if (!empty($arrayfields['f.tms']['checked'])) {
989 print '<td class="center nowraponall">';
990 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
991 print '</td>';
992 if (!$i) {
993 $totalarray['nbfield']++;
994 }
995 }
996 // Note public
997 if (!empty($arrayfields['f.note_public']['checked'])) {
998 print '<td class="sensiblehtmlcontent center">';
999 print dolPrintHTML($obj->note_public);
1000 print '</td>';
1001 if (!$i) {
1002 $totalarray['nbfield']++;
1003 }
1004 }
1005 // Note private
1006 if (!empty($arrayfields['f.note_private']['checked'])) {
1007 print '<td class="sensiblehtmlcontent center">';
1008 print dolPrintHTML($obj->note_private);
1009 print '</td>';
1010 if (!$i) {
1011 $totalarray['nbfield']++;
1012 }
1013 }
1014 // Status
1015 if (!empty($arrayfields['f.fk_statut']['checked'])) {
1016 print '<td class="center">'.$objectstatic->getLibStatut(5).'</td>';
1017 if (!$i) {
1018 $totalarray['nbfield']++;
1019 }
1020 }
1021 // Signed Status
1022 if (!empty($arrayfields['f.signed_status']['checked'])) {
1023 print '<td class="center">'.$objectstatic->getLibSignedStatus(5).'</td>';
1024 if (!$i) {
1025 $totalarray['nbfield']++;
1026 }
1027 }
1028 // Fields of detail of line
1029 if (!empty($arrayfields['fd.description']['checked'])) {
1030 $text = dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1));
1031 print '<td>';
1032 print '<div class="classfortooltip tdoverflowmax250 small" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).'">';
1033 print dol_escape_htmltag($text);
1034 print '</div>';
1035 print '</td>';
1036 if (!$i) {
1037 $totalarray['nbfield']++;
1038 }
1039 }
1040 // Date line
1041 if (!empty($arrayfields['fd.date']['checked'])) {
1042 print '<td class="center nowraponall" title="'.dol_print_date($db->jdate($obj->dp), 'dayhour').'">'.dol_print_date($db->jdate($obj->dp), 'dayhour')."</td>\n";
1043 if (!$i) {
1044 $totalarray['nbfield']++;
1045 }
1046 }
1047 // Duration line
1048 if (!empty($arrayfields['fd.duree']['checked'])) {
1049 print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
1050 if (!$i) {
1051 $totalarray['nbfield']++;
1052 }
1053 if (!$i) {
1054 $totalarray['type'][$totalarray['nbfield']] = 'duration';
1055 }
1056 if (!$i) {
1057 $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
1058 }
1059 $totalarray['val']['fd.duree'] += $obj->duree;
1060 }
1061 // Action column
1062 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1063 print '<td class="nowrap center">';
1064 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1065 $selected = 0;
1066 if (in_array($obj->rowid, $arrayofselected)) {
1067 $selected = 1;
1068 }
1069 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1070 }
1071 print '</td>';
1072 if (!$i) {
1073 $totalarray['nbfield']++;
1074 }
1075 }
1076
1077 print '</tr>'."\n";
1078
1079 $total += (isset($obj->duree) ? $obj->duree : 0);
1080 }
1081 $i++;
1082}
1083
1084
1085// Show total line
1086include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1087
1088// If no record found
1089if ($num == 0) {
1090 $colspan = 1;
1091 foreach ($arrayfields as $key => $val) {
1092 if (!empty($val['checked'])) {
1093 $colspan++;
1094 }
1095 }
1096 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1097}
1098
1099$db->free($resql);
1100
1101$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1102$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1103print $hookmanager->resPrint;
1104
1105print '</table>'."\n";
1106print '</div>'."\n";
1107
1108print '</form>'."\n";
1109
1110if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1111 $hidegeneratedfilelistifempty = 1;
1112 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1113 $hidegeneratedfilelistifempty = 0;
1114 }
1115
1116 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1117 $formfile = new FormFile($db);
1118
1119 // Show list of available documents
1120 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1121 $urlsource .= str_replace('&amp;', '&', $param);
1122
1123 $filedir = $diroutputmassaction;
1124 $genallowed = $permissiontoread;
1125 $delallowed = $permissiontoadd;
1126
1127 print $formfile->showdocuments('massfilesarea_interventions', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1128}
1129
1130// End of page
1131llxFooter();
1132$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to manage standard extra fields.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
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.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
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.
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...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.