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