dolibarr 23.0.4
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-2026 Charlène Benke <charlene@patas-monkey.com>
11 * Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
12 * Copyright (C) 2024-2026 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:int');
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' => (string) (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
157 'f.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'position' => 511, 'enabled' => (string) (!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// Extra fields
165include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
166
167$object->fields = dol_sort_array($object->fields, 'position');
168$arrayfields = dol_sort_array($arrayfields, 'position');
169
170// Security check
171$id = GETPOSTINT('id');
172if ($user->socid) {
173 $socid = $user->socid;
174}
175$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
176
177$permissiontoreadallthirdparty = $user->hasRight('societe', 'client', 'voir');
178$permissiontoread = $user->hasRight('ficheinter', 'lire');
179$permissiontoadd = $user->hasRight('ficheinter', 'creer');
180$permissiontodelete = $user->hasRight('ficheinter', 'supprimer');
181
182
183/*
184 * Actions
185 */
186
187if (GETPOST('cancel', 'alpha')) {
188 $action = 'list';
189 $massaction = '';
190}
191if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
192 $massaction = '';
193}
194
195$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
196$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
197if ($reshook < 0) {
198 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
199}
200
201if (empty($reshook)) {
202 // Selection of new fields
203 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
204
205 // Purge search criteria
206 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
207 $search_ref = "";
208 $search_ref_client = "";
209 $search_company = "";
210 $search_projet_ref = "";
211 $search_contrat_ref = "";
212 $search_desc = "";
213 $search_status = "";
214 $search_signed_status = '';
215 $search_date_startday = '';
216 $search_date_startmonth = '';
217 $search_date_startyear = '';
218 $search_date_endday = '';
219 $search_date_endmonth = '';
220 $search_date_endyear = '';
221 $search_date_start = '';
222 $search_date_end = '';
223 $toselect = array();
224 $search_array_options = array();
225 }
226
227 // Mass actions
228 $objectclass = 'Fichinter';
229 $objectlabel = 'Interventions';
230 $uploaddir = $conf->ficheinter->dir_output;
231 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
232}
233
234
235
236/*
237 * View
238 */
239
240
241$form = new Form($db);
242$formfile = new FormFile($db);
243$objectstatic = new Fichinter($db);
244$companystatic = new Societe($db);
245$projetstatic = null;
246$contratstatic = null;
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// The table of lines is joined only if a field of lines is shown, so do not search into it otherwise
273if (!$atleastonefieldinlines) {
274 unset($fieldstosearchall['fd.description']);
275}
276
277$sql = "SELECT";
278$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,";
279if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
280 $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
281}
282$sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
283if (isModEnabled('project')) {
284 $sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
285}
286if (isModEnabled('contract')) {
287 $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";
288}
289// Add fields from extrafields
290if (!empty($extrafields->attributes[$object->table_element]['label'])) {
291 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
292 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
293 }
294}
295// Add fields from hooks
296$parameters = array();
297$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
298$sql .= $hookmanager->resPrint;
299
300$sqlfields = $sql; // $sql fields to remove for count total
301
302$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
303if (isModEnabled('project')) {
304 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr on f.fk_projet = pr.rowid";
305}
306if (isModEnabled('contract')) {
307 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid";
308}
309if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
310 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
311}
312if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
313 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
314}
315
316// Add table from hooks
317$parameters = array();
318$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
319$sql .= $hookmanager->resPrint;
320
321$sql .= ", ".MAIN_DB_PREFIX."societe as s";
322$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
323$sql .= " AND f.fk_soc = s.rowid";
324if ($search_ref) {
325 $sql .= natural_search('f.ref', $search_ref);
326}
327if ($search_ref_client) {
328 $sql .= natural_search('f.ref_client', $search_ref_client);
329}
330if ($search_company) {
331 $sql .= natural_search('s.nom', $search_company);
332}
333if ($search_projet_ref) {
334 $sql .= natural_search('pr.ref', $search_projet_ref);
335}
336if ($search_contrat_ref) {
337 $sql .= natural_search('c.ref', $search_contrat_ref);
338}
339if ($search_desc) {
340 if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
341 $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
342 } else {
343 $sql .= natural_search(array('f.description'), $search_desc);
344 }
345}
346if ($search_status != '' && $search_status >= 0) {
347 $sql .= ' AND f.fk_statut = '.((int) ($search_status));
348}
349if ($search_signed_status != '' && $search_signed_status >= 0) {
350 $sql .= ' AND f.signed_status = '.((int) $search_signed_status);
351}
352if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
353 if ($search_date_start) {
354 $sql .= " AND fd.date >= '".$db->idate($search_date_start)."'";
355 }
356 if ($search_date_end) {
357 $sql .= " AND fd.date <= '".$db->idate($search_date_end)."'";
358 }
359}
360if ($socid > 0) {
361 $sql .= " AND s.rowid = ".((int) $socid);
362}
363// Restriction on sale representative
364if (empty($user->socid) && !$permissiontoreadallthirdparty) {
365 $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) $user->id).")";
366 if (getDolGlobalInt('MAIN_SEE_SUBORDINATES') && $userschilds) {
367 $sql .= " OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(',', $userschilds))."))";
368 }
369 $sql .= ")";
370}
371
372if ($search_all) {
373 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
374}
375// Search on sale representative
376/*
377if ($search_sale && $search_sale != '-1') {
378 if ($search_sale == -2) {
379 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
380 } elseif ($search_sale > 0) {
381 $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).")";
382 }
383}*/
384// Add where from extra fields
385include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
386// Add where from hooks
387$parameters = array();
388$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
389$sql .= $hookmanager->resPrint;
390// Add GroupBy from hooks
391$parameters = array('search_all' => $search_all, 'fieldstosearchall' => $fieldstosearchall);
392$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
393$sql .= $hookmanager->resPrint;
394
395// Count total nb of records
396$nbtotalofrecords = '';
397if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
398 /* The fast and low memory method to get and count full list converts the sql into a sql count */
399 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
400 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
401 $resql = $db->query($sqlforcount);
402 if ($resql) {
403 $objforcount = $db->fetch_object($resql);
404 $nbtotalofrecords = $objforcount->nbtotalofrecords;
405 } else {
406 dol_print_error($db);
407 }
408
409 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
410 $page = 0;
411 $offset = 0;
412 }
413 $db->free($resql);
414}
415
416// Complete request and execute it with limit
417$sql .= $db->order($sortfield, $sortorder);
418if ($limit) {
419 $sql .= $db->plimit($limit + 1, $offset);
420}
421
422$resql = $db->query($sql);
423if (!$resql) {
424 dol_print_error($db);
425 exit;
426}
427
428$num = $db->num_rows($resql);
429
430
431// Direct jump if only one record found
432if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
433 $obj = $db->fetch_object($resql);
434 $id = $obj->rowid;
435 header("Location: ".dol_buildpath('/fichinter/card.php', 1).'?id='.$id);
436 exit;
437}
438
439
440// Output page
441// --------------------------------------------------------------------
442
443llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-fichinter page-list'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
444
445
446$arrayofselected = is_array($toselect) ? $toselect : array();
447
448if ($socid > 0) {
449 $soc = new Societe($db);
450 $soc->fetch($socid);
451 if (empty($search_company)) {
452 $search_company = $soc->name;
453 }
454}
455
456$param = '';
457if (!empty($mode)) {
458 $param .= '&mode='.urlencode($mode);
459}
460if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
461 $param .= '&contextpage='.urlencode($contextpage);
462}
463if ($limit > 0 && $limit != $conf->liste_limit) {
464 $param .= '&limit='.((int) $limit);
465}
466if ($search_all) {
467 $param .= "&search_all=".urlencode($search_all);
468}
469if ($socid) {
470 $param .= "&socid=".urlencode((string) ($socid));
471}
472if ($search_ref) {
473 $param .= "&search_ref=".urlencode($search_ref);
474}
475if ($search_ref_client) {
476 $param .= "&search_ref_client=".urlencode($search_ref_client);
477}
478if ($search_company) {
479 $param .= "&search_company=".urlencode($search_company);
480}
481if ($search_desc) {
482 $param .= "&search_desc=".urlencode($search_desc);
483}
484if ($search_projet_ref) {
485 $param .= "&search_projet_ref=".urlencode($search_projet_ref);
486}
487if ($search_contrat_ref) {
488 $param .= "&search_contrat_ref=".urlencode($search_contrat_ref);
489}
490if ($search_status != '' && $search_status > -1) {
491 $param .= "&search_status=".urlencode($search_status);
492}
493if ($search_signed_status != '' && $search_signed_status >= 0) {
494 $param .= '&search_signed_status='.urlencode($search_signed_status);
495}
496if ($search_date_startday > 0) {
497 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
498}
499if ($search_date_startmonth > 0) {
500 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
501}
502if ($search_date_startyear > 0) {
503 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
504}
505if ($search_date_endday > 0) {
506 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
507}
508if ($search_date_endmonth > 0) {
509 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
510}
511if ($search_date_endyear > 0) {
512 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
513}
514if ($show_files) {
515 $param .= '&show_files='.urlencode((string) ($show_files));
516}
517if ($optioncss != '') {
518 $param .= '&optioncss='.urlencode($optioncss);
519}
520// Add $param from extra fields
521include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
522// Add $param from hooks
523$parameters = array('param' => &$param);
524$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
525$param .= $hookmanager->resPrint;
526
527// List of mass actions available
528$arrayofmassactions = array(
529 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
530 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
531 //'presend'=>$langs->trans("SendByMail"),
532);
533if (!empty($permissiontodelete)) {
534 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
535}
536if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
537 $arrayofmassactions = array();
538}
539$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
540
541
542print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
543if ($optioncss != '') {
544 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
545}
546print '<input type="hidden" name="token" value="'.newToken().'">';
547print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
548print '<input type="hidden" name="action" value="list">';
549print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
550print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
551print '<input type="hidden" name="page" value="'.$page.'">';
552print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
553print '<input type="hidden" name="page_y" value="">';
554print '<input type="hidden" name="mode" value="'.$mode.'">';
555
556$newcardbutton = '';
557$url = DOL_URL_ROOT.'/fichinter/card.php?action=create';
558if (!empty($socid)) {
559 $url .= '&socid='.$socid;
560}
561$newcardbutton = '';
562$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'));
563$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'));
564$newcardbutton .= dolGetButtonTitleSeparator();
565$newcardbutton .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('ficheinter', 'creer'));
566
567print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
568
569$topicmail = "Information";
570$modelmail = "intervention";
571$objecttmp = new Fichinter($db);
572$trackid = 'int'.$object->id;
573include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
574
575if ($search_all) {
576 $setupstring = '';
577 foreach ($fieldstosearchall as $key => $val) {
578 $fieldstosearchall[$key] = $langs->trans($val);
579 $setupstring .= $key."=".$val.";";
580 }
581 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
582 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
583}
584
585$moreforfilter = '';
586
587$parameters = array();
588$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
589if (empty($reshook)) {
590 $moreforfilter .= $hookmanager->resPrint;
591} else {
592 $moreforfilter = $hookmanager->resPrint;
593}
594
595if (!empty($moreforfilter)) {
596 print '<div class="liste_titre liste_titre_bydiv centpercent">';
597 print $moreforfilter;
598 print '</div>';
599}
600
601$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
602$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
603$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
604$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
605
606print '<div class="div-table-responsive">';
607print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
608
609// Fields title search
610// --------------------------------------------------------------------
611print '<tr class="liste_titre_filter">';
612// Action column
613if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
614 print '<td class="liste_titre center maxwidthsearch">';
615 $searchpicto = $form->showFilterButtons('left');
616 print $searchpicto;
617 print '</td>';
618}
619if (!empty($arrayfields['f.ref']['checked'])) {
620 print '<td class="liste_titre">';
621 print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
622 print '</td>';
623}
624if (!empty($arrayfields['f.ref_client']['checked'])) {
625 print '<td class="liste_titre">';
626 print '<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.'" size="8">';
627 print '</td>';
628}
629if (!empty($arrayfields['s.nom']['checked'])) {
630 print '<td class="liste_titre">';
631 print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
632 print '</td>';
633}
634if (!empty($arrayfields['pr.ref']['checked'])) {
635 print '<td class="liste_titre">';
636 print '<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.'" size="8">';
637 print '</td>';
638}
639if (!empty($arrayfields['c.ref']['checked'])) {
640 print '<td class="liste_titre">';
641 print '<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.'" size="8">';
642 print '</td>';
643}
644if (!empty($arrayfields['f.description']['checked'])) {
645 print '<td class="liste_titre">';
646 print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
647 print '</td>';
648}
649// Extra fields
650include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
651
652// Fields from hook
653$parameters = array('arrayfields' => $arrayfields);
654$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
655print $hookmanager->resPrint;
656if (!empty($arrayfields['f.datec']['checked'])) {
657 // Date creation
658 print '<td class="liste_titre">';
659 print '</td>';
660}
661if (!empty($arrayfields['f.tms']['checked'])) {
662 // Date modification
663 print '<td class="liste_titre">';
664 print '</td>';
665}
666if (!empty($arrayfields['f.note_public']['checked'])) {
667 // Note public
668 print '<td class="liste_titre">';
669 print '</td>';
670}
671if (!empty($arrayfields['f.note_private']['checked'])) {
672 // Note private
673 print '<td class="liste_titre">';
674 print '</td>';
675}
676// Status
677if (!empty($arrayfields['f.fk_statut']['checked'])) {
678 print '<td class="liste_titre right parentonrightofpage">';
679 $liststatus = [
680 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv('Draft'),
681 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv('Validated'),
682 $object::STATUS_BILLED => $langs->transnoentitiesnoconv('StatusInterInvoiced'),
683 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv('Done'),
684 ];
685 if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) {
686 unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
687 }
688 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
689 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
690 print '</td>';
691}
692// Signed status
693if (!empty($arrayfields['f.signed_status']['checked'])) {
694 print '<td class="liste_titre center">';
695 $list_signed_status = $object->getSignedStatusLocalisedArray();
696 print $form->selectarray('search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status');
697 print '</td>';
698}
699// Fields of detail line
700if (!empty($arrayfields['fd.description']['checked'])) {
701 print '<td class="liste_titre">&nbsp;</td>';
702}
703if (!empty($arrayfields['fd.date']['checked'])) {
704 print '<td class="liste_titre center">';
705 print '<div class="nowrapfordate">';
706 print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
707 print '</div>';
708 print '<div class="nowrapfordate">';
709 print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
710 print '</div>';
711 print '</td>';
712}
713if (!empty($arrayfields['fd.duree']['checked'])) {
714 print '<td class="liste_titre">&nbsp;</td>';
715}
716// Action column
717if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
718 print '<td class="liste_titre center maxwidthsearch">';
719 $searchpicto = $form->showFilterButtons();
720 print $searchpicto;
721 print '</td>';
722}
723print '</tr>'."\n";
724
725$totalarray = array();
726$totalarray['nbfield'] = 0;
727
728// Fields title label
729// --------------------------------------------------------------------
730print '<tr class="liste_titre">';
731// Action column
732if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
733 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
734 $totalarray['nbfield']++;
735}
736if (!empty($arrayfields['f.ref']['checked'])) {
737 // @phan-suppress-next-line PhanTypeInvalidDimOffset
738 print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
739 $totalarray['nbfield']++;
740}
741if (!empty($arrayfields['f.ref_client']['checked'])) {
742 print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder);
743 $totalarray['nbfield']++;
744}
745if (!empty($arrayfields['s.nom']['checked'])) {
746 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
747 $totalarray['nbfield']++;
748}
749if (!empty($arrayfields['pr.ref']['checked'])) {
750 print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $param, '', $sortfield, $sortorder);
751 $totalarray['nbfield']++;
752}
753if (!empty($arrayfields['c.ref']['checked'])) {
754 print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
755 $totalarray['nbfield']++;
756}
757if (!empty($arrayfields['f.description']['checked'])) {
758 print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
759 $totalarray['nbfield']++;
760}
761// Extra fields
762include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
763// Hook fields
764$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
765$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
766print $hookmanager->resPrint;
767if (!empty($arrayfields['f.datec']['checked'])) {
768 print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
769 $totalarray['nbfield']++;
770}
771if (!empty($arrayfields['f.tms']['checked'])) {
772 print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
773 $totalarray['nbfield']++;
774}
775if (!empty($arrayfields['f.note_public']['checked'])) {
776 print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
777 $totalarray['nbfield']++;
778}
779if (!empty($arrayfields['f.note_private']['checked'])) {
780 print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
781 $totalarray['nbfield']++;
782}
783if (!empty($arrayfields['f.fk_statut']['checked'])) {
784 print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
785 $totalarray['nbfield']++;
786}
787if (!empty($arrayfields['f.signed_status']['checked'])) {
788 print_liste_field_titre($arrayfields['f.signed_status']['label'], $_SERVER["PHP_SELF"], "f.signed_status", "", $param, '', $sortfield, $sortorder, 'center ');
789 $totalarray['nbfield']++;
790}
791if (!empty($arrayfields['fd.description']['checked'])) {
792 print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
793 $totalarray['nbfield']++;
794}
795if (!empty($arrayfields['fd.date']['checked'])) {
796 print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center ');
797 $totalarray['nbfield']++;
798}
799if (!empty($arrayfields['fd.duree']['checked'])) {
800 print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right ');
801 $totalarray['nbfield']++;
802}
803
804// Action column
805if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
806 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
807 $totalarray['nbfield']++;
808}
809print "</tr>\n";
810
811
812// Loop on record
813// --------------------------------------------------------------------
814$i = 0;
815$savnbfield = $totalarray['nbfield'];
816$totalarray = array();
817$totalarray['nbfield'] = 0;
818$totalarray['val'] = array();
819$totalarray['val']['fd.duree'] = 0;
820$total = 0;
821$imaxinloop = ($limit ? min($num, $limit) : $num);
822while ($i < $imaxinloop) {
823 $obj = $db->fetch_object($resql);
824 if (empty($obj)) {
825 break; // Should not happen
826 }
827
828 // Store properties in $object
829 //$object->setVarsFromFetchObj($obj);
830
831 $objectstatic->id = $obj->rowid;
832 $objectstatic->ref = $obj->ref;
833 $objectstatic->ref_client = $obj->ref_client;
834 $objectstatic->statut = $obj->status; // deprecated
835 $objectstatic->status = $obj->status;
836 $objectstatic->signed_status = $obj->signed_status;
837
838 $companystatic->name = $obj->name;
839 $companystatic->id = $obj->socid;
840 $companystatic->client = $obj->client;
841 $companystatic->fournisseur = $obj->fournisseur;
842 $companystatic->email = $obj->email;
843 $companystatic->status = $obj->thirdpartystatus;
844
845 //mode kanban
846 if ($mode == 'kanban') {
847 if ($i == 0) {
848 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
849 print '<div class="box-flex-container kanban">';
850 }
851
852 // Output Kanban
853 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
854 $selected = 0;
855 if (in_array($object->id, $arrayofselected)) {
856 $selected = 1;
857 }
858 }
859
860 $objectstatic->duration = $obj->duree;
861 $arraydata = array();
862 $arraydata['thirdparty'] = $companystatic;
863 print $objectstatic->getKanbanView('', $arraydata);
864 if ($i == ($imaxinloop - 1)) {
865 print '</div>';
866 print '</td></tr>';
867 }
868 } else {
869 // Show here line of result
870 $j = 0;
871 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
872 // Action column
873 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
874 print '<td class="nowrap center">';
875 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
876 $selected = 0;
877 if (in_array($obj->rowid, $arrayofselected)) {
878 $selected = 1;
879 }
880 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
881 }
882 print '</td>';
883 if (!$i) {
884 $totalarray['nbfield']++;
885 }
886 }
887
888 // Picto + Ref
889 if (!empty($arrayfields['f.ref']['checked'])) {
890 print "<td>";
891
892 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
893 print '<td class="nobordernopadding nowraponall">';
894 print $objectstatic->getNomUrl(1);
895 print '</td>';
896 // Warning
897 $warnornote = '';
898 //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
899 if (!empty($obj->note_private)) {
900 $warnornote .= ($warnornote ? ' ' : '');
901 $warnornote .= '<span class="note">';
902 $warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
903 $warnornote .= '</span>';
904 }
905 if ($warnornote) {
906 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
907 print $warnornote;
908 print '</td>';
909 }
910
911 // Other picto tool
912 print '<td width="16" class="right nobordernopadding hideonsmartphone">';
913 $filename = dol_sanitizeFileName($obj->ref);
914 $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref);
915 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
916 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
917 print '</td></tr></table>';
918
919 print "</td>\n";
920 if (!$i) {
921 $totalarray['nbfield']++;
922 }
923 }
924
925 // Customer ref
926 if (!empty($arrayfields['f.ref_client']['checked'])) {
927 print '<td class="nowrap tdoverflowmax200">';
928 print dol_escape_htmltag($obj->ref_client);
929 print '</td>';
930 if (!$i) {
931 $totalarray['nbfield']++;
932 }
933 }
934 // Third party
935 if (!empty($arrayfields['s.nom']['checked'])) {
936 print '<td class="tdoverflowmax125">';
937 print $companystatic->getNomUrl(1, '', 44);
938 print '</td>';
939 if (!$i) {
940 $totalarray['nbfield']++;
941 }
942 }
943 // Project ref
944 if (!empty($arrayfields['pr.ref']['checked']) && $projetstatic !== null) {
945 print '<td class="tdoverflowmax150">';
946 $projetstatic->id = $obj->projet_id;
947 $projetstatic->ref = $obj->projet_ref;
948 $projetstatic->title = $obj->projet_title;
949 if ($projetstatic->id > 0) {
950 print $projetstatic->getNomUrl(1, '');
951 }
952 print '</td>';
953 if (!$i) {
954 $totalarray['nbfield']++;
955 }
956 }
957 // Contract
958 if (!empty($arrayfields['c.ref']['checked']) && $contratstatic !== null) {
959 print '<td class="tdoverflowmax150">';
960 $contratstatic->id = $obj->contrat_id;
961 $contratstatic->ref = $obj->contrat_ref;
962 $contratstatic->ref_customer = $obj->contrat_ref_customer;
963 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
964 if ($contratstatic->id > 0) {
965 print $contratstatic->getNomUrl(1, 0);
966 print '</td>';
967 }
968 if (!$i) {
969 $totalarray['nbfield']++;
970 }
971 }
972 if (!empty($arrayfields['f.description']['checked'])) {
973 print '<td>'.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).'</td>';
974 if (!$i) {
975 $totalarray['nbfield']++;
976 }
977 }
978
979 // Extra fields
980 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
981 // Fields from hook
982 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
983 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
984 print $hookmanager->resPrint;
985 // Date creation
986 if (!empty($arrayfields['f.datec']['checked'])) {
987 print '<td class="center nowraponall">';
988 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
989 print '</td>';
990 if (!$i) {
991 $totalarray['nbfield']++;
992 }
993 }
994 // Date modification
995 if (!empty($arrayfields['f.tms']['checked'])) {
996 print '<td class="center nowraponall">';
997 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
998 print '</td>';
999 if (!$i) {
1000 $totalarray['nbfield']++;
1001 }
1002 }
1003 // Note public
1004 if (!empty($arrayfields['f.note_public']['checked'])) {
1005 print '<td class="sensiblehtmlcontent center">';
1006 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1007 print '</td>';
1008 if (!$i) {
1009 $totalarray['nbfield']++;
1010 }
1011 }
1012 // Note private
1013 if (!empty($arrayfields['f.note_private']['checked'])) {
1014 print '<td class="sensiblehtmlcontent center">';
1015 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1016 print '</td>';
1017 if (!$i) {
1018 $totalarray['nbfield']++;
1019 }
1020 }
1021 // Status
1022 if (!empty($arrayfields['f.fk_statut']['checked'])) {
1023 print '<td class="center">'.$objectstatic->getLibStatut(5).'</td>';
1024 if (!$i) {
1025 $totalarray['nbfield']++;
1026 }
1027 }
1028 // Signed Status
1029 if (!empty($arrayfields['f.signed_status']['checked'])) {
1030 print '<td class="center">'.$objectstatic->getLibSignedStatus(5).'</td>';
1031 if (!$i) {
1032 $totalarray['nbfield']++;
1033 }
1034 }
1035 // Fields of detail of line
1036 if (!empty($arrayfields['fd.description']['checked'])) {
1037 $text = dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1));
1038 print '<td>';
1039 print '<div class="classfortooltip tdoverflowmax250 small" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).'">';
1040 print dol_escape_htmltag($text);
1041 print '</div>';
1042 print '</td>';
1043 if (!$i) {
1044 $totalarray['nbfield']++;
1045 }
1046 }
1047 // Date line
1048 if (!empty($arrayfields['fd.date']['checked'])) {
1049 print '<td class="center nowraponall" title="'.dol_print_date($db->jdate($obj->dp), 'dayhour').'">'.dol_print_date($db->jdate($obj->dp), 'dayhour')."</td>\n";
1050 if (!$i) {
1051 $totalarray['nbfield']++;
1052 }
1053 }
1054 // Duration line
1055 if (!empty($arrayfields['fd.duree']['checked'])) {
1056 print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
1057 if (!$i) {
1058 $totalarray['nbfield']++;
1059 }
1060 if (!$i) {
1061 $totalarray['type'][$totalarray['nbfield']] = 'duration';
1062 }
1063 if (!$i) {
1064 $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
1065 }
1066 $totalarray['val']['fd.duree'] += $obj->duree;
1067 }
1068 // Action column
1069 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1070 print '<td class="nowrap center">';
1071 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1072 $selected = 0;
1073 if (in_array($obj->rowid, $arrayofselected)) {
1074 $selected = 1;
1075 }
1076 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1077 }
1078 print '</td>';
1079 if (!$i) {
1080 $totalarray['nbfield']++;
1081 }
1082 }
1083
1084 print '</tr>'."\n";
1085
1086 $total += (isset($obj->duree) ? $obj->duree : 0);
1087 }
1088 $i++;
1089}
1090
1091
1092// Show total line
1093include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1094
1095// If no record found
1096if ($num == 0) {
1097 $colspan = 1;
1098 foreach ($arrayfields as $key => $val) {
1099 if (!empty($val['checked'])) {
1100 $colspan++;
1101 }
1102 }
1103 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1104}
1105
1106$db->free($resql);
1107
1108$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1109$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1110print $hookmanager->resPrint;
1111
1112print '</table>'."\n";
1113print '</div>'."\n";
1114
1115print '</form>'."\n";
1116
1117if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1118 $hidegeneratedfilelistifempty = 1;
1119 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1120 $hidegeneratedfilelistifempty = 0;
1121 }
1122
1123 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1124 $formfile = new FormFile($db);
1125
1126 // Show list of available documents
1127 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1128 $urlsource .= str_replace('&amp;', '&', $param);
1129
1130 $filedir = $diroutputmassaction;
1131 $genallowed = $permissiontoread;
1132 $delallowed = $permissiontoadd;
1133
1134 print $formfile->showdocuments('massfilesarea_interventions', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1135}
1136
1137// End of page
1138llxFooter();
1139$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition export.php:1216
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to 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_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.