dolibarr  9.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  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
30 require '../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array('companies', 'bills', 'interventions'));
38 
39 $action=GETPOST('action','alpha');
40 $massaction=GETPOST('massaction','alpha');
41 $show_files=GETPOST('show_files','int');
42 $confirm=GETPOST('confirm','alpha');
43 $toselect = GETPOST('toselect', 'array');
44 $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'interventionlist';
45 
46 $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
47 $search_company=GETPOST('search_company','alpha');
48 $search_desc=GETPOST('search_desc','alpha');
49 $search_status=GETPOST('search_status');
50 $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
51 $optioncss = GETPOST('optioncss','alpha');
52 $socid=GETPOST('socid','int');
53 
54 // Security check
55 $id = GETPOST('id','int');
56 if ($user->societe_id) $socid=$user->societe_id;
57 $result = restrictedArea($user, 'ficheinter', $id,'fichinter');
58 
59 $diroutputmassaction=$conf->ficheinter->dir_output . '/temp/massgeneration/'.$user->id;
60 
61 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
62 $sortfield = GETPOST('sortfield','alpha');
63 $sortorder = GETPOST('sortorder','alpha');
64 $page = GETPOST('page','int');
65 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
66 $offset = $limit * $page;
67 $pageprev = $page - 1;
68 $pagenext = $page + 1;
69 if (! $sortorder) $sortorder="DESC";
70 if (! $sortfield)
71 {
72  //if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date";
73  //else
74  $sortfield="f.ref";
75 }
76 
77 $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
78 $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
79 $search_company=GETPOST('search_company','alpha');
80 $search_desc=GETPOST('search_desc','alpha');
81 $search_status=GETPOST('search_status');
82 $optioncss = GETPOST('optioncss','alpha');
83 
84 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
85 $object = new Fichinter($db);
86 $hookmanager->initHooks(array('interventionlist'));
87 $extrafields = new ExtraFields($db);
88 
89 // fetch optionals attributes and labels
90 $extralabels = $extrafields->fetch_name_optionals_label('fichinter');
91 $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_');
92 
93 // List of fields to search into when doing a "search in all"
94 $fieldstosearchall = array(
95  'f.ref'=>'Ref',
96  's.nom'=>"ThirdParty",
97  'f.description'=>'Description',
98  'f.note_public'=>'NotePublic',
99 );
100 if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
101 if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']);
102 
103 // Definition of fields for list
104 $arrayfields=array(
105  'f.ref'=>array('label'=>'Ref', 'checked'=>1),
106  's.nom'=>array('label'=>'ThirdParty', 'checked'=>1),
107  'f.fk_project'=>array('label'=>'Project', 'checked'=>1),
108  'f.fk_contrat'=>array('label'=>'Contract', 'checked'=>1),
109  'f.description'=>array('label'=>'Description', 'checked'=>1),
110  'f.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>500),
111  'f.tms'=>array('label'=>'DateModificationShort', 'checked'=>0, 'position'=>500),
112  'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000),
113  'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
114  'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
115  'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
116 );
117 // Extra fields
118 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
119 {
120  foreach($extrafields->attribute_label as $key => $val)
121  {
122  if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
123  }
124 }
125 
126 
127 /*
128  * Actions
129  */
130 
131 if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
132 if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
133 
134 $parameters=array('socid'=>$socid);
135 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
136 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
137 
138 if (empty($reshook))
139 {
140  // Selection of new fields
141  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
142 
143  // Purge search criteria
144  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
145  {
146  $search_ref="";
147  $search_company="";
148  $search_project="";
149  $search_contract="";
150  $search_desc="";
151  $search_status="";
152  $toselect='';
153  $search_array_options=array();
154  }
155 
156  // Mass actions
157  $objectclass='Fichinter';
158  $objectlabel='Interventions';
159  $permtoread = $user->rights->ficheinter->lire;
160  $permtodelete = $user->rights->ficheinter->supprimer;
161  $uploaddir = $conf->ficheinter->dir_output;
162  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
163 }
164 
165 
166 
167 /*
168  * View
169  */
170 
171 $now=dol_now();
172 
173 $form = new Form($db);
174 $formfile = new FormFile($db);
175 $objectstatic=new Fichinter($db);
176 $companystatic=new Societe($db);
177 
178 $title=$langs->trans("ListOfInterventions");
179 llxHeader('', $title);
180 
181 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
182 $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
183 
184 $atleastonefieldinlines=0;
185 foreach($arrayfields as $tmpkey => $tmpval)
186 {
187  if (preg_match('/^fd\./', $tmpkey) && ! empty($arrayfields[$tmpkey]['checked']))
188  {
189  $atleastonefieldinlines++;
190  break;
191  }
192 }
193 
194 $sql = "SELECT";
195 $sql.= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,";
196 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
197 $sql.= " s.nom as name, s.rowid as socid, s.client";
198 // Add fields from extrafields
199 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
200 // Add fields from hooks
201 $parameters=array();
202 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
203 $sql.=$hookmanager->resPrint;
204 $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
205 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)";
206 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
207 if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
208 $sql.= ", ".MAIN_DB_PREFIX."societe as s";
209 $sql.= " WHERE f.entity IN (".getEntity('intervention').")";
210 $sql.= " AND f.fk_soc = s.rowid";
211 if ($search_ref) {
212  $sql .= natural_search('f.ref', $search_ref);
213 }
214 if ($search_company) {
215  $sql .= natural_search('s.nom', $search_company);
216 }
217 if ($search_desc) {
218  if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
219  else $sql .= natural_search(array('f.description'), $search_desc);
220 }
221 if ($search_status != '' && $search_status >= 0) {
222  $sql .= ' AND f.fk_statut = '.$search_status;
223 }
224 if (! $user->rights->societe->client->voir && empty($socid))
225  $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
226 if ($socid)
227  $sql.= " AND s.rowid = " . $socid;
228 if ($sall) {
229  $sql .= natural_search(array_keys($fieldstosearchall), $sall);
230 }
231 // Add where from extra fields
232 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
233 // Add where from hooks
234 $parameters=array();
235 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
236 $sql.=$hookmanager->resPrint;
237 $sql.= $db->order($sortfield,$sortorder);
238 
239 // Count total nb of records
240 $nbtotalofrecords = '';
241 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
242 {
243  $result = $db->query($sql);
244  $nbtotalofrecords = $db->num_rows($result);
245  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
246  {
247  $page = 0;
248  $offset = 0;
249  }
250 }
251 
252 $sql.= $db->plimit($limit+1, $offset);
253 //print $sql;
254 
255 $resql=$db->query($sql);
256 if ($resql)
257 {
258  $num = $db->num_rows($resql);
259 
260  $arrayofselected=is_array($toselect)?$toselect:array();
261 
262  if ($socid > 0)
263  {
264  $soc = new Societe($db);
265  $soc->fetch($socid);
266  if (empty($search_company)) $search_company = $soc->name;
267  }
268 
269  $param='';
270  if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
271  if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
272  if ($sall) $param.="&sall=".urlencode($sall);
273  if ($socid) $param.="&socid=".urlencode($socid);
274  if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
275  if ($search_company) $param.="&search_company=".urlencode($search_company);
276  if ($search_desc) $param.="&search_desc=".urlencode($search_desc);
277  if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status);
278  if ($show_files) $param.='&show_files='.urlencode($show_files);
279  if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
280  // Add $param from extra fields
281  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
282 
283  // List of mass actions available
284  $arrayofmassactions = array(
285  //'presend'=>$langs->trans("SendByMail"),
286  'builddoc'=>$langs->trans("PDFMerge"),
287  );
288  if ($user->rights->ficheinter->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
289  if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
290  $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
291 
292  $newcardbutton='';
293  if ($user->rights->ficheinter->creer)
294  {
295  $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create"><span class="valignmiddle">'.$langs->trans('NewIntervention').'</span>';
296  $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
297  $newcardbutton.= '</a>';
298  }
299 
300  // Lines of title fields
301  print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
302  if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
303  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
304  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
305  print '<input type="hidden" name="action" value="list">';
306  print '<input type="hidden" name="page" value="'.$page.'">';
307  print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
308  print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
309  print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
310 
311  print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
312 
313  $topicmail="Information";
314  $modelmail="intervention";
315  $objecttmp=new Fichinter($db);
316  $trackid='int'.$object->id;
317  include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
318 
319  if ($sall)
320  {
321  foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
322  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
323  }
324 
325  $moreforfilter='';
326 
327  $parameters=array();
328  $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
329  if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
330  else $moreforfilter = $hookmanager->resPrint;
331 
332  if (! empty($moreforfilter))
333  {
334  print '<div class="liste_titre liste_titre_bydiv centpercent">';
335  print $moreforfilter;
336  print '</div>';
337  }
338 
339  if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
340 
341  print '<div class="div-table-responsive">';
342  print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
343 
344  print '<tr class="liste_titre_filter">';
345  if (! empty($arrayfields['f.ref']['checked']))
346  {
347  print '<td class="liste_titre">';
348  print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
349  print '</td>';
350  }
351  if (! empty($arrayfields['s.nom']['checked']))
352  {
353  print '<td class="liste_titre">';
354  print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
355  print '</td>';
356  }
357  if (! empty($arrayfields['f.description']['checked']))
358  {
359  print '<td class="liste_titre">';
360  print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
361  print '</td>';
362  }
363  // Extra fields
364  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
365 
366  // Fields from hook
367  $parameters=array('arrayfields'=>$arrayfields);
368  $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
369  print $hookmanager->resPrint;
370  if (! empty($arrayfields['f.datec']['checked']))
371  {
372  // Date creation
373  print '<td class="liste_titre">';
374  print '</td>';
375  }
376  if (! empty($arrayfields['f.tms']['checked']))
377  {
378  // Date modification
379  print '<td class="liste_titre">';
380  print '</td>';
381  }
382  // Status
383  if (! empty($arrayfields['f.fk_statut']['checked']))
384  {
385  print '<td class="liste_titre" align="right">';
386  $tmp = $objectstatic->LibStatut(0); // To load $this->statuts_short
387  $liststatus=$objectstatic->statuts_short;
388  if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
389  print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1);
390  print '</td>';
391  }
392  // Fields of detail line
393  if (! empty($arrayfields['fd.description']['checked']))
394  {
395  print '<td class="liste_titre">&nbsp;</td>';
396  }
397  if (! empty($arrayfields['fd.date']['checked']))
398  {
399  print '<td class="liste_titre">&nbsp;</td>';
400  }
401  if (! empty($arrayfields['fd.duree']['checked']))
402  {
403  print '<td class="liste_titre">&nbsp;</td>';
404  }
405  print '<td class="liste_titre" align="right">';
406  $searchpicto=$form->showFilterButtons();
407  print $searchpicto;
408  print '</td>';
409 
410  print "</tr>\n";
411 
412  print '<tr class="liste_titre">';
413  if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
414  if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
415  if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder);
416  // Extra fields
417  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
418  // Hook fields
419  $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
420  $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
421  print $hookmanager->resPrint;
422  if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
423  if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
424  if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
425  if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"],'');
426  if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder);
427  if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder);
428  print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
429  print "</tr>\n";
430 
431  $total = 0;
432  $i = 0;
433  $totalarray=array();
434  while ($i < min($num, $limit))
435  {
436  $obj = $db->fetch_object($resql);
437 
438  $objectstatic->id=$obj->rowid;
439  $objectstatic->ref=$obj->ref;
440  $objectstatic->statut=$obj->fk_statut;
441 
442  print '<tr class="oddeven">';
443 
444  if (! empty($arrayfields['f.ref']['checked']))
445  {
446  print "<td>";
447 
448  print '<table class="nobordernopadding"><tr class="nocellnopadd">';
449  // Picto + Ref
450  print '<td class="nobordernopadding nowrap">';
451  print $objectstatic->getNomUrl(1);
452  print '</td>';
453  // Warning
454  $warnornote='';
455  //if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
456  if (! empty($obj->note_private))
457  {
458  $warnornote.=($warnornote?' ':'');
459  $warnornote.= '<span class="note">';
460  $warnornote.= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
461  $warnornote.= '</span>';
462  }
463  if ($warnornote)
464  {
465  print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
466  print $warnornote;
467  print '</td>';
468  }
469 
470  // Other picto tool
471  print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
472  $filename=dol_sanitizeFileName($obj->ref);
473  $filedir=$conf->ficheinter->dir_output . '/' . dol_sanitizeFileName($obj->ref);
474  $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
475  print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
476  print '</td></tr></table>';
477 
478  print "</td>\n";
479  if (! $i) $totalarray['nbfield']++;
480  }
481  if (! empty($arrayfields['s.nom']['checked']))
482  {
483  print '<td>';
484  $companystatic->name=$obj->name;
485  $companystatic->id=$obj->socid;
486  $companystatic->client=$obj->client;
487  print $companystatic->getNomUrl(1,'',44);
488  print '</td>';
489  if (! $i) $totalarray['nbfield']++;
490  }
491  if (! empty($arrayfields['f.description']['checked']))
492  {
493  print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description),48).'</td>';
494  if (! $i) $totalarray['nbfield']++;
495  }
496 
497  // Extra fields
498  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
499  // Fields from hook
500  $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
501  $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
502  print $hookmanager->resPrint;
503  // Date creation
504  if (! empty($arrayfields['f.datec']['checked']))
505  {
506  print '<td align="center">';
507  print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
508  print '</td>';
509  if (! $i) $totalarray['nbfield']++;
510  }
511  // Date modification
512  if (! empty($arrayfields['f.tms']['checked']))
513  {
514  print '<td align="center">';
515  print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
516  print '</td>';
517  if (! $i) $totalarray['nbfield']++;
518  }
519  // Status
520  if (! empty($arrayfields['f.fk_statut']['checked']))
521  {
522  print '<td align="right">'.$objectstatic->LibStatut($obj->fk_statut,5).'</td>';
523  if (! $i) $totalarray['nbfield']++;
524  }
525  // Fields of detail of line
526  if (! empty($arrayfields['fd.description']['checked']))
527  {
528  print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
529  if (! $i) $totalarray['nbfield']++;
530  }
531  if (! empty($arrayfields['fd.date']['checked']))
532  {
533  print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'dayhour')."</td>\n";
534  if (! $i) $totalarray['nbfield']++;
535  }
536  if (! empty($arrayfields['fd.duree']['checked']))
537  {
538  print '<td align="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
539  if (! $i) $totalarray['nbfield']++;
540  if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
541  $totalarray['totalduration']+=$obj->duree;
542  }
543  // Action column
544  print '<td class="nowrap" align="center">';
545  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
546  {
547  $selected=0;
548  if (in_array($obj->rowid, $arrayofselected)) $selected=1;
549  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
550  }
551  print '</td>';
552  if (! $i) $totalarray['nbfield']++;
553 
554  print "</tr>\n";
555 
556  $total += $obj->duree;
557  $i++;
558  }
559 
560  // Show total line
561  if (isset($totalarray['totalduration']))
562  {
563  print '<tr class="liste_total">';
564  $i=0;
565  while ($i < $totalarray['nbfield'])
566  {
567  $i++;
568  if ($i == 1)
569  {
570  if ($num < $limit && empty($offset)) print '<td align="left">'.$langs->trans("Total").'</td>';
571  else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
572  }
573  elseif ($totalarray['totaldurationfield'] == $i) print '<td align="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';
574  else print '<td></td>';
575  }
576  print '</tr>';
577  }
578 
579  $db->free($resql);
580 
581  $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
582  $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
583  print $hookmanager->resPrint;
584 
585  print '</table>'."\n";
586  print '</div>';
587 
588  print "</form>\n";
589 
590  $hidegeneratedfilelistifempty=1;
591  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
592 
593  // Show list of available documents
594  $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
595  $urlsource.=str_replace('&amp;','&',$param);
596 
597  $filedir=$diroutputmassaction;
598  $genallowed=$user->rights->ficheinter->lire;
599  $delallowed=$user->rights->ficheinter->creer;
600 
601  print $formfile->showdocuments('massfilesarea_interventions','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
602 }
603 else
604 {
605  dol_print_error($db);
606 }
607 
608 
609 llxFooter();
610 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Class to manage interventions.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
Class to manage third parties objects (customers, suppliers, prospects...)
llxHeader()
Empty header.
Definition: wrapper.php:44
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...
dolGetFirstLineOfText($text, $nboflines=1)
Return first line of text.
dol_now($mode='gmt')
Return date for now.
Class to offer components to list and upload files.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it&#39;s its name (generic function)