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