dolibarr 20.0.2
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 print '</div>';
562}
563
564$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
565$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
566$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
567$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
568
569print '<div class="div-table-responsive">';
570print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
571
572// Fields title search
573// --------------------------------------------------------------------
574print '<tr class="liste_titre_filter">';
575// Action column
576if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
577 print '<td class="liste_titre center maxwidthsearch">';
578 $searchpicto = $form->showFilterButtons('left');
579 print $searchpicto;
580 print '</td>';
581}
582if (!empty($arrayfields['f.ref']['checked'])) {
583 print '<td class="liste_titre">';
584 print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
585 print '</td>';
586}
587if (!empty($arrayfields['f.ref_client']['checked'])) {
588 print '<td class="liste_titre">';
589 print '<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.'" size="8">';
590 print '</td>';
591}
592if (!empty($arrayfields['s.nom']['checked'])) {
593 print '<td class="liste_titre">';
594 print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
595 print '</td>';
596}
597if (!empty($arrayfields['pr.ref']['checked'])) {
598 print '<td class="liste_titre">';
599 print '<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.'" size="8">';
600 print '</td>';
601}
602if (!empty($arrayfields['c.ref']['checked'])) {
603 print '<td class="liste_titre">';
604 print '<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.'" size="8">';
605 print '</td>';
606}
607if (!empty($arrayfields['f.description']['checked'])) {
608 print '<td class="liste_titre">';
609 print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
610 print '</td>';
611}
612// Extra fields
613include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
614
615// Fields from hook
616$parameters = array('arrayfields' => $arrayfields);
617$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
618print $hookmanager->resPrint;
619if (!empty($arrayfields['f.datec']['checked'])) {
620 // Date creation
621 print '<td class="liste_titre">';
622 print '</td>';
623}
624if (!empty($arrayfields['f.tms']['checked'])) {
625 // Date modification
626 print '<td class="liste_titre">';
627 print '</td>';
628}
629if (!empty($arrayfields['f.note_public']['checked'])) {
630 // Note public
631 print '<td class="liste_titre">';
632 print '</td>';
633}
634if (!empty($arrayfields['f.note_private']['checked'])) {
635 // Note private
636 print '<td class="liste_titre">';
637 print '</td>';
638}
639// Status
640if (!empty($arrayfields['f.fk_statut']['checked'])) {
641 print '<td class="liste_titre right parentonrightofpage">';
642 $liststatus = [
643 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv('Draft'),
644 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv('Validated'),
645 $object::STATUS_BILLED => $langs->transnoentitiesnoconv('StatusInterInvoiced'),
646 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv('Done'),
647 ];
648 if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) {
649 unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
650 }
651 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
652 print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
653 print '</td>';
654}
655// Fields of detail line
656if (!empty($arrayfields['fd.description']['checked'])) {
657 print '<td class="liste_titre">&nbsp;</td>';
658}
659if (!empty($arrayfields['fd.date']['checked'])) {
660 print '<td class="liste_titre center">';
661 print '<div class="nowrapfordate">';
662 print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
663 print '</div>';
664 print '<div class="nowrapfordate">';
665 print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
666 print '</div>';
667 print '</td>';
668}
669if (!empty($arrayfields['fd.duree']['checked'])) {
670 print '<td class="liste_titre">&nbsp;</td>';
671}
672// Action column
673if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
674 print '<td class="liste_titre center maxwidthsearch">';
675 $searchpicto = $form->showFilterButtons();
676 print $searchpicto;
677 print '</td>';
678}
679print '</tr>'."\n";
680
681$totalarray = array();
682$totalarray['nbfield'] = 0;
683
684// Fields title label
685// --------------------------------------------------------------------
686print '<tr class="liste_titre">';
687// Action column
688if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
689 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
690 $totalarray['nbfield']++;
691}
692if (!empty($arrayfields['f.ref']['checked'])) {
693 print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
694 $totalarray['nbfield']++;
695}
696if (!empty($arrayfields['f.ref_client']['checked'])) {
697 print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder);
698 $totalarray['nbfield']++;
699}
700if (!empty($arrayfields['s.nom']['checked'])) {
701 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
702 $totalarray['nbfield']++;
703}
704if (!empty($arrayfields['pr.ref']['checked'])) {
705 print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $param, '', $sortfield, $sortorder);
706 $totalarray['nbfield']++;
707}
708if (!empty($arrayfields['c.ref']['checked'])) {
709 print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref", "", $param, '', $sortfield, $sortorder);
710 $totalarray['nbfield']++;
711}
712if (!empty($arrayfields['f.description']['checked'])) {
713 print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
714 $totalarray['nbfield']++;
715}
716// Extra fields
717include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
718// Hook fields
719$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
720$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
721print $hookmanager->resPrint;
722if (!empty($arrayfields['f.datec']['checked'])) {
723 print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
724 $totalarray['nbfield']++;
725}
726if (!empty($arrayfields['f.tms']['checked'])) {
727 print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
728 $totalarray['nbfield']++;
729}
730if (!empty($arrayfields['f.note_public']['checked'])) {
731 print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
732 $totalarray['nbfield']++;
733}
734if (!empty($arrayfields['f.note_private']['checked'])) {
735 print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
736 $totalarray['nbfield']++;
737}
738if (!empty($arrayfields['f.fk_statut']['checked'])) {
739 print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
740 $totalarray['nbfield']++;
741}
742if (!empty($arrayfields['fd.description']['checked'])) {
743 print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
744 $totalarray['nbfield']++;
745}
746if (!empty($arrayfields['fd.date']['checked'])) {
747 print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center ');
748 $totalarray['nbfield']++;
749}
750if (!empty($arrayfields['fd.duree']['checked'])) {
751 print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right ');
752 $totalarray['nbfield']++;
753}
754
755// Action column
756if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
757 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
758 $totalarray['nbfield']++;
759}
760print "</tr>\n";
761
762
763// Loop on record
764// --------------------------------------------------------------------
765$i = 0;
766$savnbfield = $totalarray['nbfield'];
767$totalarray = array();
768$totalarray['nbfield'] = 0;
769$totalarray['val'] = array();
770$totalarray['val']['fd.duree'] = 0;
771$total = 0;
772$imaxinloop = ($limit ? min($num, $limit) : $num);
773while ($i < $imaxinloop) {
774 $obj = $db->fetch_object($resql);
775 if (empty($obj)) {
776 break; // Should not happen
777 }
778
779 // Store properties in $object
780 //$object->setVarsFromFetchObj($obj);
781
782 $objectstatic->id = $obj->rowid;
783 $objectstatic->ref = $obj->ref;
784 $objectstatic->ref_client = $obj->ref_client;
785 $objectstatic->statut = $obj->status; // deprecated
786 $objectstatic->status = $obj->status;
787
788 $companystatic->name = $obj->name;
789 $companystatic->id = $obj->socid;
790 $companystatic->client = $obj->client;
791 $companystatic->fournisseur = $obj->fournisseur;
792 $companystatic->email = $obj->email;
793 $companystatic->status = $obj->thirdpartystatus;
794
795 //mode kanban
796 if ($mode == 'kanban') {
797 if ($i == 0) {
798 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
799 print '<div class="box-flex-container kanban">';
800 }
801
802 // Output Kanban
803 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
804 $selected = 0;
805 if (in_array($object->id, $arrayofselected)) {
806 $selected = 1;
807 }
808 }
809
810 $objectstatic->duration = $obj->duree;
811 $arraydata = array();
812 $arraydata['thirdparty'] = $companystatic;
813 print $objectstatic->getKanbanView('', $arraydata);
814 if ($i == ($imaxinloop - 1)) {
815 print '</div>';
816 print '</td></tr>';
817 }
818 } else {
819 // Show here line of result
820 $j = 0;
821 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
822 // Action column
823 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
824 print '<td class="nowrap center">';
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($obj->rowid, $arrayofselected)) {
828 $selected = 1;
829 }
830 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
831 }
832 print '</td>';
833 if (!$i) {
834 $totalarray['nbfield']++;
835 }
836 }
837
838 // Picto + Ref
839 if (!empty($arrayfields['f.ref']['checked'])) {
840 print "<td>";
841
842 print '<table class="nobordernopadding"><tr class="nocellnopadd">';
843 print '<td class="nobordernopadding nowraponall">';
844 print $objectstatic->getNomUrl(1);
845 print '</td>';
846 // Warning
847 $warnornote = '';
848 //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
849 if (!empty($obj->note_private)) {
850 $warnornote .= ($warnornote ? ' ' : '');
851 $warnornote .= '<span class="note">';
852 $warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
853 $warnornote .= '</span>';
854 }
855 if ($warnornote) {
856 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
857 print $warnornote;
858 print '</td>';
859 }
860
861 // Other picto tool
862 print '<td width="16" class="right nobordernopadding hideonsmartphone">';
863 $filename = dol_sanitizeFileName($obj->ref);
864 $filedir = $conf->ficheinter->dir_output.'/'.dol_sanitizeFileName($obj->ref);
865 $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
866 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
867 print '</td></tr></table>';
868
869 print "</td>\n";
870 if (!$i) {
871 $totalarray['nbfield']++;
872 }
873 }
874
875 // Customer ref
876 if (!empty($arrayfields['f.ref_client']['checked'])) {
877 print '<td class="nowrap tdoverflowmax200">';
878 print dol_escape_htmltag($obj->ref_client);
879 print '</td>';
880 if (!$i) {
881 $totalarray['nbfield']++;
882 }
883 }
884 // Third party
885 if (!empty($arrayfields['s.nom']['checked'])) {
886 print '<td class="tdoverflowmax125">';
887 print $companystatic->getNomUrl(1, '', 44);
888 print '</td>';
889 if (!$i) {
890 $totalarray['nbfield']++;
891 }
892 }
893 // Project ref
894 if (!empty($arrayfields['pr.ref']['checked'])) {
895 print '<td class="tdoverflowmax150">';
896 $projetstatic->id = $obj->projet_id;
897 $projetstatic->ref = $obj->projet_ref;
898 $projetstatic->title = $obj->projet_title;
899 if ($projetstatic->id > 0) {
900 print $projetstatic->getNomUrl(1, '');
901 }
902 print '</td>';
903 if (!$i) {
904 $totalarray['nbfield']++;
905 }
906 }
907 // Contract
908 if (!empty($arrayfields['c.ref']['checked'])) {
909 print '<td class="tdoverflowmax150">';
910 $contratstatic->id = $obj->contrat_id;
911 $contratstatic->ref = $obj->contrat_ref;
912 $contratstatic->ref_customer = $obj->contrat_ref_customer;
913 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
914 if ($contratstatic->id > 0) {
915 print $contratstatic->getNomUrl(1, '');
916 print '</td>';
917 }
918 if (!$i) {
919 $totalarray['nbfield']++;
920 }
921 }
922 if (!empty($arrayfields['f.description']['checked'])) {
923 print '<td>'.dol_trunc(dolGetFirstLineOfText(dol_string_nohtmltag($obj->description, 1)), 48).'</td>';
924 if (!$i) {
925 $totalarray['nbfield']++;
926 }
927 }
928
929 // Extra fields
930 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
931 // Fields from hook
932 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
933 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
934 print $hookmanager->resPrint;
935 // Date creation
936 if (!empty($arrayfields['f.datec']['checked'])) {
937 print '<td class="center nowraponall">';
938 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
939 print '</td>';
940 if (!$i) {
941 $totalarray['nbfield']++;
942 }
943 }
944 // Date modification
945 if (!empty($arrayfields['f.tms']['checked'])) {
946 print '<td class="center nowraponall">';
947 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
948 print '</td>';
949 if (!$i) {
950 $totalarray['nbfield']++;
951 }
952 }
953 // Note public
954 if (!empty($arrayfields['f.note_public']['checked'])) {
955 print '<td class="sensiblehtmlcontent center">';
956 print dolPrintHTML($obj->note_public);
957 print '</td>';if (!$i) {
958 $totalarray['nbfield']++;
959 }
960 }
961 // Note private
962 if (!empty($arrayfields['f.note_private']['checked'])) {
963 print '<td class="sensiblehtmlcontent center">';
964 print dolPrintHTML($obj->note_private);
965 print '</td>';
966 if (!$i) {
967 $totalarray['nbfield']++;
968 }
969 }
970 // Status
971 if (!empty($arrayfields['f.fk_statut']['checked'])) {
972 print '<td class="center">'.$objectstatic->getLibStatut(5).'</td>';
973 if (!$i) {
974 $totalarray['nbfield']++;
975 }
976 }
977 // Fields of detail of line
978 if (!empty($arrayfields['fd.description']['checked'])) {
979 $text = dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1));
980 print '<td>';
981 print '<div class="classfortooltip tdoverflowmax250" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).'">';
982 print dol_escape_htmltag($text);
983 print '</div>';
984 print '</td>';
985 if (!$i) {
986 $totalarray['nbfield']++;
987 }
988 }
989 // Date line
990 if (!empty($arrayfields['fd.date']['checked'])) {
991 print '<td class="center">'.dol_print_date($db->jdate($obj->dp), 'dayhour')."</td>\n";
992 if (!$i) {
993 $totalarray['nbfield']++;
994 }
995 }
996 // Duration line
997 if (!empty($arrayfields['fd.duree']['checked'])) {
998 print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
999 if (!$i) {
1000 $totalarray['nbfield']++;
1001 }
1002 if (!$i) {
1003 $totalarray['type'][$totalarray['nbfield']] = 'duration';
1004 }
1005 if (!$i) {
1006 $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
1007 }
1008 $totalarray['val']['fd.duree'] += $obj->duree;
1009 }
1010 // Action column
1011 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1012 print '<td class="nowrap center">';
1013 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1014 $selected = 0;
1015 if (in_array($obj->rowid, $arrayofselected)) {
1016 $selected = 1;
1017 }
1018 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1019 }
1020 print '</td>';
1021 if (!$i) {
1022 $totalarray['nbfield']++;
1023 }
1024 }
1025
1026 print '</tr>'."\n";
1027
1028 $total += (isset($obj->duree) ? $obj->duree : 0);
1029 }
1030 $i++;
1031}
1032
1033
1034// Show total line
1035include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1036
1037// If no record found
1038if ($num == 0) {
1039 $colspan = 1;
1040 foreach ($arrayfields as $key => $val) {
1041 if (!empty($val['checked'])) {
1042 $colspan++;
1043 }
1044 }
1045 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1046}
1047
1048$db->free($resql);
1049
1050$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1051$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1052print $hookmanager->resPrint;
1053
1054print '</table>'."\n";
1055print '</div>'."\n";
1056
1057print '</form>'."\n";
1058
1059if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1060 $hidegeneratedfilelistifempty = 1;
1061 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1062 $hidegeneratedfilelistifempty = 0;
1063 }
1064
1065 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1066 $formfile = new FormFile($db);
1067
1068 // Show list of available documents
1069 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1070 $urlsource .= str_replace('&amp;', '&', $param);
1071
1072 $filedir = $diroutputmassaction;
1073 $genallowed = $permissiontoread;
1074 $delallowed = $permissiontoadd;
1075
1076 print $formfile->showdocuments('massfilesarea_interventions', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1077}
1078
1079// End of page
1080llxFooter();
1081$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.