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