36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41if (isModEnabled(
'project')) {
42 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
44if (isModEnabled(
'contract')) {
45 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
49$langs->loadLangs(array(
'companies',
'bills',
'interventions'));
50if (isModEnabled(
'project')) {
51 $langs->load(
"projects");
53if (isModEnabled(
'contract')) {
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');
91if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
95$offset = $limit * $page;
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',
124if (empty($user->socid)) {
125 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
128 unset($fieldstosearchall[
'fd.description']);
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';
150include 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');
172if (
GETPOST(
'cancel',
'alpha')) {
176if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
180$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
181$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
186if (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);
229if (isModEnabled(
'project')) {
230 $projetstatic =
new Project($db);
232if (isModEnabled(
'contract')) {
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;
248foreach ($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";
261if (isModEnabled(
'project')) {
262 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
264if (isModEnabled(
'contract')) {
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";
268if (!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";
281if (isModEnabled(
'project')) {
282 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
284if (isModEnabled(
'contract')) {
285 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
287if (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;
299if (!$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";
308if ($search_ref_client) {
311if ($search_company) {
314if ($search_projet_ref) {
317if ($search_contrat_ref) {
322 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
327if ($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).
"'";
338if (!$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);
345 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
357include 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);
404if ($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);
415llxHeader(
'', $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);
432if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
433 $param .=
'&contextpage='.urlencode($contextpage);
435if ($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);
447if ($search_ref_client) {
448 $param .=
"&search_ref_client=".urlencode($search_ref_client);
450if ($search_company) {
451 $param .=
"&search_company=".urlencode($search_company);
454 $param .=
"&search_desc=".urlencode($search_desc);
456if ($search_status !=
'' && $search_status > -1) {
457 $param .=
"&search_status=".urlencode($search_status);
459if ($search_date_startday > 0) {
460 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
462if ($search_date_startmonth > 0) {
463 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
465if ($search_date_startyear > 0) {
466 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
468if ($search_date_endday > 0) {
469 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
471if ($search_date_endmonth > 0) {
472 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
474if ($search_date_endyear > 0) {
475 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
478 $param .=
'&show_files='.urlencode((
string) ($show_files));
480if ($optioncss !=
'') {
481 $param .=
'&optioncss='.urlencode($optioncss);
484include 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"),
496if (!empty($permissiontodelete)) {
497 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
499if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
500 $arrayofmassactions = array();
502$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
505print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
506if ($optioncss !=
'') {
507 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
509print
'<input type="hidden" name="token" value="'.newToken().
'">';
510print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
511print
'<input type="hidden" name="action" value="list">';
512print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
513print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
514print
'<input type="hidden" name="page" value="'.$page.
'">';
515print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
516print
'<input type="hidden" name="page_y" value="">';
517print
'<input type="hidden" name="mode" value="'.$mode.
'">';
520$url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
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'));
530print_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;
536include 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);
552if (empty($reshook)) {
553 $moreforfilter .= $hookmanager->resPrint;
555 $moreforfilter = $hookmanager->resPrint;
558if (!empty($moreforfilter)) {
559 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
560 print $moreforfilter;
564$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
565$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
566$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
567$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
569print
'<div class="div-table-responsive">';
570print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
574print
'<tr class="liste_titre_filter">';
577 print
'<td class="liste_titre center maxwidthsearch">';
578 $searchpicto = $form->showFilterButtons(
'left');
582if (!empty($arrayfields[
'f.ref'][
'checked'])) {
583 print
'<td class="liste_titre">';
584 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
587if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
588 print
'<td class="liste_titre">';
589 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
592if (!empty($arrayfields[
's.nom'][
'checked'])) {
593 print
'<td class="liste_titre">';
594 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
597if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
598 print
'<td class="liste_titre">';
599 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
602if (!empty($arrayfields[
'c.ref'][
'checked'])) {
603 print
'<td class="liste_titre">';
604 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
607if (!empty($arrayfields[
'f.description'][
'checked'])) {
608 print
'<td class="liste_titre">';
609 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
613include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
616$parameters = array(
'arrayfields' => $arrayfields);
617$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
618print $hookmanager->resPrint;
619if (!empty($arrayfields[
'f.datec'][
'checked'])) {
621 print
'<td class="liste_titre">';
624if (!empty($arrayfields[
'f.tms'][
'checked'])) {
626 print
'<td class="liste_titre">';
629if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
631 print
'<td class="liste_titre">';
634if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
636 print
'<td class="liste_titre">';
640if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
641 print
'<td class="liste_titre right parentonrightofpage">';
643 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
644 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
645 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
646 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
649 unset($liststatus[2]);
652 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
656if (!empty($arrayfields[
'fd.description'][
'checked'])) {
657 print
'<td class="liste_titre"> </td>';
659if (!empty($arrayfields[
'fd.date'][
'checked'])) {
660 print
'<td class="liste_titre center">';
661 print
'<div class="nowrapfordate">';
662 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
664 print
'<div class="nowrapfordate">';
665 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
669if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
670 print
'<td class="liste_titre"> </td>';
674 print
'<td class="liste_titre center maxwidthsearch">';
675 $searchpicto = $form->showFilterButtons();
681$totalarray = array();
682$totalarray[
'nbfield'] = 0;
686print
'<tr class="liste_titre">';
689 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
690 $totalarray[
'nbfield']++;
692if (!empty($arrayfields[
'f.ref'][
'checked'])) {
693 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
694 $totalarray[
'nbfield']++;
696if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
697 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
698 $totalarray[
'nbfield']++;
700if (!empty($arrayfields[
's.nom'][
'checked'])) {
701 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
702 $totalarray[
'nbfield']++;
704if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
705 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
706 $totalarray[
'nbfield']++;
708if (!empty($arrayfields[
'c.ref'][
'checked'])) {
709 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
710 $totalarray[
'nbfield']++;
712if (!empty($arrayfields[
'f.description'][
'checked'])) {
713 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
714 $totalarray[
'nbfield']++;
717include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
719$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
720$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
721print $hookmanager->resPrint;
722if (!empty($arrayfields[
'f.datec'][
'checked'])) {
723 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
724 $totalarray[
'nbfield']++;
726if (!empty($arrayfields[
'f.tms'][
'checked'])) {
727 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
728 $totalarray[
'nbfield']++;
730if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
731 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
732 $totalarray[
'nbfield']++;
734if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
735 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
736 $totalarray[
'nbfield']++;
738if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
739 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
740 $totalarray[
'nbfield']++;
742if (!empty($arrayfields[
'fd.description'][
'checked'])) {
744 $totalarray[
'nbfield']++;
746if (!empty($arrayfields[
'fd.date'][
'checked'])) {
747 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
748 $totalarray[
'nbfield']++;
750if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
751 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
752 $totalarray[
'nbfield']++;
757 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
758 $totalarray[
'nbfield']++;
766$savnbfield = $totalarray[
'nbfield'];
767$totalarray = array();
768$totalarray[
'nbfield'] = 0;
769$totalarray[
'val'] = array();
770$totalarray[
'val'][
'fd.duree'] = 0;
772$imaxinloop = ($limit ? min($num, $limit) : $num);
773while ($i < $imaxinloop) {
774 $obj = $db->fetch_object($resql);
782 $objectstatic->id = $obj->rowid;
783 $objectstatic->ref = $obj->ref;
784 $objectstatic->ref_client = $obj->ref_client;
785 $objectstatic->statut = $obj->status;
786 $objectstatic->status = $obj->status;
788 $companystatic->name = $obj->name;
789 $companystatic->id = $obj->socid;
790 $companystatic->client = $obj->client;
791 $companystatic->fournisseur = $obj->fournisseur;
792 $companystatic->email = $obj->email;
793 $companystatic->status = $obj->thirdpartystatus;
796 if ($mode ==
'kanban') {
798 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
799 print
'<div class="box-flex-container kanban">';
803 if ($massactionbutton || $massaction) {
805 if (in_array(
$object->id, $arrayofselected)) {
810 $objectstatic->duration = $obj->duree;
811 $arraydata = array();
812 $arraydata[
'thirdparty'] = $companystatic;
813 print $objectstatic->getKanbanView(
'', $arraydata);
814 if ($i == ($imaxinloop - 1)) {
821 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
824 print
'<td class="nowrap center">';
825 if ($massactionbutton || $massaction) {
827 if (in_array($obj->rowid, $arrayofselected)) {
830 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
834 $totalarray[
'nbfield']++;
839 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
842 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
843 print
'<td class="nobordernopadding nowraponall">';
844 print $objectstatic->getNomUrl(1);
849 if (!empty($obj->note_private)) {
850 $warnornote .= ($warnornote ?
' ' :
'');
851 $warnornote .=
'<span class="note">';
852 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
853 $warnornote .=
'</span>';
856 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
862 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
865 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
866 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
867 print
'</td></tr></table>';
871 $totalarray[
'nbfield']++;
876 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
877 print
'<td class="nowrap tdoverflowmax200">';
881 $totalarray[
'nbfield']++;
885 if (!empty($arrayfields[
's.nom'][
'checked'])) {
886 print
'<td class="tdoverflowmax125">';
887 print $companystatic->getNomUrl(1,
'', 44);
890 $totalarray[
'nbfield']++;
894 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
895 print
'<td class="tdoverflowmax150">';
896 $projetstatic->id = $obj->projet_id;
897 $projetstatic->ref = $obj->projet_ref;
898 $projetstatic->title = $obj->projet_title;
899 if ($projetstatic->id > 0) {
900 print $projetstatic->getNomUrl(1,
'');
904 $totalarray[
'nbfield']++;
908 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
909 print
'<td class="tdoverflowmax150">';
910 $contratstatic->id = $obj->contrat_id;
911 $contratstatic->ref = $obj->contrat_ref;
912 $contratstatic->ref_customer = $obj->contrat_ref_customer;
913 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
914 if ($contratstatic->id > 0) {
915 print $contratstatic->getNomUrl(1,
'');
919 $totalarray[
'nbfield']++;
922 if (!empty($arrayfields[
'f.description'][
'checked'])) {
925 $totalarray[
'nbfield']++;
930 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
932 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
933 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
934 print $hookmanager->resPrint;
936 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
937 print
'<td class="center nowraponall">';
938 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
941 $totalarray[
'nbfield']++;
945 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
946 print
'<td class="center nowraponall">';
947 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
950 $totalarray[
'nbfield']++;
954 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
955 print
'<td class="sensiblehtmlcontent center">';
957 print
'</td>';
if (!$i) {
958 $totalarray[
'nbfield']++;
962 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
963 print
'<td class="sensiblehtmlcontent center">';
967 $totalarray[
'nbfield']++;
971 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
972 print
'<td class="center">'.$objectstatic->getLibStatut(5).
'</td>';
974 $totalarray[
'nbfield']++;
978 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
981 print
'<div class="classfortooltip tdoverflowmax250" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).
'">';
986 $totalarray[
'nbfield']++;
990 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
991 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
993 $totalarray[
'nbfield']++;
997 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
998 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
1000 $totalarray[
'nbfield']++;
1003 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
1006 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
1008 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
1012 print
'<td class="nowrap center">';
1013 if ($massactionbutton || $massaction) {
1015 if (in_array($obj->rowid, $arrayofselected)) {
1018 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1022 $totalarray[
'nbfield']++;
1028 $total += (isset($obj->duree) ? $obj->duree : 0);
1035include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1040 foreach ($arrayfields as $key => $val) {
1041 if (!empty($val[
'checked'])) {
1045 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1050$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1051$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1052print $hookmanager->resPrint;
1054print
'</table>'.
"\n";
1057print
'</form>'.
"\n";
1059if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1060 $hidegeneratedfilelistifempty = 1;
1061 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1062 $hidegeneratedfilelistifempty = 0;
1065 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1069 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1070 $urlsource .= str_replace(
'&',
'&', $param);
1072 $filedir = $diroutputmassaction;
1073 $genallowed = $permissiontoread;
1074 $delallowed = $permissiontoadd;
1076 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...)
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...
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.