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_signed_status =
GETPOST(
'search_signed_status',
'alpha');
73$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
74$search_date_startday =
GETPOSTINT(
'search_date_startday');
75$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
76$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
77$search_date_endday =
GETPOSTINT(
'search_date_endday');
78$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
79$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
80$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
81$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
82$optioncss =
GETPOST(
'optioncss',
'alpha');
85$diroutputmassaction = $conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
89$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
90$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
92if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
96$offset = $limit * $page;
103 $sortfield =
"f.ref";
108$hookmanager->initHooks(array($contextpage));
113$extrafields->fetch_name_optionals_label(
$object->table_element);
115$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
118$fieldstosearchall = array(
120 's.nom' =>
"ThirdParty",
121 'f.description' =>
'Description',
122 'f.note_public' =>
'NotePublic',
123 'fd.description' =>
'DescriptionOfLine',
125if (empty($user->socid)) {
126 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
129 unset($fieldstosearchall[
'fd.description']);
134 'f.ref' => array(
'label' =>
'Ref',
'checked' => 1),
135 'f.ref_client' => array(
'label' =>
'RefCustomer',
'checked' => 1),
136 's.nom' => array(
'label' =>
'ThirdParty',
'checked' => 1),
137 'pr.ref' => array(
'label' =>
'Project',
'checked' => 1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1)),
138 'c.ref' => array(
'label' =>
'Contract',
'checked' => 1,
'enabled' => (empty($conf->contrat->enabled) ? 0 : 1)),
139 'f.description' => array(
'label' =>
'Description',
'checked' => 1),
140 'f.datec' => array(
'label' =>
'DateCreation',
'checked' => 0,
'position' => 500),
141 'f.tms' => array(
'label' =>
'DateModificationShort',
'checked' => 0,
'position' => 500),
142 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
143 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
144 'f.fk_statut' => array(
'label' =>
'Status',
'checked' => 1,
'position' => 1000),
145 'f.signed_status' => array(
'label' =>
'SignedStatus',
'checked' => 0,
'position' => 1001),
146 'fd.description' => array(
'label' =>
"DescriptionOfLine",
'checked' => 1,
'enabled' =>
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') !=
'1' ? 1 : 0),
147 'fd.date' => array(
'label' =>
'DateOfLine',
'checked' => 1,
'enabled' =>
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') !=
'1' ? 1 : 0),
148 'fd.duree' => array(
'label' =>
'DurationOfLine',
'type' =>
'duration',
'checked' => 1,
'enabled' => !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
150'@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields';
152include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
156'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
161 $socid = $user->socid;
165$permissiontoread = $user->hasRight(
'ficheinter',
'lire');
166$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
167$permissiontodelete = $user->hasRight(
'ficheinter',
'supprimer');
174if (
GETPOST(
'cancel',
'alpha')) {
178if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
182$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
183$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
188if (empty($reshook)) {
190 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
193 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
195 $search_ref_client =
"";
196 $search_company =
"";
197 $search_projet_ref =
"";
198 $search_contrat_ref =
"";
201 $search_signed_status =
'';
202 $search_date_startday =
'';
203 $search_date_startmonth =
'';
204 $search_date_startyear =
'';
205 $search_date_endday =
'';
206 $search_date_endmonth =
'';
207 $search_date_endyear =
'';
208 $search_date_start =
'';
209 $search_date_end =
'';
211 $search_array_options = array();
215 $objectclass =
'Fichinter';
216 $objectlabel =
'Interventions';
217 $uploaddir = $conf->ficheinter->dir_output;
218 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
228$form =
new Form($db);
231$companystatic =
new Societe($db);
232if (isModEnabled(
'project')) {
233 $projetstatic =
new Project($db);
235if (isModEnabled(
'contract')) {
236 $contratstatic =
new Contrat($db);
241$title = $langs->trans(
"Interventions");
247$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
248$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
250$atleastonefieldinlines = 0;
251foreach ($arrayfields as $tmpkey => $tmpval) {
252 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
253 $atleastonefieldinlines++;
259$sql .=
" f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.signed_status as signed_status, f.description, f.datec as date_creation, f.tms as date_modification, f.note_public, f.note_private,";
261 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
263$sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
264if (isModEnabled(
'project')) {
265 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
267if (isModEnabled(
'contract')) {
268 $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";
271if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
272 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
273 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
277$parameters = array();
278$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
279$sql .= $hookmanager->resPrint;
283$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
284if (isModEnabled(
'project')) {
285 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
287if (isModEnabled(
'contract')) {
288 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
290if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
291 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
294 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
298$parameters = array();
299$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
300$sql .= $hookmanager->resPrint;
302if (!$user->hasRight(
'societe',
'client',
'voir')) {
303 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
305$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
306$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
307$sql .=
" AND f.fk_soc = s.rowid";
311if ($search_ref_client) {
314if ($search_company) {
317if ($search_projet_ref) {
320if ($search_contrat_ref) {
325 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
330if ($search_status !=
'' && $search_status >= 0) {
331 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
333if ($search_signed_status !=
'' && $search_signed_status >= 0) {
334 $sql .=
' AND f.signed_status = '.urlencode($search_signed_status);
337 if ($search_date_start) {
338 $sql .=
" AND fd.date >= '".$db->idate($search_date_start).
"'";
340 if ($search_date_end) {
341 $sql .=
" AND fd.date <= '".$db->idate($search_date_end).
"'";
344if (!$user->hasRight(
'societe',
'client',
'voir')) {
345 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
348 $sql .=
" AND s.rowid = ".((int) $socid);
351 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
363include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
365$parameters = array();
366$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
367$sql .= $hookmanager->resPrint;
369$parameters = array(
'search_all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
370$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
371$sql .= $hookmanager->resPrint;
374$nbtotalofrecords =
'';
377 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
378 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
379 $resql = $db->query($sqlforcount);
381 $objforcount = $db->fetch_object($resql);
382 $nbtotalofrecords = $objforcount->nbtotalofrecords;
387 if (($page * $limit) > $nbtotalofrecords) {
395$sql .= $db->order($sortfield, $sortorder);
397 $sql .= $db->plimit($limit + 1, $offset);
400$resql = $db->query($sql);
406$num = $db->num_rows($resql);
410if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
411 $obj = $db->fetch_object($resql);
421llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-fichinter page-list');
424$arrayofselected = is_array($toselect) ? $toselect : array();
429 if (empty($search_company)) {
430 $search_company = $soc->name;
436 $param .=
'&mode='.urlencode($mode);
438if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
439 $param .=
'&contextpage='.urlencode($contextpage);
441if ($limit > 0 && $limit != $conf->liste_limit) {
442 $param .=
'&limit='.((int) $limit);
445 $param .=
"&search_all=".urlencode($search_all);
448 $param .=
"&socid=".urlencode((
string) ($socid));
451 $param .=
"&search_ref=".urlencode($search_ref);
453if ($search_ref_client) {
454 $param .=
"&search_ref_client=".urlencode($search_ref_client);
456if ($search_company) {
457 $param .=
"&search_company=".urlencode($search_company);
460 $param .=
"&search_desc=".urlencode($search_desc);
462if ($search_status !=
'' && $search_status > -1) {
463 $param .=
"&search_status=".urlencode($search_status);
465if ($search_signed_status !=
'' && $search_signed_status >= 0) {
466 $param .=
'&search_signed_status='.urlencode($search_signed_status);
468if ($search_date_startday > 0) {
469 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
471if ($search_date_startmonth > 0) {
472 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
474if ($search_date_startyear > 0) {
475 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
477if ($search_date_endday > 0) {
478 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
480if ($search_date_endmonth > 0) {
481 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
483if ($search_date_endyear > 0) {
484 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
487 $param .=
'&show_files='.urlencode((
string) ($show_files));
489if ($optioncss !=
'') {
490 $param .=
'&optioncss='.urlencode($optioncss);
493include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
495$parameters = array(
'param' => &$param);
496$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
497$param .= $hookmanager->resPrint;
500$arrayofmassactions = array(
501 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
502 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
505if (!empty($permissiontodelete)) {
506 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
508if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
509 $arrayofmassactions = array();
511$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
514print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
515if ($optioncss !=
'') {
516 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
518print
'<input type="hidden" name="token" value="'.newToken().
'">';
519print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
520print
'<input type="hidden" name="action" value="list">';
521print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
522print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
523print
'<input type="hidden" name="page" value="'.$page.
'">';
524print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
525print
'<input type="hidden" name="page_y" value="">';
526print
'<input type="hidden" name="mode" value="'.$mode.
'">';
529$url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
531 $url .=
'&socid='.$socid;
534$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'));
535$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'));
537$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'ficheinter',
'creer'));
539print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
541$topicmail =
"Information";
542$modelmail =
"intervention";
544$trackid =
'int'.$object->id;
545include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
549 foreach ($fieldstosearchall as $key => $val) {
550 $fieldstosearchall[$key] = $langs->trans($val);
551 $setupstring .= $key.
"=".$val.
";";
553 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
554 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
559$parameters = array();
560$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
561if (empty($reshook)) {
562 $moreforfilter .= $hookmanager->resPrint;
564 $moreforfilter = $hookmanager->resPrint;
567if (!empty($moreforfilter)) {
568 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
569 print $moreforfilter;
573$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
574$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
575$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
576$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
578print
'<div class="div-table-responsive">';
579print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
583print
'<tr class="liste_titre_filter">';
586 print
'<td class="liste_titre center maxwidthsearch">';
587 $searchpicto = $form->showFilterButtons(
'left');
591if (!empty($arrayfields[
'f.ref'][
'checked'])) {
592 print
'<td class="liste_titre">';
593 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
596if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
597 print
'<td class="liste_titre">';
598 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
601if (!empty($arrayfields[
's.nom'][
'checked'])) {
602 print
'<td class="liste_titre">';
603 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
606if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
607 print
'<td class="liste_titre">';
608 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
611if (!empty($arrayfields[
'c.ref'][
'checked'])) {
612 print
'<td class="liste_titre">';
613 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
616if (!empty($arrayfields[
'f.description'][
'checked'])) {
617 print
'<td class="liste_titre">';
618 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
622include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
625$parameters = array(
'arrayfields' => $arrayfields);
626$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
627print $hookmanager->resPrint;
628if (!empty($arrayfields[
'f.datec'][
'checked'])) {
630 print
'<td class="liste_titre">';
633if (!empty($arrayfields[
'f.tms'][
'checked'])) {
635 print
'<td class="liste_titre">';
638if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
640 print
'<td class="liste_titre">';
643if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
645 print
'<td class="liste_titre">';
649if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
650 print
'<td class="liste_titre right parentonrightofpage">';
652 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
653 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
654 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
655 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
658 unset($liststatus[2]);
661 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
665if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
666 print
'<td class="liste_titre center">';
667 $list_signed_status =
$object->getSignedStatusLocalisedArray();
668 print $form->selectarray(
'search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status');
672if (!empty($arrayfields[
'fd.description'][
'checked'])) {
673 print
'<td class="liste_titre"> </td>';
675if (!empty($arrayfields[
'fd.date'][
'checked'])) {
676 print
'<td class="liste_titre center">';
677 print
'<div class="nowrapfordate">';
678 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
680 print
'<div class="nowrapfordate">';
681 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
685if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
686 print
'<td class="liste_titre"> </td>';
690 print
'<td class="liste_titre center maxwidthsearch">';
691 $searchpicto = $form->showFilterButtons();
697$totalarray = array();
698$totalarray[
'nbfield'] = 0;
702print
'<tr class="liste_titre">';
705 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
706 $totalarray[
'nbfield']++;
708if (!empty($arrayfields[
'f.ref'][
'checked'])) {
710 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
711 $totalarray[
'nbfield']++;
713if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
714 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
715 $totalarray[
'nbfield']++;
717if (!empty($arrayfields[
's.nom'][
'checked'])) {
718 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
719 $totalarray[
'nbfield']++;
721if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
722 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
723 $totalarray[
'nbfield']++;
725if (!empty($arrayfields[
'c.ref'][
'checked'])) {
726 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
727 $totalarray[
'nbfield']++;
729if (!empty($arrayfields[
'f.description'][
'checked'])) {
730 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
731 $totalarray[
'nbfield']++;
734include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
736$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
737$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
738print $hookmanager->resPrint;
739if (!empty($arrayfields[
'f.datec'][
'checked'])) {
740 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
741 $totalarray[
'nbfield']++;
743if (!empty($arrayfields[
'f.tms'][
'checked'])) {
744 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
745 $totalarray[
'nbfield']++;
747if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
748 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
749 $totalarray[
'nbfield']++;
751if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
752 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
753 $totalarray[
'nbfield']++;
755if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
756 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
757 $totalarray[
'nbfield']++;
759if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
760 print_liste_field_titre($arrayfields[
'f.signed_status'][
'label'], $_SERVER[
"PHP_SELF"],
"f.signed_status",
"", $param,
'', $sortfield, $sortorder,
'center ');
761 $totalarray[
'nbfield']++;
763if (!empty($arrayfields[
'fd.description'][
'checked'])) {
765 $totalarray[
'nbfield']++;
767if (!empty($arrayfields[
'fd.date'][
'checked'])) {
768 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
769 $totalarray[
'nbfield']++;
771if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
772 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
773 $totalarray[
'nbfield']++;
778 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
779 $totalarray[
'nbfield']++;
787$savnbfield = $totalarray[
'nbfield'];
788$totalarray = array();
789$totalarray[
'nbfield'] = 0;
790$totalarray[
'val'] = array();
791$totalarray[
'val'][
'fd.duree'] = 0;
793$imaxinloop = ($limit ? min($num, $limit) : $num);
794while ($i < $imaxinloop) {
795 $obj = $db->fetch_object($resql);
803 $objectstatic->id = $obj->rowid;
804 $objectstatic->ref = $obj->ref;
805 $objectstatic->ref_client = $obj->ref_client;
806 $objectstatic->statut = $obj->status;
807 $objectstatic->status = $obj->status;
808 $objectstatic->signed_status = $obj->signed_status;
810 $companystatic->name = $obj->name;
811 $companystatic->id = $obj->socid;
812 $companystatic->client = $obj->client;
813 $companystatic->fournisseur = $obj->fournisseur;
814 $companystatic->email = $obj->email;
815 $companystatic->status = $obj->thirdpartystatus;
818 if ($mode ==
'kanban') {
820 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
821 print
'<div class="box-flex-container kanban">';
825 if ($massactionbutton || $massaction) {
827 if (in_array(
$object->id, $arrayofselected)) {
832 $objectstatic->duration = $obj->duree;
833 $arraydata = array();
834 $arraydata[
'thirdparty'] = $companystatic;
835 print $objectstatic->getKanbanView(
'', $arraydata);
836 if ($i == ($imaxinloop - 1)) {
843 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
846 print
'<td class="nowrap center">';
847 if ($massactionbutton || $massaction) {
849 if (in_array($obj->rowid, $arrayofselected)) {
852 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
856 $totalarray[
'nbfield']++;
861 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
864 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
865 print
'<td class="nobordernopadding nowraponall">';
866 print $objectstatic->getNomUrl(1);
871 if (!empty($obj->note_private)) {
872 $warnornote .= ($warnornote ?
' ' :
'');
873 $warnornote .=
'<span class="note">';
874 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
875 $warnornote .=
'</span>';
878 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
884 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
887 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
888 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
889 print
'</td></tr></table>';
893 $totalarray[
'nbfield']++;
898 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
899 print
'<td class="nowrap tdoverflowmax200">';
903 $totalarray[
'nbfield']++;
907 if (!empty($arrayfields[
's.nom'][
'checked'])) {
908 print
'<td class="tdoverflowmax125">';
909 print $companystatic->getNomUrl(1,
'', 44);
912 $totalarray[
'nbfield']++;
916 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
917 print
'<td class="tdoverflowmax150">';
918 $projetstatic->id = $obj->projet_id;
919 $projetstatic->ref = $obj->projet_ref;
920 $projetstatic->title = $obj->projet_title;
921 if ($projetstatic->id > 0) {
922 print $projetstatic->getNomUrl(1,
'');
926 $totalarray[
'nbfield']++;
930 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
931 print
'<td class="tdoverflowmax150">';
932 $contratstatic->id = $obj->contrat_id;
933 $contratstatic->ref = $obj->contrat_ref;
934 $contratstatic->ref_customer = $obj->contrat_ref_customer;
935 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
936 if ($contratstatic->id > 0) {
937 print $contratstatic->getNomUrl(1,
'');
941 $totalarray[
'nbfield']++;
944 if (!empty($arrayfields[
'f.description'][
'checked'])) {
947 $totalarray[
'nbfield']++;
952 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
954 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
955 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
956 print $hookmanager->resPrint;
958 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
959 print
'<td class="center nowraponall">';
960 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
963 $totalarray[
'nbfield']++;
967 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
968 print
'<td class="center nowraponall">';
969 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
972 $totalarray[
'nbfield']++;
976 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
977 print
'<td class="sensiblehtmlcontent center">';
981 $totalarray[
'nbfield']++;
985 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
986 print
'<td class="sensiblehtmlcontent center">';
990 $totalarray[
'nbfield']++;
994 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
995 print
'<td class="center">'.$objectstatic->getLibStatut(5).
'</td>';
997 $totalarray[
'nbfield']++;
1001 if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
1002 print
'<td class="center">'.$objectstatic->getLibSignedStatus(5).
'</td>';
1004 $totalarray[
'nbfield']++;
1008 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
1011 print
'<div class="classfortooltip tdoverflowmax250" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).
'">';
1016 $totalarray[
'nbfield']++;
1020 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
1021 print
'<td class="center">'.dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
1023 $totalarray[
'nbfield']++;
1027 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
1028 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
1030 $totalarray[
'nbfield']++;
1033 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
1036 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
1038 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
1042 print
'<td class="nowrap center">';
1043 if ($massactionbutton || $massaction) {
1045 if (in_array($obj->rowid, $arrayofselected)) {
1048 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1052 $totalarray[
'nbfield']++;
1058 $total += $obj->duree;
1065include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1070 foreach ($arrayfields as $key => $val) {
1071 if (!empty($val[
'checked'])) {
1075 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1080$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1081$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1082print $hookmanager->resPrint;
1084print
'</table>'.
"\n";
1087print
'</form>'.
"\n";
1089if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1090 $hidegeneratedfilelistifempty = 1;
1091 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1092 $hidegeneratedfilelistifempty = 0;
1095 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1099 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1100 $urlsource .= str_replace(
'&',
'&', $param);
1102 $filedir = $diroutputmassaction;
1103 $genallowed = $permissiontoread;
1104 $delallowed = $permissiontoadd;
1106 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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 a 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.