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';
61 $search_ref =
GETPOST(
'search_ref') ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'search_inter',
'alpha');
62 $search_ref_client =
GETPOST(
'search_ref_client',
'alpha');
63 $search_company =
GETPOST(
'search_company',
'alpha');
64 $search_desc =
GETPOST(
'search_desc',
'alpha');
65 $search_projet_ref =
GETPOST(
'search_projet_ref',
'alpha');
66 $search_contrat_ref =
GETPOST(
'search_contrat_ref',
'alpha');
67 $search_status =
GETPOST(
'search_status',
'alpha');
68 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
69 $optioncss =
GETPOST(
'optioncss',
'alpha');
70 $socid =
GETPOST(
'socid',
'int');
72 $diroutputmassaction = $conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
75 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
76 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
77 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
79 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
83 $offset = $limit * $page;
84 $pageprev = $page - 1;
85 $pagenext = $page + 1;
95 $hookmanager->initHooks(array(
'interventionlist'));
100 $extrafields->fetch_name_optionals_label($object->table_element);
102 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
105 $fieldstosearchall = array(
107 's.nom'=>
"ThirdParty",
108 'f.description'=>
'Description',
109 'f.note_public'=>
'NotePublic',
110 'fd.description'=>
'DescriptionOfLine',
112 if (empty($user->socid)) {
113 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
115 if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
116 unset($fieldstosearchall[
'fd.description']);
120 $arrayfields = array(
121 'f.ref'=>array(
'label'=>
'Ref',
'checked'=>1),
122 'f.ref_client'=>array(
'label'=>
'RefCustomer',
'checked'=>1),
123 's.nom'=>array(
'label'=>
'ThirdParty',
'checked'=>1),
124 'pr.ref'=>array(
'label'=>
'Project',
'checked'=>1,
'enabled'=>(!
isModEnabled(
'project') ? 0 : 1)),
125 'c.ref'=>array(
'label'=>
'Contract',
'checked'=>1,
'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)),
126 'f.description'=>array(
'label'=>
'Description',
'checked'=>1),
127 'f.datec'=>array(
'label'=>
'DateCreation',
'checked'=>0,
'position'=>500),
128 'f.tms'=>array(
'label'=>
'DateModificationShort',
'checked'=>0,
'position'=>500),
129 'f.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
130 'f.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
131 'f.fk_statut'=>array(
'label'=>
'Status',
'checked'=>1,
'position'=>1000),
132 'fd.description'=>array(
'label'=>
"DescriptionOfLine",
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
133 'fd.date'=>array(
'label'=>
'DateOfLine',
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
134 'fd.duree'=>array(
'label'=>
'DurationOfLine',
'type'=>
'duration',
'checked'=>1,
'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
137 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
145 $socid = $user->socid;
149 $permissiontoread = $user->rights->ficheinter->lire;
150 $permissiontodelete = $user->rights->ficheinter->supprimer;
157 if (
GETPOST(
'cancel',
'alpha')) {
161 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
165 $parameters = array(
'socid'=>$socid);
166 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
171 if (empty($reshook)) {
173 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
176 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
178 $search_ref_client =
"";
179 $search_company =
"";
180 $search_projet_ref =
"";
181 $search_contrat_ref =
"";
185 $search_array_options = array();
189 $objectclass =
'Fichinter';
190 $objectlabel =
'Interventions';
191 $uploaddir = $conf->ficheinter->dir_output;
192 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
205 $companystatic =
new Societe($db);
207 $projetstatic =
new Project($db);
210 $contratstatic =
new Contrat($db);
216 $title = $langs->trans(
"Interventions");
221 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
222 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
224 $atleastonefieldinlines = 0;
225 foreach ($arrayfields as $tmpkey => $tmpval) {
226 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
227 $atleastonefieldinlines++;
233 $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,";
234 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
235 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
237 $sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
239 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
242 $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";
245 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
246 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
247 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
251 $parameters = array();
252 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
253 $sql .= $hookmanager->resPrint;
257 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
259 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
262 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
264 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
265 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
267 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
268 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
272 $parameters = array();
273 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
274 $sql .= $hookmanager->resPrint;
276 if (empty($user->rights->societe->client->voir) && empty($socid)) {
277 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
279 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
280 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
281 $sql .=
" AND f.fk_soc = s.rowid";
285 if ($search_ref_client) {
288 if ($search_company) {
291 if ($search_projet_ref) {
294 if ($search_contrat_ref) {
298 if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
299 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
304 if ($search_status !=
'' && $search_status >= 0) {
305 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
307 if (empty($user->rights->societe->client->voir) && empty($socid)) {
308 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
311 $sql .=
" AND s.rowid = ".((int) $socid);
317 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
319 $parameters = array();
320 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
321 $sql .= $hookmanager->resPrint;
323 $parameters = array(
'search_all' => $sall,
'fieldstosearchall' => $fieldstosearchall);
324 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
325 $sql .= $hookmanager->resPrint;
329 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
331 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
332 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
333 $resql = $db->query($sqlforcount);
335 $objforcount = $db->fetch_object(
$resql);
349 $sql .= $db->order($sortfield, $sortorder);
351 $sql .= $db->plimit($limit + 1, $offset);
354 $resql = $db->query($sql);
360 $num = $db->num_rows(
$resql);
364 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
365 $obj = $db->fetch_object(
$resql);
367 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$id);
378 $arrayofselected = is_array($toselect) ? $toselect : array();
383 if (empty($search_company)) {
384 $search_company = $soc->name;
390 $param .=
'&mode='.urlencode($mode);
392 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
393 $param .=
'&contextpage='.urlencode($contextpage);
395 if ($limit > 0 && $limit != $conf->liste_limit) {
396 $param .=
'&limit='.urlencode($limit);
399 $param .=
"&sall=".urlencode($sall);
402 $param .=
"&socid=".urlencode($socid);
405 $param .=
"&search_ref=".urlencode($search_ref);
407 if ($search_ref_client) {
408 $param .=
"&search_ref_client=".urlencode($search_ref_client);
410 if ($search_company) {
411 $param .=
"&search_company=".urlencode($search_company);
414 $param .=
"&search_desc=".urlencode($search_desc);
416 if ($search_status !=
'' && $search_status > -1) {
417 $param .=
"&search_status=".urlencode($search_status);
420 $param .=
'&show_files='.urlencode($show_files);
422 if ($optioncss !=
'') {
423 $param .=
'&optioncss='.urlencode($optioncss);
426 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
428 $parameters = array();
429 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
430 $param .= $hookmanager->resPrint;
433 $arrayofmassactions = array(
434 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
435 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
438 if (!empty($permissiontodelete)) {
439 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
441 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
442 $arrayofmassactions = array();
444 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
447 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
448 if ($optioncss !=
'') {
449 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
451 print
'<input type="hidden" name="token" value="'.newToken().
'">';
452 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
453 print
'<input type="hidden" name="action" value="list">';
454 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
455 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
456 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
459 $url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
460 if (!empty($socid)) {
461 $url .=
'&socid='.$socid;
463 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->ficheinter->creer);
465 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
467 $topicmail =
"Information";
468 $modelmail =
"intervention";
470 $trackid =
'int'.$object->id;
471 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
474 foreach ($fieldstosearchall as $key => $val) {
475 $fieldstosearchall[$key] = $langs->trans($val);
477 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
482 $parameters = array();
483 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
484 if (empty($reshook)) {
485 $moreforfilter .= $hookmanager->resPrint;
487 $moreforfilter = $hookmanager->resPrint;
490 if (!empty($moreforfilter)) {
491 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
492 print $moreforfilter;
496 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
497 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
498 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
500 print
'<div class="div-table-responsive">';
501 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
505 print
'<tr class="liste_titre_filter">';
508 print
'<td class="liste_titre maxwidthsearch">';
509 $searchpicto =
$form->showFilterButtons(
'left');
513 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
514 print
'<td class="liste_titre">';
515 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
518 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
519 print
'<td class="liste_titre">';
520 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
523 if (!empty($arrayfields[
's.nom'][
'checked'])) {
524 print
'<td class="liste_titre">';
525 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
528 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
529 print
'<td class="liste_titre">';
530 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
533 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
534 print
'<td class="liste_titre">';
535 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
538 if (!empty($arrayfields[
'f.description'][
'checked'])) {
539 print
'<td class="liste_titre">';
540 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
544 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
547 $parameters = array(
'arrayfields'=>$arrayfields);
548 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
549 print $hookmanager->resPrint;
550 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
552 print
'<td class="liste_titre">';
555 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
557 print
'<td class="liste_titre">';
560 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
562 print
'<td class="liste_titre">';
565 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
567 print
'<td class="liste_titre">';
571 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
572 print
'<td class="liste_titre right">';
573 $tmp = $objectstatic->LibStatut(0);
574 $liststatus = $objectstatic->statuts_short;
575 if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
576 unset($liststatus[2]);
578 print
$form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'onrightofpage');
582 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
583 print
'<td class="liste_titre"> </td>';
585 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
586 print
'<td class="liste_titre"> </td>';
588 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
589 print
'<td class="liste_titre"> </td>';
593 print
'<td class="liste_titre maxwidthsearch">';
594 $searchpicto =
$form->showFilterButtons();
600 $totalarray = array();
601 $totalarray[
'nbfield'] = 0;
605 print
'<tr class="liste_titre">';
608 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
610 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
611 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
613 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
614 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
616 if (!empty($arrayfields[
's.nom'][
'checked'])) {
617 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
619 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
620 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
622 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
623 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
625 if (!empty($arrayfields[
'f.description'][
'checked'])) {
626 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
629 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
631 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
632 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
633 print $hookmanager->resPrint;
634 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
635 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
637 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
638 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
640 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
641 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
643 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
644 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
646 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
647 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
649 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
652 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
653 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
655 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
656 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
661 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
670 $savnbfield = $totalarray[
'nbfield'];
671 $totalarray = array();
672 $totalarray[
'nbfield'] = 0;
673 $totalarray[
'val'] = array();
674 $totalarray[
'val'][
'fd.duree'] = 0;
675 $imaxinloop = ($limit ? min($num, $limit) : $num);
676 while ($i < $imaxinloop) {
677 $obj = $db->fetch_object(
$resql);
685 $objectstatic->id = $obj->rowid;
686 $objectstatic->ref = $obj->ref;
687 $objectstatic->ref_client = $obj->ref_client;
688 $objectstatic->statut = $obj->status;
689 $objectstatic->status = $obj->status;
691 $companystatic->name = $obj->name;
692 $companystatic->id = $obj->socid;
693 $companystatic->client = $obj->client;
694 $companystatic->fournisseur = $obj->fournisseur;
695 $companystatic->email = $obj->email;
696 $companystatic->status = $obj->thirdpartystatus;
698 print
'<tr class="oddeven">';
701 print
'<td class="nowrap center">';
702 if ($massactionbutton || $massaction) {
704 if (in_array($obj->rowid, $arrayofselected)) {
707 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
711 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
714 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
716 print
'<td class="nobordernopadding nowraponall">';
717 print $objectstatic->getNomUrl(1);
722 if (!empty($obj->note_private)) {
723 $warnornote .= ($warnornote ?
' ' :
'');
724 $warnornote .=
'<span class="note">';
725 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
726 $warnornote .=
'</span>';
729 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
735 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
738 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
739 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
740 print
'</td></tr></table>';
744 $totalarray[
'nbfield']++;
747 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
749 print
'<td class="nowrap tdoverflowmax200">';
753 $totalarray[
'nbfield']++;
756 if (!empty($arrayfields[
's.nom'][
'checked'])) {
758 print $companystatic->getNomUrl(1,
'', 44);
761 $totalarray[
'nbfield']++;
764 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
766 $projetstatic->id = $obj->projet_id;
767 $projetstatic->ref = $obj->projet_ref;
768 $projetstatic->title = $obj->projet_title;
769 if ($projetstatic->id > 0) {
770 print $projetstatic->getNomUrl(1,
'');
774 $totalarray[
'nbfield']++;
777 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
779 $contratstatic->id = $obj->contrat_id;
780 $contratstatic->ref = $obj->contrat_ref;
781 $contratstatic->ref_customer = $obj->contrat_ref_customer;
782 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
783 if ($contratstatic->id > 0) {
784 print $contratstatic->getNomUrl(1,
'');
788 $totalarray[
'nbfield']++;
791 if (!empty($arrayfields[
'f.description'][
'checked'])) {
794 $totalarray[
'nbfield']++;
799 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
801 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
802 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
803 print $hookmanager->resPrint;
805 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
806 print
'<td class="center">';
807 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
810 $totalarray[
'nbfield']++;
814 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
815 print
'<td class="center">';
816 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
819 $totalarray[
'nbfield']++;
823 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
824 print
'<td class="center">';
828 $totalarray[
'nbfield']++;
832 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
833 print
'<td class="center">';
837 $totalarray[
'nbfield']++;
841 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
842 print
'<td class="right">'.$objectstatic->getLibStatut(5).
'</td>';
844 $totalarray[
'nbfield']++;
848 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
851 $totalarray[
'nbfield']++;
854 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
855 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
857 $totalarray[
'nbfield']++;
860 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
861 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
863 $totalarray[
'nbfield']++;
866 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
869 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
871 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
875 print
'<td class="nowrap center">';
876 if ($massactionbutton || $massaction) {
878 if (in_array($obj->rowid, $arrayofselected)) {
881 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
886 $totalarray[
'nbfield']++;
891 $total += $obj->duree;
897 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
902 foreach ($arrayfields as $key => $val) {
903 if (!empty($val[
'checked'])) {
907 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
912 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
913 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
914 print $hookmanager->resPrint;
916 print
'</table>'.
"\n";
919 print
'</form>'.
"\n";
922 $hidegeneratedfilelistifempty = 1;
923 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
924 $hidegeneratedfilelistifempty = 0;
927 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
931 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
932 $urlsource .= str_replace(
'&',
'&', $param);
934 $filedir = $diroutputmassaction;
935 $genallowed = $user->rights->ficheinter->lire;
936 $delallowed = $user->rights->ficheinter->creer;
938 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') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
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.