36 require
'../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
49 $langs->loadLangs(array(
'companies',
'bills',
'interventions'));
51 $langs->load(
"projects");
54 $langs->load(
"contracts");
57 $action =
GETPOST(
'action',
'aZ09');
58 $massaction =
GETPOST(
'massaction',
'alpha');
60 $confirm =
GETPOST(
'confirm',
'alpha');
61 $toselect =
GETPOST(
'toselect',
'array');
62 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'interventionlist';
63 $mode =
GETPOST(
'mode',
'alpha');
65 $search_ref =
GETPOST(
'search_ref') ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'search_inter',
'alpha');
66 $search_ref_client =
GETPOST(
'search_ref_client',
'alpha');
67 $search_company =
GETPOST(
'search_company',
'alpha');
68 $search_desc =
GETPOST(
'search_desc',
'alpha');
69 $search_projet_ref =
GETPOST(
'search_projet_ref',
'alpha');
70 $search_contrat_ref =
GETPOST(
'search_contrat_ref',
'alpha');
71 $search_status =
GETPOST(
'search_status',
'alpha');
72 $search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
73 $search_date_startday =
GETPOSTINT(
'search_date_startday');
74 $search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
75 $search_date_startyear =
GETPOSTINT(
'search_date_startyear');
76 $search_date_endday =
GETPOSTINT(
'search_date_endday');
77 $search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
78 $search_date_endyear =
GETPOSTINT(
'search_date_endyear');
79 $search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
80 $search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
81 $optioncss =
GETPOST(
'optioncss',
'alpha');
84 $diroutputmassaction = $conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
88 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
89 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
91 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
95 $offset = $limit * $page;
96 $pageprev = $page - 1;
97 $pagenext = $page + 1;
102 $sortfield =
"f.ref";
107 $hookmanager->initHooks(array($contextpage));
112 $extrafields->fetch_name_optionals_label(
$object->table_element);
114 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
117 $fieldstosearchall = array(
119 's.nom' =>
"ThirdParty",
120 'f.description' =>
'Description',
121 'f.note_public' =>
'NotePublic',
122 'fd.description' =>
'DescriptionOfLine',
124 if (empty($user->socid)) {
125 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
128 unset($fieldstosearchall[
'fd.description']);
132 $arrayfields = array(
133 'f.ref' => array(
'label' =>
'Ref',
'checked' => 1),
134 'f.ref_client' => array(
'label' =>
'RefCustomer',
'checked' => 1),
135 's.nom' => array(
'label' =>
'ThirdParty',
'checked' => 1),
136 'pr.ref' => array(
'label' =>
'Project',
'checked' => 1,
'enabled' => (!
isModEnabled(
'project') ? 0 : 1)),
137 'c.ref' => array(
'label' =>
'Contract',
'checked' => 1,
'enabled' => (empty($conf->contrat->enabled) ? 0 : 1)),
138 'f.description' => array(
'label' =>
'Description',
'checked' => 1),
139 'f.datec' => array(
'label' =>
'DateCreation',
'checked' => 0,
'position' => 500),
140 'f.tms' => array(
'label' =>
'DateModificationShort',
'checked' => 0,
'position' => 500),
141 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
142 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
143 'f.fk_statut' => array(
'label' =>
'Status',
'checked' => 1,
'position' => 1000),
144 'fd.description' => array(
'label' =>
"DescriptionOfLine",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
145 'fd.date' => array(
'label' =>
'DateOfLine',
'checked' => 1,
'enabled' => !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
146 'fd.duree' => array(
'label' =>
'DurationOfLine',
'type' =>
'duration',
'checked' => 1,
'enabled' => !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
148 '@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields';
150 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
154 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
159 $socid = $user->socid;
163 $permissiontoread = $user->hasRight(
'ficheinter',
'lire');
164 $permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
165 $permissiontodelete = $user->hasRight(
'ficheinter',
'supprimer');
172 if (
GETPOST(
'cancel',
'alpha')) {
176 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
180 $parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
181 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
186 if (empty($reshook)) {
188 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
191 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
193 $search_ref_client =
"";
194 $search_company =
"";
195 $search_projet_ref =
"";
196 $search_contrat_ref =
"";
199 $search_date_startday =
'';
200 $search_date_startmonth =
'';
201 $search_date_startyear =
'';
202 $search_date_endday =
'';
203 $search_date_endmonth =
'';
204 $search_date_endyear =
'';
205 $search_date_start =
'';
206 $search_date_end =
'';
208 $search_array_options = array();
212 $objectclass =
'Fichinter';
213 $objectlabel =
'Interventions';
214 $uploaddir = $conf->ficheinter->dir_output;
215 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
225 $form =
new Form($db);
228 $companystatic =
new Societe($db);
230 $projetstatic =
new Project($db);
233 $contratstatic =
new Contrat($db);
238 $title = $langs->trans(
"Interventions");
244 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
245 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
247 $atleastonefieldinlines = 0;
248 foreach ($arrayfields as $tmpkey => $tmpval) {
249 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
250 $atleastonefieldinlines++;
256 $sql .=
" f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_modification, f.note_public, f.note_private,";
258 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
260 $sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
262 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
265 $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";
268 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
269 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
270 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
274 $parameters = array();
275 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
276 $sql .= $hookmanager->resPrint;
280 $sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
282 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
285 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
287 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
288 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
291 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
295 $parameters = array();
296 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object, $action);
297 $sql .= $hookmanager->resPrint;
299 if (!$user->hasRight(
'societe',
'client',
'voir')) {
300 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
302 $sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
303 $sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
304 $sql .=
" AND f.fk_soc = s.rowid";
308 if ($search_ref_client) {
311 if ($search_company) {
314 if ($search_projet_ref) {
317 if ($search_contrat_ref) {
327 if ($search_status !=
'' && $search_status >= 0) {
328 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
331 if ($search_date_start) {
332 $sql .=
" AND fd.date >= '".$db->idate($search_date_start).
"'";
334 if ($search_date_end) {
335 $sql .=
" AND fd.date <= '".$db->idate($search_date_end).
"'";
338 if (!$user->hasRight(
'societe',
'client',
'voir')) {
339 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
342 $sql .=
" AND s.rowid = ".((int) $socid);
357 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
359 $parameters = array();
360 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
361 $sql .= $hookmanager->resPrint;
363 $parameters = array(
'search_all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
364 $reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters,
$object);
365 $sql .= $hookmanager->resPrint;
368 $nbtotalofrecords =
'';
371 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
372 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
373 $resql = $db->query($sqlforcount);
375 $objforcount = $db->fetch_object($resql);
376 $nbtotalofrecords = $objforcount->nbtotalofrecords;
381 if (($page * $limit) > $nbtotalofrecords) {
389 $sql .= $db->order($sortfield, $sortorder);
391 $sql .= $db->plimit($limit + 1, $offset);
394 $resql = $db->query(
$sql);
400 $num = $db->num_rows($resql);
404 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
405 $obj = $db->fetch_object($resql);
407 header(
"Location: ".
dol_buildpath(
'/fichinter/card.php', 1).
'?id='.$id);
415 llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
418 $arrayofselected = is_array($toselect) ? $toselect : array();
423 if (empty($search_company)) {
424 $search_company = $soc->name;
430 $param .=
'&mode='.urlencode($mode);
432 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
433 $param .=
'&contextpage='.urlencode($contextpage);
435 if ($limit > 0 && $limit != $conf->liste_limit) {
436 $param .=
'&limit='.((int) $limit);
439 $param .=
"&search_all=".urlencode($search_all);
442 $param .=
"&socid=".urlencode((
string) ($socid));
445 $param .=
"&search_ref=".urlencode($search_ref);
447 if ($search_ref_client) {
448 $param .=
"&search_ref_client=".urlencode($search_ref_client);
450 if ($search_company) {
451 $param .=
"&search_company=".urlencode($search_company);
454 $param .=
"&search_desc=".urlencode($search_desc);
456 if ($search_status !=
'' && $search_status > -1) {
457 $param .=
"&search_status=".urlencode($search_status);
459 if ($search_date_startday > 0) {
460 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
462 if ($search_date_startmonth > 0) {
463 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
465 if ($search_date_startyear > 0) {
466 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
468 if ($search_date_endday > 0) {
469 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
471 if ($search_date_endmonth > 0) {
472 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
474 if ($search_date_endyear > 0) {
475 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
478 $param .=
'&show_files='.urlencode((
string) ($show_files));
480 if ($optioncss !=
'') {
481 $param .=
'&optioncss='.urlencode($optioncss);
484 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
486 $parameters = array(
'param' => &$param);
487 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
488 $param .= $hookmanager->resPrint;
491 $arrayofmassactions = array(
492 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
493 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
496 if (!empty($permissiontodelete)) {
497 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
499 if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
500 $arrayofmassactions = array();
502 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
505 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
506 if ($optioncss !=
'') {
507 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
509 print
'<input type="hidden" name="token" value="'.newToken().
'">';
510 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
511 print
'<input type="hidden" name="action" value="list">';
512 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
513 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
514 print
'<input type="hidden" name="page" value="'.$page.
'">';
515 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
516 print
'<input type="hidden" name="page_y" value="">';
517 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
520 $url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
521 if (!empty($socid)) {
522 $url .=
'&socid='.$socid;
525 $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'));
526 $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'));
528 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'ficheinter',
'creer'));
530 print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
532 $topicmail =
"Information";
533 $modelmail =
"intervention";
535 $trackid =
'int'.$object->id;
536 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
540 foreach ($fieldstosearchall as $key => $val) {
541 $fieldstosearchall[$key] = $langs->trans($val);
542 $setupstring .= $key.
"=".$val.
";";
544 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
545 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
550 $parameters = array();
551 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
552 if (empty($reshook)) {
553 $moreforfilter .= $hookmanager->resPrint;
555 $moreforfilter = $hookmanager->resPrint;
558 if (!empty($moreforfilter)) {
559 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
560 print $moreforfilter;
561 $parameters = array();
562 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
563 print $hookmanager->resPrint;
567 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
568 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
569 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
570 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
572 print
'<div class="div-table-responsive">';
573 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
577 print
'<tr class="liste_titre_filter">';
580 print
'<td class="liste_titre center maxwidthsearch">';
581 $searchpicto = $form->showFilterButtons(
'left');
585 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
586 print
'<td class="liste_titre">';
587 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
590 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
591 print
'<td class="liste_titre">';
592 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
595 if (!empty($arrayfields[
's.nom'][
'checked'])) {
596 print
'<td class="liste_titre">';
597 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
600 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
601 print
'<td class="liste_titre">';
602 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
605 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
606 print
'<td class="liste_titre">';
607 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
610 if (!empty($arrayfields[
'f.description'][
'checked'])) {
611 print
'<td class="liste_titre">';
612 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
616 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
619 $parameters = array(
'arrayfields' => $arrayfields);
620 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
621 print $hookmanager->resPrint;
622 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
624 print
'<td class="liste_titre">';
627 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
629 print
'<td class="liste_titre">';
632 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
634 print
'<td class="liste_titre">';
637 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
639 print
'<td class="liste_titre">';
643 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
644 print
'<td class="liste_titre right parentonrightofpage">';
646 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
647 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
648 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
649 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
652 unset($liststatus[2]);
655 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
659 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
660 print
'<td class="liste_titre"> </td>';
662 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
663 print
'<td class="liste_titre center">';
664 print
'<div class="nowrapfordate">';
665 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
667 print
'<div class="nowrapfordate">';
668 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
672 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
673 print
'<td class="liste_titre"> </td>';
677 print
'<td class="liste_titre center maxwidthsearch">';
678 $searchpicto = $form->showFilterButtons();
684 $totalarray = array();
685 $totalarray[
'nbfield'] = 0;
689 print
'<tr class="liste_titre">';
692 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
693 $totalarray[
'nbfield']++;
695 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
696 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
697 $totalarray[
'nbfield']++;
699 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
700 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
701 $totalarray[
'nbfield']++;
703 if (!empty($arrayfields[
's.nom'][
'checked'])) {
704 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
705 $totalarray[
'nbfield']++;
707 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
708 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
709 $totalarray[
'nbfield']++;
711 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
712 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
713 $totalarray[
'nbfield']++;
715 if (!empty($arrayfields[
'f.description'][
'checked'])) {
716 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
717 $totalarray[
'nbfield']++;
720 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
722 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
723 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
724 print $hookmanager->resPrint;
725 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
726 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
727 $totalarray[
'nbfield']++;
729 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
730 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
731 $totalarray[
'nbfield']++;
733 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
734 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
735 $totalarray[
'nbfield']++;
737 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
738 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
739 $totalarray[
'nbfield']++;
741 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
742 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
743 $totalarray[
'nbfield']++;
745 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
747 $totalarray[
'nbfield']++;
749 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
750 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
751 $totalarray[
'nbfield']++;
753 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
754 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
755 $totalarray[
'nbfield']++;
760 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
761 $totalarray[
'nbfield']++;
769 $savnbfield = $totalarray[
'nbfield'];
770 $totalarray = array();
771 $totalarray[
'nbfield'] = 0;
772 $totalarray[
'val'] = array();
773 $totalarray[
'val'][
'fd.duree'] = 0;
775 $imaxinloop = ($limit ? min($num, $limit) : $num);
776 while ($i < $imaxinloop) {
777 $obj = $db->fetch_object($resql);
785 $objectstatic->id = $obj->rowid;
786 $objectstatic->ref = $obj->ref;
787 $objectstatic->ref_client = $obj->ref_client;
788 $objectstatic->statut = $obj->status;
789 $objectstatic->status = $obj->status;
791 $companystatic->name = $obj->name;
792 $companystatic->id = $obj->socid;
793 $companystatic->client = $obj->client;
794 $companystatic->fournisseur = $obj->fournisseur;
795 $companystatic->email = $obj->email;
796 $companystatic->status = $obj->thirdpartystatus;
799 if ($mode ==
'kanban') {
801 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
802 print
'<div class="box-flex-container kanban">';
806 if ($massactionbutton || $massaction) {
808 if (in_array(
$object->id, $arrayofselected)) {
813 $objectstatic->duration = $obj->duree;
814 $arraydata = array();
815 $arraydata[
'thirdparty'] = $companystatic;
816 print $objectstatic->getKanbanView(
'', $arraydata);
817 if ($i == ($imaxinloop - 1)) {
824 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
827 print
'<td class="nowrap center">';
828 if ($massactionbutton || $massaction) {
830 if (in_array($obj->rowid, $arrayofselected)) {
833 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
837 $totalarray[
'nbfield']++;
842 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
845 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
846 print
'<td class="nobordernopadding nowraponall">';
847 print $objectstatic->getNomUrl(1);
852 if (!empty($obj->note_private)) {
853 $warnornote .= ($warnornote ?
' ' :
'');
854 $warnornote .=
'<span class="note">';
855 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
856 $warnornote .=
'</span>';
859 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
865 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
868 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
869 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
870 print
'</td></tr></table>';
874 $totalarray[
'nbfield']++;
879 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
880 print
'<td class="nowrap tdoverflowmax200">';
884 $totalarray[
'nbfield']++;
888 if (!empty($arrayfields[
's.nom'][
'checked'])) {
889 print
'<td class="tdoverflowmax125">';
890 print $companystatic->getNomUrl(1,
'', 44);
893 $totalarray[
'nbfield']++;
897 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
898 print
'<td class="tdoverflowmax150">';
899 $projetstatic->id = $obj->projet_id;
900 $projetstatic->ref = $obj->projet_ref;
901 $projetstatic->title = $obj->projet_title;
902 if ($projetstatic->id > 0) {
903 print $projetstatic->getNomUrl(1,
'');
907 $totalarray[
'nbfield']++;
911 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
912 print
'<td class="tdoverflowmax150">';
913 $contratstatic->id = $obj->contrat_id;
914 $contratstatic->ref = $obj->contrat_ref;
915 $contratstatic->ref_customer = $obj->contrat_ref_customer;
916 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
917 if ($contratstatic->id > 0) {
918 print $contratstatic->getNomUrl(1,
'');
922 $totalarray[
'nbfield']++;
925 if (!empty($arrayfields[
'f.description'][
'checked'])) {
928 $totalarray[
'nbfield']++;
933 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
935 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
936 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
937 print $hookmanager->resPrint;
939 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
940 print
'<td class="center nowraponall">';
941 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
944 $totalarray[
'nbfield']++;
948 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
949 print
'<td class="center nowraponall">';
950 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
953 $totalarray[
'nbfield']++;
957 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
958 print
'<td class="sensiblehtmlcontent center">';
960 print
'</td>';
if (!$i) {
961 $totalarray[
'nbfield']++;
965 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
966 print
'<td class="sensiblehtmlcontent center">';
970 $totalarray[
'nbfield']++;
974 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
975 print
'<td class="center">'.$objectstatic->getLibStatut(5).
'</td>';
977 $totalarray[
'nbfield']++;
981 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
984 print
'<div class="classfortooltip tdoverflowmax250" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).
'">';
989 $totalarray[
'nbfield']++;
993 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
994 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
996 $totalarray[
'nbfield']++;
1000 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
1001 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
1003 $totalarray[
'nbfield']++;
1006 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
1009 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
1011 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
1015 print
'<td class="nowrap center">';
1016 if ($massactionbutton || $massaction) {
1018 if (in_array($obj->rowid, $arrayofselected)) {
1021 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1025 $totalarray[
'nbfield']++;
1031 $total += $obj->duree;
1038 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1043 foreach ($arrayfields as $key => $val) {
1044 if (!empty($val[
'checked'])) {
1048 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1053 $parameters = array(
'arrayfields' => $arrayfields,
'sql' =>
$sql);
1054 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
1055 print $hookmanager->resPrint;
1057 print
'</table>'.
"\n";
1058 print
'</div>'.
"\n";
1060 print
'</form>'.
"\n";
1062 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1063 $hidegeneratedfilelistifempty = 1;
1064 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1065 $hidegeneratedfilelistifempty = 0;
1068 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1072 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1073 $urlsource .= str_replace(
'&',
'&', $param);
1075 $filedir = $diroutputmassaction;
1076 $genallowed = $permissiontoread;
1077 $delallowed = $permissiontoadd;
1079 print $formfile->showdocuments(
'massfilesarea_interventions',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if($user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('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') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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.
print_barre_liste($title, $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.
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.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.