32 require
'../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37 if (!empty($conf->project->enabled)) {
38 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
40 if (!empty($conf->contrat->enabled)) {
41 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
45 $langs->loadLangs(array(
'companies',
'bills',
'interventions'));
46 if (!empty($conf->project->enabled)) {
47 $langs->load(
"projects");
49 if (!empty($conf->contrat->enabled)) {
50 $langs->load(
"contracts");
53 $action =
GETPOST(
'action',
'aZ09');
54 $massaction =
GETPOST(
'massaction',
'alpha');
55 $show_files =
GETPOST(
'show_files',
'int');
56 $confirm =
GETPOST(
'confirm',
'alpha');
57 $toselect =
GETPOST(
'toselect',
'array');
58 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'interventionlist';
60 $search_ref =
GETPOST(
'search_ref') ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'search_inter',
'alpha');
61 $search_ref_client =
GETPOST(
'search_ref_client',
'alpha');
62 $search_company =
GETPOST(
'search_company',
'alpha');
63 $search_desc =
GETPOST(
'search_desc',
'alpha');
64 $search_projet_ref =
GETPOST(
'search_projet_ref',
'alpha');
65 $search_contrat_ref =
GETPOST(
'search_contrat_ref',
'alpha');
66 $search_status =
GETPOST(
'search_status',
'alpha');
67 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
68 $optioncss =
GETPOST(
'optioncss',
'alpha');
69 $socid =
GETPOST(
'socid',
'int');
71 $diroutputmassaction = $conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
74 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
75 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
76 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
78 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
82 $offset = $limit * $page;
83 $pageprev = $page - 1;
84 $pagenext = $page + 1;
94 $hookmanager->initHooks(array(
'interventionlist'));
99 $extrafields->fetch_name_optionals_label($object->table_element);
101 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
104 $fieldstosearchall = array(
106 's.nom'=>
"ThirdParty",
107 'f.description'=>
'Description',
108 'f.note_public'=>
'NotePublic',
109 'fd.description'=>
'DescriptionOfLine',
111 if (empty($user->socid)) {
112 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
114 if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
115 unset($fieldstosearchall[
'fd.description']);
119 $arrayfields = array(
120 'f.ref'=>array(
'label'=>
'Ref',
'checked'=>1),
121 'f.ref_client'=>array(
'label'=>
'RefCustomer',
'checked'=>1),
122 's.nom'=>array(
'label'=>
'ThirdParty',
'checked'=>1),
123 'pr.ref'=>array(
'label'=>
'Project',
'checked'=>1,
'enabled'=>(empty($conf->project->enabled) ? 0 : 1)),
124 'c.ref'=>array(
'label'=>
'Contract',
'checked'=>1,
'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)),
125 'f.description'=>array(
'label'=>
'Description',
'checked'=>1),
126 'f.datec'=>array(
'label'=>
'DateCreation',
'checked'=>0,
'position'=>500),
127 'f.tms'=>array(
'label'=>
'DateModificationShort',
'checked'=>0,
'position'=>500),
128 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),
129 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES))),
130 'f.fk_statut'=>array(
'label'=>
'Status',
'checked'=>1,
'position'=>1000),
131 'fd.description'=>array(
'label'=>
"DescriptionOfLine",
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
132 'fd.date'=>array(
'label'=>
'DateOfLine',
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
133 'fd.duree'=>array(
'label'=>
'DurationOfLine',
'type'=>
'duration',
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
136 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
144 $socid = $user->socid;
148 $permissiontoread = $user->rights->ficheinter->lire;
149 $permissiontodelete = $user->rights->ficheinter->supprimer;
156 if (
GETPOST(
'cancel',
'alpha')) {
160 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
164 $parameters = array(
'socid'=>$socid);
165 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
170 if (empty($reshook)) {
172 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
175 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
177 $search_ref_client =
"";
178 $search_company =
"";
179 $search_projet_ref =
"";
180 $search_contrat_ref =
"";
184 $search_array_options = array();
188 $objectclass =
'Fichinter';
189 $objectlabel =
'Interventions';
190 $uploaddir = $conf->ficheinter->dir_output;
191 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
204 $companystatic =
new Societe($db);
205 if (!empty($conf->project->enabled)) {
206 $projetstatic =
new Project($db);
208 if (!empty($conf->contrat->enabled)) {
209 $contratstatic =
new Contrat($db);
215 $title = $langs->trans(
"ListOfInterventions");
220 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
221 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
223 $atleastonefieldinlines = 0;
224 foreach ($arrayfields as $tmpkey => $tmpval) {
225 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
226 $atleastonefieldinlines++;
232 $sql .=
" f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,";
233 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
234 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
236 $sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
237 if (!empty($conf->project->enabled)) {
238 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
240 if (!empty($conf->contrat->enabled)) {
241 $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";
244 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
245 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
246 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
250 $parameters = array();
251 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
252 $sql .= $hookmanager->resPrint;
253 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
254 if (!empty($conf->project->enabled)) {
255 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
257 if (!empty($conf->contrat->enabled)) {
258 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
260 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
261 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
263 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
264 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
268 $parameters = array();
269 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
270 $sql .= $hookmanager->resPrint;
272 if (empty($user->rights->societe->client->voir) && empty($socid)) {
273 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
275 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
276 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
277 $sql .=
" AND f.fk_soc = s.rowid";
281 if ($search_ref_client) {
284 if ($search_company) {
287 if ($search_projet_ref) {
290 if ($search_contrat_ref) {
294 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
295 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
300 if ($search_status !=
'' && $search_status >= 0) {
301 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
303 if (empty($user->rights->societe->client->voir) && empty($socid)) {
304 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
307 $sql .=
" AND s.rowid = ".((int) $socid);
313 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
315 $parameters = array();
316 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
317 $sql .= $hookmanager->resPrint;
319 $parameters = array(
'search_all' => $sall,
'fieldstosearchall' => $fieldstosearchall);
320 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
321 $sql .= $hookmanager->resPrint;
324 $nbtotalofrecords =
'';
325 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
327 $resql = $db->query($sql);
328 $nbtotalofrecords = $db->num_rows(
$resql);
339 if (($page * $limit) > $nbtotalofrecords) {
347 $sql .= $db->order($sortfield, $sortorder);
349 $sql .= $db->plimit($limit + 1, $offset);
352 $resql = $db->query($sql);
358 $num = $db->num_rows(
$resql);
362 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
363 $obj = $db->fetch_object(
$resql);
365 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$id);
376 $arrayofselected = is_array($toselect) ? $toselect : array();
381 if (empty($search_company)) {
382 $search_company = $soc->name;
388 $param .=
'&mode='.urlencode($mode);
390 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
391 $param .=
'&contextpage='.urlencode($contextpage);
393 if ($limit > 0 && $limit != $conf->liste_limit) {
394 $param .=
'&limit='.urlencode($limit);
397 $param .=
"&sall=".urlencode($sall);
400 $param .=
"&socid=".urlencode($socid);
403 $param .=
"&search_ref=".urlencode($search_ref);
405 if ($search_ref_client) {
406 $param .=
"&search_ref_client=".urlencode($search_ref_client);
408 if ($search_company) {
409 $param .=
"&search_company=".urlencode($search_company);
412 $param .=
"&search_desc=".urlencode($search_desc);
414 if ($search_status !=
'' && $search_status > -1) {
415 $param .=
"&search_status=".urlencode($search_status);
418 $param .=
'&show_files='.urlencode($show_files);
420 if ($optioncss !=
'') {
421 $param .=
'&optioncss='.urlencode($optioncss);
424 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
426 $parameters = array();
427 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
428 $param .= $hookmanager->resPrint;
431 $arrayofmassactions = array(
432 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
433 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
436 if (!empty($permissiontodelete)) {
437 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
439 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
440 $arrayofmassactions = array();
442 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
445 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
446 if ($optioncss !=
'') {
447 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
449 print
'<input type="hidden" name="token" value="'.newToken().
'">';
450 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
451 print
'<input type="hidden" name="action" value="list">';
452 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
453 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
454 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
457 $url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
458 if (!empty($socid)) {
459 $url .=
'&socid='.$socid;
461 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->ficheinter->creer);
463 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
465 $topicmail =
"Information";
466 $modelmail =
"intervention";
468 $trackid =
'int'.$object->id;
469 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
472 foreach ($fieldstosearchall as $key => $val) {
473 $fieldstosearchall[$key] = $langs->trans($val);
475 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
480 $parameters = array();
481 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
482 if (empty($reshook)) {
483 $moreforfilter .= $hookmanager->resPrint;
485 $moreforfilter = $hookmanager->resPrint;
488 if (!empty($moreforfilter)) {
489 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
490 print $moreforfilter;
494 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
495 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
496 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
498 print
'<div class="div-table-responsive">';
499 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
503 print
'<tr class="liste_titre_filter">';
505 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
506 print
'<td class="liste_titre maxwidthsearch">';
507 $searchpicto =
$form->showFilterButtons(
'left');
511 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
512 print
'<td class="liste_titre">';
513 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
516 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
517 print
'<td class="liste_titre">';
518 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
521 if (!empty($arrayfields[
's.nom'][
'checked'])) {
522 print
'<td class="liste_titre">';
523 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
526 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
527 print
'<td class="liste_titre">';
528 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
531 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
532 print
'<td class="liste_titre">';
533 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
536 if (!empty($arrayfields[
'f.description'][
'checked'])) {
537 print
'<td class="liste_titre">';
538 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
542 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
545 $parameters = array(
'arrayfields'=>$arrayfields);
546 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
547 print $hookmanager->resPrint;
548 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
550 print
'<td class="liste_titre">';
553 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
555 print
'<td class="liste_titre">';
558 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
560 print
'<td class="liste_titre">';
563 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
565 print
'<td class="liste_titre">';
569 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
570 print
'<td class="liste_titre right">';
571 $tmp = $objectstatic->LibStatut(0);
572 $liststatus = $objectstatic->statuts_short;
573 if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
574 unset($liststatus[2]);
576 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1);
580 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
581 print
'<td class="liste_titre"> </td>';
583 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
584 print
'<td class="liste_titre"> </td>';
586 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
587 print
'<td class="liste_titre"> </td>';
590 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
591 print
'<td class="liste_titre maxwidthsearch">';
592 $searchpicto =
$form->showFilterButtons();
598 $totalarray = array();
599 $totalarray[
'nbfield'] = 0;
603 print
'<tr class="liste_titre">';
604 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
605 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
607 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
608 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
610 if (!empty($arrayfields[
's.nom'][
'checked'])) {
611 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
613 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
614 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
616 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
617 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
619 if (!empty($arrayfields[
'f.description'][
'checked'])) {
620 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
623 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
625 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
626 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
627 print $hookmanager->resPrint;
628 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
629 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
631 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
632 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
634 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
635 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
637 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
638 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
640 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
641 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
643 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
646 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
647 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
649 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
650 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
652 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
660 $savnbfield = $totalarray[
'nbfield'];
661 $totalarray = array();
662 $totalarray[
'nbfield'] = 0;
663 $totalarray[
'val'] = array();
664 $totalarray[
'val'][
'fd.duree'] = 0;
665 $imaxinloop = ($limit ? min($num, $limit) : $num);
666 while ($i < $imaxinloop) {
667 $obj = $db->fetch_object(
$resql);
675 $objectstatic->id = $obj->rowid;
676 $objectstatic->ref = $obj->ref;
677 $objectstatic->ref_client = $obj->ref_client;
678 $objectstatic->statut = $obj->status;
679 $objectstatic->status = $obj->status;
681 $companystatic->name = $obj->name;
682 $companystatic->id = $obj->socid;
683 $companystatic->client = $obj->client;
684 $companystatic->fournisseur = $obj->fournisseur;
685 $companystatic->email = $obj->email;
686 $companystatic->status = $obj->thirdpartystatus;
688 print
'<tr class="oddeven">';
690 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
693 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
695 print
'<td class="nobordernopadding nowraponall">';
696 print $objectstatic->getNomUrl(1);
701 if (!empty($obj->note_private)) {
702 $warnornote .= ($warnornote ?
' ' :
'');
703 $warnornote .=
'<span class="note">';
704 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
705 $warnornote .=
'</span>';
708 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
714 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
717 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
718 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
719 print
'</td></tr></table>';
723 $totalarray[
'nbfield']++;
726 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
728 print
'<td class="nowrap tdoverflowmax200">';
732 $totalarray[
'nbfield']++;
735 if (!empty($arrayfields[
's.nom'][
'checked'])) {
737 print $companystatic->getNomUrl(1,
'', 44);
740 $totalarray[
'nbfield']++;
743 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
745 $projetstatic->id = $obj->projet_id;
746 $projetstatic->ref = $obj->projet_ref;
747 $projetstatic->title = $obj->projet_title;
748 if ($projetstatic->id > 0) {
749 print $projetstatic->getNomUrl(1,
'');
753 $totalarray[
'nbfield']++;
756 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
758 $contratstatic->id = $obj->contrat_id;
759 $contratstatic->ref = $obj->contrat_ref;
760 $contratstatic->ref_customer = $obj->contrat_ref_customer;
761 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
762 if ($contratstatic->id > 0) {
763 print $contratstatic->getNomUrl(1,
'');
767 $totalarray[
'nbfield']++;
770 if (!empty($arrayfields[
'f.description'][
'checked'])) {
773 $totalarray[
'nbfield']++;
778 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
780 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
781 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
782 print $hookmanager->resPrint;
784 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
785 print
'<td class="center">';
786 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
789 $totalarray[
'nbfield']++;
793 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
794 print
'<td class="center">';
795 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
798 $totalarray[
'nbfield']++;
802 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
803 print
'<td class="center">';
807 $totalarray[
'nbfield']++;
811 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
812 print
'<td class="center">';
816 $totalarray[
'nbfield']++;
820 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
821 print
'<td class="right">'.$objectstatic->getLibStatut(5).
'</td>';
823 $totalarray[
'nbfield']++;
827 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
830 $totalarray[
'nbfield']++;
833 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
834 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
836 $totalarray[
'nbfield']++;
839 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
840 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
842 $totalarray[
'nbfield']++;
845 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
848 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
850 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
853 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
854 print
'<td class="nowrap center">';
855 if ($massactionbutton || $massaction) {
857 if (in_array($obj->rowid, $arrayofselected)) {
860 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
865 $totalarray[
'nbfield']++;
870 $total += $obj->duree;
876 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
881 foreach ($arrayfields as $key => $val) {
882 if (!empty($val[
'checked'])) {
886 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
891 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
892 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
893 print $hookmanager->resPrint;
895 print
'</table>'.
"\n";
898 print
'</form>'.
"\n";
900 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
901 $hidegeneratedfilelistifempty = 1;
902 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
903 $hidegeneratedfilelistifempty = 0;
906 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
910 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
911 $urlsource .= str_replace(
'&',
'&', $param);
913 $filedir = $diroutputmassaction;
914 $genallowed = $user->rights->ficheinter->lire;
915 $delallowed = $user->rights->ficheinter->creer;
917 print $formfile->showdocuments(
'massfilesarea_interventions',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);