33 require
'../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
46 $langs->loadLangs(array(
'companies',
'bills',
'interventions'));
48 $langs->load(
"projects");
51 $langs->load(
"contracts");
54 $action =
GETPOST(
'action',
'aZ09');
55 $massaction =
GETPOST(
'massaction',
'alpha');
56 $show_files =
GETPOST(
'show_files',
'int');
57 $confirm =
GETPOST(
'confirm',
'alpha');
58 $toselect =
GETPOST(
'toselect',
'array');
59 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'interventionlist';
60 $mode =
GETPOST(
'mode',
'alpha');
62 $search_ref =
GETPOST(
'search_ref') ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'search_inter',
'alpha');
63 $search_ref_client =
GETPOST(
'search_ref_client',
'alpha');
64 $search_company =
GETPOST(
'search_company',
'alpha');
65 $search_desc =
GETPOST(
'search_desc',
'alpha');
66 $search_projet_ref =
GETPOST(
'search_projet_ref',
'alpha');
67 $search_contrat_ref =
GETPOST(
'search_contrat_ref',
'alpha');
68 $search_status =
GETPOST(
'search_status',
'alpha');
69 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
70 $optioncss =
GETPOST(
'optioncss',
'alpha');
71 $socid =
GETPOST(
'socid',
'int');
73 $diroutputmassaction = $conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
76 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
77 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
78 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
80 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
84 $offset = $limit * $page;
85 $pageprev = $page - 1;
86 $pagenext = $page + 1;
96 $hookmanager->initHooks(array($contextpage));
101 $extrafields->fetch_name_optionals_label($object->table_element);
103 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
106 $fieldstosearchall = array(
108 's.nom'=>
"ThirdParty",
109 'f.description'=>
'Description',
110 'f.note_public'=>
'NotePublic',
111 'fd.description'=>
'DescriptionOfLine',
113 if (empty($user->socid)) {
114 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
116 if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
117 unset($fieldstosearchall[
'fd.description']);
121 $arrayfields = array(
122 'f.ref'=>array(
'label'=>
'Ref',
'checked'=>1),
123 'f.ref_client'=>array(
'label'=>
'RefCustomer',
'checked'=>1),
124 's.nom'=>array(
'label'=>
'ThirdParty',
'checked'=>1),
125 'pr.ref'=>array(
'label'=>
'Project',
'checked'=>1,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1)),
126 'c.ref'=>array(
'label'=>
'Contract',
'checked'=>1,
'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)),
127 'f.description'=>array(
'label'=>
'Description',
'checked'=>1),
128 'f.datec'=>array(
'label'=>
'DateCreation',
'checked'=>0,
'position'=>500),
129 'f.tms'=>array(
'label'=>
'DateModificationShort',
'checked'=>0,
'position'=>500),
130 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
131 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
132 'f.fk_statut'=>array(
'label'=>
'Status',
'checked'=>1,
'position'=>1000),
133 'fd.description'=>array(
'label'=>
"DescriptionOfLine",
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
134 'fd.date'=>array(
'label'=>
'DateOfLine',
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
135 'fd.duree'=>array(
'label'=>
'DurationOfLine',
'type'=>
'duration',
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
138 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
146 $socid = $user->socid;
150 $permissiontoread = $user->rights->ficheinter->lire;
151 $permissiontoadd = $user->rights->ficheinter->creer;
152 $permissiontodelete = $user->rights->ficheinter->supprimer;
159 if (
GETPOST(
'cancel',
'alpha')) {
163 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
167 $parameters = array(
'socid'=>$socid);
168 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
173 if (empty($reshook)) {
175 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
178 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
180 $search_ref_client =
"";
181 $search_company =
"";
182 $search_projet_ref =
"";
183 $search_contrat_ref =
"";
187 $search_array_options = array();
191 $objectclass =
'Fichinter';
192 $objectlabel =
'Interventions';
193 $uploaddir = $conf->ficheinter->dir_output;
194 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
207 $companystatic =
new Societe($db);
209 $projetstatic =
new Project($db);
212 $contratstatic =
new Contrat($db);
217 $title = $langs->trans(
"Interventions");
223 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
224 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
226 $atleastonefieldinlines = 0;
227 foreach ($arrayfields as $tmpkey => $tmpval) {
228 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
229 $atleastonefieldinlines++;
235 $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,";
236 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
237 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
239 $sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
241 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
244 $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";
247 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
248 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
249 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
253 $parameters = array();
254 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
255 $sql .= $hookmanager->resPrint;
259 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
261 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
264 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
266 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
267 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
269 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
270 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
274 $parameters = array();
275 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
276 $sql .= $hookmanager->resPrint;
278 if (empty($user->rights->societe->client->voir) && empty($socid)) {
279 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
281 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
282 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
283 $sql .=
" AND f.fk_soc = s.rowid";
287 if ($search_ref_client) {
290 if ($search_company) {
293 if ($search_projet_ref) {
296 if ($search_contrat_ref) {
300 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
306 if ($search_status !=
'' && $search_status >= 0) {
307 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
309 if (empty($user->rights->societe->client->voir) && empty($socid)) {
310 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
313 $sql .=
" AND s.rowid = ".((int) $socid);
319 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
321 $parameters = array();
322 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
323 $sql .= $hookmanager->resPrint;
325 $parameters = array(
'search_all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
326 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
327 $sql .= $hookmanager->resPrint;
330 $nbtotalofrecords =
'';
333 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
334 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
335 $resql = $db->query($sqlforcount);
337 $objforcount = $db->fetch_object($resql);
338 $nbtotalofrecords = $objforcount->nbtotalofrecords;
343 if (($page * $limit) > $nbtotalofrecords) {
351 $sql .= $db->order($sortfield, $sortorder);
353 $sql .= $db->plimit($limit + 1, $offset);
356 $resql = $db->query(
$sql);
362 $num = $db->num_rows($resql);
366 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
367 $obj = $db->fetch_object($resql);
369 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$id);
380 $arrayofselected = is_array($toselect) ? $toselect : array();
385 if (empty($search_company)) {
386 $search_company = $soc->name;
392 $param .=
'&mode='.urlencode($mode);
394 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
395 $param .=
'&contextpage='.urlencode($contextpage);
397 if ($limit > 0 && $limit != $conf->liste_limit) {
398 $param .=
'&limit='.((int) $limit);
401 $param .=
"&search_all=".urlencode($search_all);
404 $param .=
"&socid=".urlencode($socid);
407 $param .=
"&search_ref=".urlencode($search_ref);
409 if ($search_ref_client) {
410 $param .=
"&search_ref_client=".urlencode($search_ref_client);
412 if ($search_company) {
413 $param .=
"&search_company=".urlencode($search_company);
416 $param .=
"&search_desc=".urlencode($search_desc);
418 if ($search_status !=
'' && $search_status > -1) {
419 $param .=
"&search_status=".urlencode($search_status);
422 $param .=
'&show_files='.urlencode($show_files);
424 if ($optioncss !=
'') {
425 $param .=
'&optioncss='.urlencode($optioncss);
428 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
430 $parameters = array();
431 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
432 $param .= $hookmanager->resPrint;
435 $arrayofmassactions = array(
436 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
437 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
440 if (!empty($permissiontodelete)) {
441 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
443 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
444 $arrayofmassactions = array();
446 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
449 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
450 if ($optioncss !=
'') {
451 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
453 print
'<input type="hidden" name="token" value="'.newToken().
'">';
454 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
455 print
'<input type="hidden" name="action" value="list">';
456 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
457 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
458 print
'<input type="hidden" name="page" value="'.$page.
'">';
459 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
460 print
'<input type="hidden" name="page_y" value="">';
461 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
464 $url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
465 if (!empty($socid)) {
466 $url .=
'&socid='.$socid;
469 $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'));
470 $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'));
472 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->ficheinter->creer);
474 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
476 $topicmail =
"Information";
477 $modelmail =
"intervention";
479 $trackid =
'int'.$object->id;
480 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
484 foreach ($fieldstosearchall as $key => $val) {
485 $fieldstosearchall[$key] = $langs->trans($val);
486 $setupstring .= $key.
"=".$val.
";";
488 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
489 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
494 $parameters = array();
495 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
496 if (empty($reshook)) {
497 $moreforfilter .= $hookmanager->resPrint;
499 $moreforfilter = $hookmanager->resPrint;
502 if (!empty($moreforfilter)) {
503 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
504 print $moreforfilter;
505 $parameters = array();
506 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
507 print $hookmanager->resPrint;
511 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
512 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
513 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
515 print
'<div class="div-table-responsive">';
516 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
520 print
'<tr class="liste_titre_filter">';
523 print
'<td class="liste_titre center maxwidthsearch">';
524 $searchpicto =
$form->showFilterButtons(
'left');
528 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
529 print
'<td class="liste_titre">';
530 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
533 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
534 print
'<td class="liste_titre">';
535 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
538 if (!empty($arrayfields[
's.nom'][
'checked'])) {
539 print
'<td class="liste_titre">';
540 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
543 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
544 print
'<td class="liste_titre">';
545 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
548 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
549 print
'<td class="liste_titre">';
550 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
553 if (!empty($arrayfields[
'f.description'][
'checked'])) {
554 print
'<td class="liste_titre">';
555 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
559 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
562 $parameters = array(
'arrayfields'=>$arrayfields);
563 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
564 print $hookmanager->resPrint;
565 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
567 print
'<td class="liste_titre">';
570 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
572 print
'<td class="liste_titre">';
575 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
577 print
'<td class="liste_titre">';
580 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
582 print
'<td class="liste_titre">';
586 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
587 print
'<td class="liste_titre right parentonrightofpage">';
589 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
590 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
591 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
592 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
594 if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
595 unset($liststatus[2]);
597 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
601 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
602 print
'<td class="liste_titre"> </td>';
604 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
605 print
'<td class="liste_titre"> </td>';
607 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
608 print
'<td class="liste_titre"> </td>';
612 print
'<td class="liste_titre center maxwidthsearch">';
613 $searchpicto =
$form->showFilterButtons();
619 $totalarray = array();
620 $totalarray[
'nbfield'] = 0;
624 print
'<tr class="liste_titre">';
627 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
628 $totalarray[
'nbfield']++;
630 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
631 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
632 $totalarray[
'nbfield']++;
634 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
635 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
636 $totalarray[
'nbfield']++;
638 if (!empty($arrayfields[
's.nom'][
'checked'])) {
639 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
640 $totalarray[
'nbfield']++;
642 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
643 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
644 $totalarray[
'nbfield']++;
646 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
647 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
648 $totalarray[
'nbfield']++;
650 if (!empty($arrayfields[
'f.description'][
'checked'])) {
651 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
652 $totalarray[
'nbfield']++;
655 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
657 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
658 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
659 print $hookmanager->resPrint;
660 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
661 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
662 $totalarray[
'nbfield']++;
664 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
665 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
666 $totalarray[
'nbfield']++;
668 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
669 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
670 $totalarray[
'nbfield']++;
672 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
673 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
674 $totalarray[
'nbfield']++;
676 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
677 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
678 $totalarray[
'nbfield']++;
680 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
682 $totalarray[
'nbfield']++;
684 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
685 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
686 $totalarray[
'nbfield']++;
688 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
689 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
690 $totalarray[
'nbfield']++;
695 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
696 $totalarray[
'nbfield']++;
704 $savnbfield = $totalarray[
'nbfield'];
705 $totalarray = array();
706 $totalarray[
'nbfield'] = 0;
707 $totalarray[
'val'] = array();
708 $totalarray[
'val'][
'fd.duree'] = 0;
710 $imaxinloop = ($limit ? min($num, $limit) : $num);
711 while ($i < $imaxinloop) {
712 $obj = $db->fetch_object($resql);
720 $objectstatic->id = $obj->rowid;
721 $objectstatic->ref = $obj->ref;
722 $objectstatic->ref_client = $obj->ref_client;
723 $objectstatic->statut = $obj->status;
724 $objectstatic->status = $obj->status;
726 $companystatic->name = $obj->name;
727 $companystatic->id = $obj->socid;
728 $companystatic->client = $obj->client;
729 $companystatic->fournisseur = $obj->fournisseur;
730 $companystatic->email = $obj->email;
731 $companystatic->status = $obj->thirdpartystatus;
734 if ($mode ==
'kanban') {
736 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
737 print
'<div class="box-flex-container kanban">';
741 if ($massactionbutton || $massaction) {
743 if (in_array($object->id, $arrayofselected)) {
748 $objectstatic->duration = $obj->duree;
749 $arraydata[
'thirdparty'] = $companystatic;
750 print $objectstatic->getKanbanView(
'', $arraydata);
751 if ($i == ($imaxinloop - 1)) {
758 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
761 print
'<td class="nowrap center">';
762 if ($massactionbutton || $massaction) {
764 if (in_array($obj->rowid, $arrayofselected)) {
767 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
771 $totalarray[
'nbfield']++;
774 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
777 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
779 print
'<td class="nobordernopadding nowraponall">';
780 print $objectstatic->getNomUrl(1);
785 if (!empty($obj->note_private)) {
786 $warnornote .= ($warnornote ?
' ' :
'');
787 $warnornote .=
'<span class="note">';
788 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
789 $warnornote .=
'</span>';
792 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
798 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
801 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
802 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
803 print
'</td></tr></table>';
807 $totalarray[
'nbfield']++;
810 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
812 print
'<td class="nowrap tdoverflowmax200">';
816 $totalarray[
'nbfield']++;
819 if (!empty($arrayfields[
's.nom'][
'checked'])) {
821 print $companystatic->getNomUrl(1,
'', 44);
824 $totalarray[
'nbfield']++;
827 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
829 $projetstatic->id = $obj->projet_id;
830 $projetstatic->ref = $obj->projet_ref;
831 $projetstatic->title = $obj->projet_title;
832 if ($projetstatic->id > 0) {
833 print $projetstatic->getNomUrl(1,
'');
837 $totalarray[
'nbfield']++;
840 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
842 $contratstatic->id = $obj->contrat_id;
843 $contratstatic->ref = $obj->contrat_ref;
844 $contratstatic->ref_customer = $obj->contrat_ref_customer;
845 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
846 if ($contratstatic->id > 0) {
847 print $contratstatic->getNomUrl(1,
'');
851 $totalarray[
'nbfield']++;
854 if (!empty($arrayfields[
'f.description'][
'checked'])) {
857 $totalarray[
'nbfield']++;
862 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
864 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
865 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
866 print $hookmanager->resPrint;
868 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
869 print
'<td class="center">';
870 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
873 $totalarray[
'nbfield']++;
877 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
878 print
'<td class="center">';
879 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
882 $totalarray[
'nbfield']++;
886 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
887 print
'<td class="center">';
891 $totalarray[
'nbfield']++;
895 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
896 print
'<td class="center">';
900 $totalarray[
'nbfield']++;
904 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
905 print
'<td class="right">'.$objectstatic->getLibStatut(5).
'</td>';
907 $totalarray[
'nbfield']++;
911 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
914 $totalarray[
'nbfield']++;
917 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
918 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
920 $totalarray[
'nbfield']++;
923 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
924 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
926 $totalarray[
'nbfield']++;
929 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
932 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
934 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
938 print
'<td class="nowrap center">';
939 if ($massactionbutton || $massaction) {
941 if (in_array($obj->rowid, $arrayofselected)) {
944 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
948 $totalarray[
'nbfield']++;
954 $total += $obj->duree;
961 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
966 foreach ($arrayfields as $key => $val) {
967 if (!empty($val[
'checked'])) {
971 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
976 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
977 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
978 print $hookmanager->resPrint;
980 print
'</table>'.
"\n";
983 print
'</form>'.
"\n";
985 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
986 $hidegeneratedfilelistifempty = 1;
987 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
988 $hidegeneratedfilelistifempty = 0;
991 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
995 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
996 $urlsource .= str_replace(
'&',
'&', $param);
998 $filedir = $diroutputmassaction;
999 $genallowed = $permissiontoread;
1000 $delallowed = $permissiontoadd;
1002 print $formfile->showdocuments(
'massfilesarea_interventions',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage contracts.
Class to manage interventions.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
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.
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.
print_barre_liste($titre, $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.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.