33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38if (isModEnabled(
'project')) {
39 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41if (isModEnabled(
'contrat')) {
42 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
46$langs->loadLangs(array(
'companies',
'bills',
'interventions'));
47if (isModEnabled(
'project')) {
48 $langs->load(
"projects");
50if (isModEnabled(
'contrat')) {
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');
79$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
80if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
84$offset = $limit * $page;
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',
113if (empty($user->socid)) {
114 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
117 unset($fieldstosearchall[
'fd.description']);
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'=>!
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
134 'fd.date'=>array(
'label'=>
'DateOfLine',
'checked'=>1,
'enabled'=>!
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
135 'fd.duree'=>array(
'label'=>
'DurationOfLine',
'type'=>
'duration',
'checked'=>1,
'enabled'=>!
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
138include 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;
159if (
GETPOST(
'cancel',
'alpha')) {
163if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
167$parameters = array(
'socid'=>$socid);
168$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
173if (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';
204$form =
new Form($db);
207$companystatic =
new Societe($db);
208if (isModEnabled(
'project')) {
209 $projetstatic =
new Project($db);
211if (isModEnabled(
'contrat')) {
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;
227foreach ($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,";
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";
240if (isModEnabled(
'project')) {
241 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
243if (isModEnabled(
'contrat')) {
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";
247if (!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";
260if (isModEnabled(
'project')) {
261 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
263if (isModEnabled(
'contrat')) {
264 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
266if (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)";
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;
278if (!$user->hasRight(
'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";
287if ($search_ref_client) {
290if ($search_company) {
293if ($search_projet_ref) {
296if ($search_contrat_ref) {
301 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
306if ($search_status !=
'' && $search_status >= 0) {
307 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
309if (!$user->hasRight(
'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);
316 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
328include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
330$parameters = array();
331$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
332$sql .= $hookmanager->resPrint;
334$parameters = array(
'search_all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
335$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
336$sql .= $hookmanager->resPrint;
339$nbtotalofrecords =
'';
342 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
343 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
344 $resql = $db->query($sqlforcount);
346 $objforcount = $db->fetch_object($resql);
347 $nbtotalofrecords = $objforcount->nbtotalofrecords;
352 if (($page * $limit) > $nbtotalofrecords) {
360$sql .= $db->order($sortfield, $sortorder);
362 $sql .= $db->plimit($limit + 1, $offset);
365$resql = $db->query($sql);
371$num = $db->num_rows($resql);
375if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
376 $obj = $db->fetch_object($resql);
378 header(
"Location: ".
dol_buildpath(
'/fichinter/card.php', 1).
'?id='.$id);
386llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
389$arrayofselected = is_array($toselect) ? $toselect : array();
394 if (empty($search_company)) {
395 $search_company = $soc->name;
401 $param .=
'&mode='.urlencode($mode);
403if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
404 $param .=
'&contextpage='.urlencode($contextpage);
406if ($limit > 0 && $limit != $conf->liste_limit) {
407 $param .=
'&limit='.((int) $limit);
410 $param .=
"&search_all=".urlencode($search_all);
413 $param .=
"&socid=".urlencode($socid);
416 $param .=
"&search_ref=".urlencode($search_ref);
418if ($search_ref_client) {
419 $param .=
"&search_ref_client=".urlencode($search_ref_client);
421if ($search_company) {
422 $param .=
"&search_company=".urlencode($search_company);
425 $param .=
"&search_desc=".urlencode($search_desc);
427if ($search_status !=
'' && $search_status > -1) {
428 $param .=
"&search_status=".urlencode($search_status);
431 $param .=
'&show_files='.urlencode($show_files);
433if ($optioncss !=
'') {
434 $param .=
'&optioncss='.urlencode($optioncss);
437include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
439$parameters = array(
'param' => &$param);
440$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
441$param .= $hookmanager->resPrint;
444$arrayofmassactions = array(
445 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
446 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
449if (!empty($permissiontodelete)) {
450 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
452if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
453 $arrayofmassactions = array();
455$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
458print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
459if ($optioncss !=
'') {
460 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
462print
'<input type="hidden" name="token" value="'.newToken().
'">';
463print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
464print
'<input type="hidden" name="action" value="list">';
465print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
466print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
467print
'<input type="hidden" name="page" value="'.$page.
'">';
468print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
469print
'<input type="hidden" name="page_y" value="">';
470print
'<input type="hidden" name="mode" value="'.$mode.
'">';
473$url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
475 $url .=
'&socid='.$socid;
478$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'));
479$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'));
481$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'ficheinter',
'creer'));
483print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
485$topicmail =
"Information";
486$modelmail =
"intervention";
488$trackid =
'int'.$object->id;
489include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
493 foreach ($fieldstosearchall as $key => $val) {
494 $fieldstosearchall[$key] = $langs->trans($val);
495 $setupstring .= $key.
"=".$val.
";";
497 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
498 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
503$parameters = array();
504$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
505if (empty($reshook)) {
506 $moreforfilter .= $hookmanager->resPrint;
508 $moreforfilter = $hookmanager->resPrint;
511if (!empty($moreforfilter)) {
512 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
513 print $moreforfilter;
514 $parameters = array();
515 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
516 print $hookmanager->resPrint;
520$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
521$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
522$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
524print
'<div class="div-table-responsive">';
525print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
529print
'<tr class="liste_titre_filter">';
532 print
'<td class="liste_titre center maxwidthsearch">';
533 $searchpicto = $form->showFilterButtons(
'left');
537if (!empty($arrayfields[
'f.ref'][
'checked'])) {
538 print
'<td class="liste_titre">';
539 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
542if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
543 print
'<td class="liste_titre">';
544 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
547if (!empty($arrayfields[
's.nom'][
'checked'])) {
548 print
'<td class="liste_titre">';
549 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
552if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
553 print
'<td class="liste_titre">';
554 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
557if (!empty($arrayfields[
'c.ref'][
'checked'])) {
558 print
'<td class="liste_titre">';
559 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
562if (!empty($arrayfields[
'f.description'][
'checked'])) {
563 print
'<td class="liste_titre">';
564 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
568include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
571$parameters = array(
'arrayfields'=>$arrayfields);
572$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
573print $hookmanager->resPrint;
574if (!empty($arrayfields[
'f.datec'][
'checked'])) {
576 print
'<td class="liste_titre">';
579if (!empty($arrayfields[
'f.tms'][
'checked'])) {
581 print
'<td class="liste_titre">';
584if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
586 print
'<td class="liste_titre">';
589if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
591 print
'<td class="liste_titre">';
595if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
596 print
'<td class="liste_titre right parentonrightofpage">';
598 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
599 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
600 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
601 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
604 unset($liststatus[2]);
606 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
610if (!empty($arrayfields[
'fd.description'][
'checked'])) {
611 print
'<td class="liste_titre"> </td>';
613if (!empty($arrayfields[
'fd.date'][
'checked'])) {
614 print
'<td class="liste_titre"> </td>';
616if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
617 print
'<td class="liste_titre"> </td>';
621 print
'<td class="liste_titre center maxwidthsearch">';
622 $searchpicto = $form->showFilterButtons();
628$totalarray = array();
629$totalarray[
'nbfield'] = 0;
633print
'<tr class="liste_titre">';
636 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
637 $totalarray[
'nbfield']++;
639if (!empty($arrayfields[
'f.ref'][
'checked'])) {
640 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
641 $totalarray[
'nbfield']++;
643if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
644 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
645 $totalarray[
'nbfield']++;
647if (!empty($arrayfields[
's.nom'][
'checked'])) {
648 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
649 $totalarray[
'nbfield']++;
651if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
652 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
653 $totalarray[
'nbfield']++;
655if (!empty($arrayfields[
'c.ref'][
'checked'])) {
656 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
657 $totalarray[
'nbfield']++;
659if (!empty($arrayfields[
'f.description'][
'checked'])) {
660 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
661 $totalarray[
'nbfield']++;
664include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
666$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
667$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
668print $hookmanager->resPrint;
669if (!empty($arrayfields[
'f.datec'][
'checked'])) {
670 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
671 $totalarray[
'nbfield']++;
673if (!empty($arrayfields[
'f.tms'][
'checked'])) {
674 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
675 $totalarray[
'nbfield']++;
677if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
678 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
679 $totalarray[
'nbfield']++;
681if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
682 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
683 $totalarray[
'nbfield']++;
685if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
686 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
687 $totalarray[
'nbfield']++;
689if (!empty($arrayfields[
'fd.description'][
'checked'])) {
691 $totalarray[
'nbfield']++;
693if (!empty($arrayfields[
'fd.date'][
'checked'])) {
694 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
695 $totalarray[
'nbfield']++;
697if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
698 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
699 $totalarray[
'nbfield']++;
704 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
705 $totalarray[
'nbfield']++;
713$savnbfield = $totalarray[
'nbfield'];
714$totalarray = array();
715$totalarray[
'nbfield'] = 0;
716$totalarray[
'val'] = array();
717$totalarray[
'val'][
'fd.duree'] = 0;
719$imaxinloop = ($limit ? min($num, $limit) : $num);
720while ($i < $imaxinloop) {
721 $obj = $db->fetch_object($resql);
729 $objectstatic->id = $obj->rowid;
730 $objectstatic->ref = $obj->ref;
731 $objectstatic->ref_client = $obj->ref_client;
732 $objectstatic->statut = $obj->status;
733 $objectstatic->status = $obj->status;
735 $companystatic->name = $obj->name;
736 $companystatic->id = $obj->socid;
737 $companystatic->client = $obj->client;
738 $companystatic->fournisseur = $obj->fournisseur;
739 $companystatic->email = $obj->email;
740 $companystatic->status = $obj->thirdpartystatus;
743 if ($mode ==
'kanban') {
745 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
746 print
'<div class="box-flex-container kanban">';
750 if ($massactionbutton || $massaction) {
752 if (in_array($object->id, $arrayofselected)) {
757 $objectstatic->duration = $obj->duree;
758 $arraydata[
'thirdparty'] = $companystatic;
759 print $objectstatic->getKanbanView(
'', $arraydata);
760 if ($i == ($imaxinloop - 1)) {
767 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
770 print
'<td class="nowrap center">';
771 if ($massactionbutton || $massaction) {
773 if (in_array($obj->rowid, $arrayofselected)) {
776 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
780 $totalarray[
'nbfield']++;
783 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
786 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
788 print
'<td class="nobordernopadding nowraponall">';
789 print $objectstatic->getNomUrl(1);
794 if (!empty($obj->note_private)) {
795 $warnornote .= ($warnornote ?
' ' :
'');
796 $warnornote .=
'<span class="note">';
797 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
798 $warnornote .=
'</span>';
801 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
807 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
810 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
811 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
812 print
'</td></tr></table>';
816 $totalarray[
'nbfield']++;
819 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
821 print
'<td class="nowrap tdoverflowmax200">';
825 $totalarray[
'nbfield']++;
828 if (!empty($arrayfields[
's.nom'][
'checked'])) {
830 print $companystatic->getNomUrl(1,
'', 44);
833 $totalarray[
'nbfield']++;
836 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
838 $projetstatic->id = $obj->projet_id;
839 $projetstatic->ref = $obj->projet_ref;
840 $projetstatic->title = $obj->projet_title;
841 if ($projetstatic->id > 0) {
842 print $projetstatic->getNomUrl(1,
'');
846 $totalarray[
'nbfield']++;
849 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
851 $contratstatic->id = $obj->contrat_id;
852 $contratstatic->ref = $obj->contrat_ref;
853 $contratstatic->ref_customer = $obj->contrat_ref_customer;
854 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
855 if ($contratstatic->id > 0) {
856 print $contratstatic->getNomUrl(1,
'');
860 $totalarray[
'nbfield']++;
863 if (!empty($arrayfields[
'f.description'][
'checked'])) {
866 $totalarray[
'nbfield']++;
871 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
873 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
874 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
875 print $hookmanager->resPrint;
877 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
878 print
'<td class="center">';
879 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
882 $totalarray[
'nbfield']++;
886 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
887 print
'<td class="center">';
888 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
891 $totalarray[
'nbfield']++;
895 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
896 print
'<td class="center">';
900 $totalarray[
'nbfield']++;
904 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
905 print
'<td class="center">';
909 $totalarray[
'nbfield']++;
913 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
914 print
'<td class="center">'.$objectstatic->getLibStatut(5).
'</td>';
916 $totalarray[
'nbfield']++;
920 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
923 $totalarray[
'nbfield']++;
926 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
927 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
929 $totalarray[
'nbfield']++;
932 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
933 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
935 $totalarray[
'nbfield']++;
938 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
941 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
943 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
947 print
'<td class="nowrap center">';
948 if ($massactionbutton || $massaction) {
950 if (in_array($obj->rowid, $arrayofselected)) {
953 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
957 $totalarray[
'nbfield']++;
963 $total += $obj->duree;
970include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
975 foreach ($arrayfields as $key => $val) {
976 if (!empty($val[
'checked'])) {
980 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
985$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
986$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
987print $hookmanager->resPrint;
989print
'</table>'.
"\n";
994if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
995 $hidegeneratedfilelistifempty = 1;
996 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
997 $hidegeneratedfilelistifempty = 0;
1000 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1004 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1005 $urlsource .= str_replace(
'&',
'&', $param);
1007 $filedir = $diroutputmassaction;
1008 $genallowed = $permissiontoread;
1009 $delallowed = $permissiontoadd;
1011 print $formfile->showdocuments(
'massfilesarea_interventions',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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...)
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 a 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.
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.