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
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
317$sql .= ", ".MAIN_DB_PREFIX."societe as s";
318$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
319$sql .= " AND f.fk_soc = s.rowid";
320if ($search_ref) {
321 $sql .= natural_search('f.ref', $search_ref);
322}
323if ($search_ref_client) {
324 $sql .= natural_search('f.ref_client', $search_ref_client);
325}
326if ($search_company) {
327 $sql .= natural_search('s.nom', $search_company);
328}
329if ($search_projet_ref) {
330 $sql .= natural_search('pr.ref', $search_projet_ref);
331}
332if ($search_contrat_ref) {
333 $sql .= natural_search('c.ref', $search_contrat_ref);
334}
335if ($search_desc) {
336 if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
337 $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
338 } else {
339 $sql .= natural_search(array('f.description'), $search_desc);
340 }
341}
342if ($search_status != '' && $search_status >= 0) {
343 $sql .= ' AND f.fk_statut = '.((int) ($search_status));
344}
345if ($search_signed_status != '' && $search_signed_status >= 0) {
346 $sql .= ' AND f.signed_status = '.((int) $search_signed_status);
347}
348if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
349 if ($search_date_start) {
350 $sql .= " AND fd.date >= '".$db->idate($search_date_start)."'";
351 }
352 if ($search_date_end) {
353 $sql .= " AND fd.date <= '".$db->idate($search_date_end)."'";
354 }
355}
356if ($socid > 0) {
357 $sql .= " AND s.rowid = ".((int) $socid);
358}
359// Restriction on sale representative
360if (empty($user->socid) && !$permissiontoreadallthirdparty) {
361 $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).")";
362 if (getDolGlobalInt('MAIN_SEE_SUBORDINATES') && $userschilds) {
363 $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))."))";
364 }
365 $sql .= ")";
366}
367
368if ($search_all) {
369 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
370}
371// Search on sale representative
372/*
373if ($search_sale && $search_sale != '-1') {
374 if ($search_sale == -2) {
375 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc)";
376 } elseif ($search_sale > 0) {
377 $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).")";
378 }
379}*/
380// Add where from extra fields
381include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
382// Add where from hooks
383$parameters = array();
384$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
385$sql .= $hookmanager->resPrint;
386// Add GroupBy from hooks
387$parameters = array('search_all' => $search_all, 'fieldstosearchall' => $fieldstosearchall);
388$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
389$sql .= $hookmanager->resPrint;
390
391// Count total nb of records
392$nbtotalofrecords = '';
393if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
394 /* The fast and low memory method to get and count full list converts the sql into a sql count */
395 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
396 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
397 $resql = $db->query($sqlforcount);
398 if ($resql) {
399 $objforcount = $db->fetch_object($resql);
400 $nbtotalofrecords = $objforcount->nbtotalofrecords;
401 } else {
402 dol_print_error($db);
403 }
404
405 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
406 $page = 0;
407 $offset = 0;
408 }
409 $db->free($resql);
410}
411
412// Complete request and execute it with limit
413$sql .= $db->order($sortfield, $sortorder);
414if ($limit) {
415 $sql .= $db->plimit($limit + 1, $offset);
416}
417
418$resql = $db->query($sql);
419if (!$resql) {
420 dol_print_error($db);
421 exit;
422}
423
424$num = $db->num_rows($resql);
425
426
427// Direct jump if only one record found
428if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
429 $obj = $db->fetch_object($resql);
430 $id = $obj->rowid;
431 header("Location: ".dol_buildpath('/fichinter/card.php', 1).'?id='.$id);
432 exit;
433}
434
435
436// Output page
437// --------------------------------------------------------------------
438
439llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist mod-fichinter page-list'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
440
441
442$arrayofselected = is_array($toselect) ? $toselect : array();
443
444if ($socid > 0) {
445 $soc = new Societe($db);
446 $soc->fetch($socid);
447 if (empty($search_company)) {
448 $search_company = $soc->name;
449 }
450}
451
452$param = '';
453if (!empty($mode)) {
454 $param .= '&mode='.urlencode($mode);
455}
456if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
457 $param .= '&contextpage='.urlencode($contextpage);
458}
459if ($limit > 0 && $limit != $conf->liste_limit) {
460 $param .= '&limit='.((int) $limit);
461}
462if ($search_all) {
463 $param .= "&search_all=".urlencode($search_all);
464}
465if ($socid) {
466 $param .= "&socid=".urlencode((string) ($socid));
467}
468if ($search_ref) {
469 $param .= "&search_ref=".urlencode($search_ref);
470}
471if ($search_ref_client) {
472 $param .= "&search_ref_client=".urlencode($search_ref_client);
473}
474if ($search_company) {
475 $param .= "&search_company=".urlencode($search_company);
476}
477if ($search_desc) {
478 $param .= "&search_desc=".urlencode($search_desc);
479}
480if ($search_projet_ref) {
481 $param .= "&search_projet_ref=".urlencode($search_projet_ref);
482}
483if ($search_contrat_ref) {
484 $param .= "&search_contrat_ref=".urlencode($search_contrat_ref);
485}
486if ($search_status != '' && $search_status > -1) {
487 $param .= "&search_status=".urlencode($search_status);
488}
489if ($search_signed_status != '' && $search_signed_status >= 0) {
490 $param .= '&search_signed_status='.urlencode($search_signed_status);
491}
492if ($search_date_startday > 0) {
493 $param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
494}
495if ($search_date_startmonth > 0) {
496 $param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
497}
498if ($search_date_startyear > 0) {
499 $param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
500}
501if ($search_date_endday > 0) {
502 $param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
503}
504if ($search_date_endmonth > 0) {
505 $param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
506}
507if ($search_date_endyear > 0) {
508 $param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
509}
510if ($show_files) {
511 $param .= '&show_files='.urlencode((string) ($show_files));
512}
513if ($optioncss != '') {
514 $param .= '&optioncss='.urlencode($optioncss);
515}
516// Add $param from extra fields
517include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
518// Add $param from hooks
519$parameters = array('param' => &$param);
520$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
521$param .= $hookmanager->resPrint;
522
523// List of mass actions available
524$arrayofmassactions = array(
525 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
526 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
527 //'presend'=>$langs->trans("SendByMail"),
528);
529if (!empty($permissiontodelete)) {
530 $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
531}
532if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete'))) {
533 $arrayofmassactions = array();
534}
535$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
536
537
538print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
539if ($optioncss != '') {
540 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
541}
542print '<input type="hidden" name="token" value="'.newToken().'">';
543print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
544print '<input type="hidden" name="action" value="list">';
545print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
546print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
547print '<input type="hidden" name="page" value="'.$page.'">';
548print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
549print '<input type="hidden" name="page_y" value="">';
550print '<input type="hidden" name="mode" value="'.$mode.'">';
551
552$newcardbutton = '';
553$url = DOL_URL_ROOT.'/fichinter/card.php?action=create';
554if (!empty($socid)) {
555 $url .= '&socid='.$socid;
556}
557$newcardbutton = '';
558$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'));
559$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'));
560$newcardbutton .= dolGetButtonTitleSeparator();
561$newcardbutton .= dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('ficheinter', 'creer'));
562
563print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
564
565$topicmail = "Information";
566$modelmail = "intervention";
567$objecttmp = new Fichinter($db);
568$trackid = 'int'.$object->id;
569include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
570
571if ($search_all) {
572 $setupstring = '';
573 foreach ($fieldstosearchall as $key => $val) {
574 $fieldstosearchall[$key] = $langs->trans($val);
575 $setupstring .= $key."=".$val.";";
576 }
577 print '<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
578 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>'."\n";
579}
580
581$moreforfilter = '';
582
583$parameters = array();
584$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
585if (empty($reshook)) {
586 $moreforfilter .= $hookmanager->resPrint;
587} else {
588 $moreforfilter = $hookmanager->resPrint;
589}
590
591if (!empty($moreforfilter)) {
592 print '<div class="liste_titre liste_titre_bydiv centpercent">';
593 print $moreforfilter;
594 print '</div>';
595}
596
597$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
598$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
599$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
600$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
601
602print '<div class="div-table-responsive">';
603print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
604
605// Fields title search
606// --------------------------------------------------------------------
607print '<tr class="liste_titre_filter">';
608// Action column
609if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
610 print '<td class="liste_titre center maxwidthsearch">';
611 $searchpicto = $form->showFilterButtons('left');
612 print $searchpicto;
613 print '</td>';
614}
615if (!empty($arrayfields['f.ref']['checked'])) {
616 print '<td class="liste_titre">';
617 print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
618 print '</td>';
619}
620if (!empty($arrayfields['f.ref_client']['checked'])) {
621 print '<td class="liste_titre">';
622 print '<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.'" size="8">';
623 print '</td>';
624}
625if (!empty($arrayfields['s.nom']['checked'])) {
626 print '<td class="liste_titre">';
627 print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
628 print '</td>';
629}
630if (!empty($arrayfields['pr.ref']['checked'])) {
631 print '<td class="liste_titre">';
632 print '<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.'" size="8">';
633 print '</td>';
634}
635if (!empty($arrayfields['c.ref']['checked'])) {
636 print '<td class="liste_titre">';
637 print '<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.'" size="8">';
638 print '</td>';
639}
640if (!empty($arrayfields['f.description']['checked'])) {
641 print '<td class="liste_titre">';
642 print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
643 print '</td>';
644}
645// Extra fields
646include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
647
648// Fields from hook
649$parameters = array('arrayfields' => $arrayfields);
650$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
651print $hookmanager->resPrint;
652if (!empty($arrayfields['f.datec']['checked'])) {
653 // Date creation
654 print '<td class="liste_titre">';
655 print '</td>';
656}
657if (!empty($arrayfields['f.tms']['checked'])) {
658 // Date modification
659 print '<td class="liste_titre">';
660 print '</td>';
661}
662if (!empty($arrayfields['f.note_public']['checked'])) {
663 // Note public
664 print '<td class="liste_titre">';
665 print '</td>';
666}
667if (!empty($arrayfields['f.note_private']['checked'])) {
668 // Note private
669 print '<td class="liste_titre">';
670 print '</td>';
671}
672// Status
673if (!empty($arrayfields['f.fk_statut']['checked'])) {
674 print '<td class="liste_titre right parentonrightofpage">';
675 $liststatus = [
676 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv('Draft'),
677 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv('Validated'),
678 $object::STATUS_BILLED => $langs->transnoentitiesnoconv('StatusInterInvoiced'),
679 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv('Done'),
680 ];
681 if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) {
682 unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
683 }
684 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
685 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
686 print '</td>';
687}
688// Signed status
689if (!empty($arrayfields['f.signed_status']['checked'])) {
690 print '<td class="liste_titre center">';
691 $list_signed_status = $object->getSignedStatusLocalisedArray();
692 print $form->selectarray('search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status');
693 print '</td>';
694}
695// Fields of detail line
696if (!empty($arrayfields['fd.description']['checked'])) {
697 print '<td class="liste_titre">&nbsp;</td>';
698}
699if (!empty($arrayfields['fd.date']['checked'])) {
700 print '<td class="liste_titre center">';
701 print '<div class="nowrapfordate">';
702 print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
703 print '</div>';
704 print '<div class="nowrapfordate">';
705 print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
706 print '</div>';
707 print '</td>';
708}
709if (!empty($arrayfields['fd.duree']['checked'])) {
710 print '<td class="liste_titre">&nbsp;</td>';
711}
712// Action column
713if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
714 print '<td class="liste_titre center maxwidthsearch">';
715 $searchpicto = $form->showFilterButtons();
716 print $searchpicto;
717 print '</td>';
718}
719print '</tr>'."\n";
720
721$totalarray = array();
722$totalarray['nbfield'] = 0;
723
724// Fields title label
725// --------------------------------------------------------------------
726print '<tr class="liste_titre">';
727// Action column
728if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
729 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
730 $totalarray['nbfield']++;
731}
732if (!empty($arrayfields['f.ref']['checked'])) {
733 // @phan-suppress-next-line PhanTypeInvalidDimOffset
734 print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
735 $totalarray['nbfield']++;
736}
737if (!empty($arrayfields['f.ref_client']['checked'])) {
738 print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder);
739 $totalarray['nbfield']++;
740}
741if (!empty($arrayfields['s.nom']['checked'])) {
742 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
743 $totalarray['nbfield']++;
744}
745if (!empty($arrayfields['pr.ref']['checked'])) {
746 print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $param, '', $sortfield, $sortorder);
747 $totalarray['nbfield']++;
748}
749if (!empty($arrayfields['c.ref']['checked'])) {
750 print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
751 $totalarray['nbfield']++;
752}
753if (!empty($arrayfields['f.description']['checked'])) {
754 print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
755 $totalarray['nbfield']++;
756}
757// Extra fields
758include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
759// Hook fields
760$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
761$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
762print $hookmanager->resPrint;
763if (!empty($arrayfields['f.datec']['checked'])) {
764 print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
765 $totalarray['nbfield']++;
766}
767if (!empty($arrayfields['f.tms']['checked'])) {
768 print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
769 $totalarray['nbfield']++;
770}
771if (!empty($arrayfields['f.note_public']['checked'])) {
772 print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
773 $totalarray['nbfield']++;
774}
775if (!empty($arrayfields['f.note_private']['checked'])) {
776 print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
777 $totalarray['nbfield']++;
778}
779if (!empty($arrayfields['f.fk_statut']['checked'])) {
780 print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
781 $totalarray['nbfield']++;
782}
783if (!empty($arrayfields['f.signed_status']['checked'])) {
784 print_liste_field_titre($arrayfields['f.signed_status']['label'], $_SERVER["PHP_SELF"], "f.signed_status", "", $param, '', $sortfield, $sortorder, 'center ');
785 $totalarray['nbfield']++;
786}
787if (!empty($arrayfields['fd.description']['checked'])) {
788 print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
789 $totalarray['nbfield']++;
790}
791if (!empty($arrayfields['fd.date']['checked'])) {
792 print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center ');
793 $totalarray['nbfield']++;
794}
795if (!empty($arrayfields['fd.duree']['checked'])) {
796 print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right ');
797 $totalarray['nbfield']++;
798}
799
800// Action column
801if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
802 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
803 $totalarray['nbfield']++;
804}
805print "</tr>\n";
806
807
808// Loop on record
809// --------------------------------------------------------------------
810$i = 0;
811$savnbfield = $totalarray['nbfield'];
812$totalarray = array();
813$totalarray['nbfield'] = 0;
814$totalarray['val'] = array();
815$totalarray['val']['fd.duree'] = 0;
816$total = 0;
817$imaxinloop = ($limit ? min($num, $limit) : $num);
818while ($i < $imaxinloop) {
819 $obj = $db->fetch_object($resql);
820 if (empty($obj)) {
821 break; // Should not happen
822 }
823
824 // Store properties in $object
825 //$object->setVarsFromFetchObj($obj);
826
827 $objectstatic->id = $obj->rowid;
828 $objectstatic->ref = $obj->ref;
829 $objectstatic->ref_client = $obj->ref_client;
830 $objectstatic->statut = $obj->status; // deprecated
831 $objectstatic->status = $obj->status;
832 $objectstatic->signed_status = $obj->signed_status;
833
834 $companystatic->name = $obj->name;
835 $companystatic->id = $obj->socid;
836 $companystatic->client = $obj->client;
837 $companystatic->fournisseur = $obj->fournisseur;
838 $companystatic->email = $obj->email;
839 $companystatic->status = $obj->thirdpartystatus;
840
841 //mode kanban
842 if ($mode == 'kanban') {
843 if ($i == 0) {
844 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
845 print '<div class="box-flex-container kanban">';
846 }
847
848 // Output Kanban
849 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
850 $selected = 0;
851 if (in_array($object->id, $arrayofselected)) {
852 $selected = 1;
853 }
854 }
855
856 $objectstatic->duration = $obj->duree;
857 $arraydata = array();
858 $arraydata['thirdparty'] = $companystatic;
859 print $objectstatic->getKanbanView('', $arraydata);
860 if ($i == ($imaxinloop - 1)) {
861 print '</div>';
862 print '</td></tr>';
863 }
864 } else {
865 // Show here line of result
866 $j = 0;
867 print '<tr data-rowid="'.$object->id.'" class="oddeven row-with-select">';
868 // Action column
869 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
870 print '<td class="nowrap center">';
871 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
872 $selected = 0;
873 if (in_array($obj->rowid, $arrayofselected)) {
874 $selected = 1;
875 }
876 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
877 }
878 print '</td>';
879 if (!$i) {
880 $totalarray['nbfield']++;
881 }
882 }
883
884 // Picto + Ref
885 if (!empty($arrayfields['f.ref']['checked'])) {
886 print "<td>";
887
888 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
889 print '<td class="nobordernopadding nowraponall">';
890 print $objectstatic->getNomUrl(1);
891 print '</td>';
892 // Warning
893 $warnornote = '';
894 //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
895 if (!empty($obj->note_private)) {
896 $warnornote .= ($warnornote ? ' ' : '');
897 $warnornote .= '<span class="note">';
898 $warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
899 $warnornote .= '</span>';
900 }
901 if ($warnornote) {
902 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
903 print $warnornote;
904 print '</td>';
905 }
906
907 // Other picto tool
908 print '<td width="16" class="right nobordernopadding hideonsmartphone">';
909 $filename = dol_sanitizeFileName($obj->ref);
910 $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref);
911 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
912 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
913 print '</td></tr></table>';
914
915 print "</td>\n";
916 if (!$i) {
917 $totalarray['nbfield']++;
918 }
919 }
920
921 // Customer ref
922 if (!empty($arrayfields['f.ref_client']['checked'])) {
923 print '<td class="nowrap tdoverflowmax200">';
924 print dol_escape_htmltag($obj->ref_client);
925 print '</td>';
926 if (!$i) {
927 $totalarray['nbfield']++;
928 }
929 }
930 // Third party
931 if (!empty($arrayfields['s.nom']['checked'])) {
932 print '<td class="tdoverflowmax125">';
933 print $companystatic->getNomUrl(1, '', 44);
934 print '</td>';
935 if (!$i) {
936 $totalarray['nbfield']++;
937 }
938 }
939 // Project ref
940 if (!empty($arrayfields['pr.ref']['checked']) && $projetstatic !== null) {
941 print '<td class="tdoverflowmax150">';
942 $projetstatic->id = $obj->projet_id;
943 $projetstatic->ref = $obj->projet_ref;
944 $projetstatic->title = $obj->projet_title;
945 if ($projetstatic->id > 0) {
946 print $projetstatic->getNomUrl(1, '');
947 }
948 print '</td>';
949 if (!$i) {
950 $totalarray['nbfield']++;
951 }
952 }
953 // Contract
954 if (!empty($arrayfields['c.ref']['checked']) && $contratstatic !== null) {
955 print '<td class="tdoverflowmax150">';
956 $contratstatic->id = $obj->contrat_id;
957 $contratstatic->ref = $obj->contrat_ref;
958 $contratstatic->ref_customer = $obj->contrat_ref_customer;
959 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
960 if ($contratstatic->id > 0) {
961 print $contratstatic->getNomUrl(1, 0);
962 print '</td>';
963 }
964 if (!$i) {
965 $totalarray['nbfield']++;
966 }
967 }
968 if (!empty($arrayfields['f.description']['checked'])) {
969 print '<td>'.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).'</td>';
970 if (!$i) {
971 $totalarray['nbfield']++;
972 }
973 }
974
975 // Extra fields
976 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
977 // Fields from hook
978 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
979 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
980 print $hookmanager->resPrint;
981 // Date creation
982 if (!empty($arrayfields['f.datec']['checked'])) {
983 print '<td class="center nowraponall">';
984 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
985 print '</td>';
986 if (!$i) {
987 $totalarray['nbfield']++;
988 }
989 }
990 // Date modification
991 if (!empty($arrayfields['f.tms']['checked'])) {
992 print '<td class="center nowraponall">';
993 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
994 print '</td>';
995 if (!$i) {
996 $totalarray['nbfield']++;
997 }
998 }
999 // Note public
1000 if (!empty($arrayfields['f.note_public']['checked'])) {
1001 print '<td class="sensiblehtmlcontent center">';
1002 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1003 print '</td>';
1004 if (!$i) {
1005 $totalarray['nbfield']++;
1006 }
1007 }
1008 // Note private
1009 if (!empty($arrayfields['f.note_private']['checked'])) {
1010 print '<td class="sensiblehtmlcontent center">';
1011 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1012 print '</td>';
1013 if (!$i) {
1014 $totalarray['nbfield']++;
1015 }
1016 }
1017 // Status
1018 if (!empty($arrayfields['f.fk_statut']['checked'])) {
1019 print '<td class="center">'.$objectstatic->getLibStatut(5).'</td>';
1020 if (!$i) {
1021 $totalarray['nbfield']++;
1022 }
1023 }
1024 // Signed Status
1025 if (!empty($arrayfields['f.signed_status']['checked'])) {
1026 print '<td class="center">'.$objectstatic->getLibSignedStatus(5).'</td>';
1027 if (!$i) {
1028 $totalarray['nbfield']++;
1029 }
1030 }
1031 // Fields of detail of line
1032 if (!empty($arrayfields['fd.description']['checked'])) {
1033 $text = dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1));
1034 print '<td>';
1035 print '<div class="classfortooltip tdoverflowmax250 small" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).'">';
1036 print dol_escape_htmltag($text);
1037 print '</div>';
1038 print '</td>';
1039 if (!$i) {
1040 $totalarray['nbfield']++;
1041 }
1042 }
1043 // Date line
1044 if (!empty($arrayfields['fd.date']['checked'])) {
1045 print '<td class="center nowraponall" title="'.dol_print_date($db->jdate($obj->dp), 'dayhour').'">'.dol_print_date($db->jdate($obj->dp), 'dayhour')."</td>\n";
1046 if (!$i) {
1047 $totalarray['nbfield']++;
1048 }
1049 }
1050 // Duration line
1051 if (!empty($arrayfields['fd.duree']['checked'])) {
1052 print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
1053 if (!$i) {
1054 $totalarray['nbfield']++;
1055 }
1056 if (!$i) {
1057 $totalarray['type'][$totalarray['nbfield']] = 'duration';
1058 }
1059 if (!$i) {
1060 $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
1061 }
1062 $totalarray['val']['fd.duree'] += $obj->duree;
1063 }
1064 // Action column
1065 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1066 print '<td class="nowrap center">';
1067 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1068 $selected = 0;
1069 if (in_array($obj->rowid, $arrayofselected)) {
1070 $selected = 1;
1071 }
1072 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1073 }
1074 print '</td>';
1075 if (!$i) {
1076 $totalarray['nbfield']++;
1077 }
1078 }
1079
1080 print '</tr>'."\n";
1081
1082 $total += (isset($obj->duree) ? $obj->duree : 0);
1083 }
1084 $i++;
1085}
1086
1087
1088// Show total line
1089include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1090
1091// If no record found
1092if ($num == 0) {
1093 $colspan = 1;
1094 foreach ($arrayfields as $key => $val) {
1095 if (!empty($val['checked'])) {
1096 $colspan++;
1097 }
1098 }
1099 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1100}
1101
1102$db->free($resql);
1103
1104$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1105$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1106print $hookmanager->resPrint;
1107
1108print '</table>'."\n";
1109print '</div>'."\n";
1110
1111print '</form>'."\n";
1112
1113if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1114 $hidegeneratedfilelistifempty = 1;
1115 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1116 $hidegeneratedfilelistifempty = 0;
1117 }
1118
1119 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1120 $formfile = new FormFile($db);
1121
1122 // Show list of available documents
1123 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1124 $urlsource .= str_replace('&amp;', '&', $param);
1125
1126 $filedir = $diroutputmassaction;
1127 $genallowed = $permissiontoread;
1128 $delallowed = $permissiontoadd;
1129
1130 print $formfile->showdocuments('massfilesarea_interventions', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1131}
1132
1133// End of page
1134llxFooter();
1135$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.