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';
57$langs->loadLangs(array(
'companies',
'bills',
'interventions'));
58if (isModEnabled(
'project')) {
59 $langs->load(
"projects");
61if (isModEnabled(
'contract')) {
62 $langs->load(
"contracts");
65$action =
GETPOST(
'action',
'aZ09');
66$massaction =
GETPOST(
'massaction',
'alpha');
68$confirm =
GETPOST(
'confirm',
'alpha');
69$toselect =
GETPOST(
'toselect',
'array');
70$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'interventionlist';
71$mode =
GETPOST(
'mode',
'alpha');
73$search_ref =
GETPOST(
'search_ref') ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'search_inter',
'alpha');
74$search_ref_client =
GETPOST(
'search_ref_client',
'alpha');
75$search_company =
GETPOST(
'search_company',
'alpha');
76$search_desc =
GETPOST(
'search_desc',
'alpha');
77$search_projet_ref =
GETPOST(
'search_projet_ref',
'alpha');
78$search_contrat_ref =
GETPOST(
'search_contrat_ref',
'alpha');
79$search_status =
GETPOST(
'search_status',
'alpha');
80$search_signed_status =
GETPOST(
'search_signed_status',
'alpha');
81$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
82$search_date_startday =
GETPOSTINT(
'search_date_startday');
83$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
84$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
85$search_date_endday =
GETPOSTINT(
'search_date_endday');
86$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
87$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
88$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
89$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
90$optioncss =
GETPOST(
'optioncss',
'alpha');
93$diroutputmassaction =
$conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
97$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
98$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
100if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
104$offset = $limit * $page;
105$pageprev = $page - 1;
106$pagenext = $page + 1;
111 $sortfield =
"f.ref";
116$hookmanager->initHooks(array($contextpage));
121$extrafields->fetch_name_optionals_label(
$object->table_element);
123$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
126$fieldstosearchall = array(
128 's.nom' =>
"ThirdParty",
129 'f.description' =>
'Description',
130 'f.note_public' =>
'NotePublic',
131 'fd.description' =>
'DescriptionOfLine',
133if (empty($user->socid)) {
134 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
137 unset($fieldstosearchall[
'fd.description']);
142 'f.ref' => array(
'label' =>
'Ref',
'checked' => 1),
143 'f.ref_client' => array(
'label' =>
'RefCustomer',
'checked' => 1),
144 's.nom' => array(
'label' =>
'ThirdParty',
'checked' => 1),
145 'pr.ref' => array(
'label' =>
'Project',
'checked' => 1,
'enabled' => (!isModEnabled(
'project') ? 0 : 1)),
146 'c.ref' => array(
'label' =>
'Contract',
'checked' => 1,
'enabled' => (empty(
$conf->contrat->enabled) ? 0 : 1)),
147 'f.description' => array(
'label' =>
'Description',
'checked' => 1),
148 'f.datec' => array(
'label' =>
'DateCreation',
'checked' => 0,
'position' => 500),
149 'f.tms' => array(
'label' =>
'DateModificationShort',
'checked' => 0,
'position' => 500),
150 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'position' => 510,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
151 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'position' => 511,
'enabled' => (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
152 'f.fk_statut' => array(
'label' =>
'Status',
'checked' => 1,
'position' => 1000),
153 'f.signed_status' => array(
'label' =>
'SignedStatus',
'checked' => 0,
'position' => 1001),
154 'fd.description' => array(
'label' =>
"DescriptionOfLine",
'checked' => 1,
'enabled' =>
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') !=
'1' ? 1 : 0),
155 'fd.date' => array(
'label' =>
'DateOfLine',
'checked' => 1,
'enabled' =>
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') !=
'1' ? 1 : 0),
156 'fd.duree' => array(
'label' =>
'DurationOfLine',
'type' =>
'duration',
'checked' => 1,
'enabled' => !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ? 1 : 0),
158'@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields';
160include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
164'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
169 $socid = $user->socid;
173$permissiontoread = $user->hasRight(
'ficheinter',
'lire');
174$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
175$permissiontodelete = $user->hasRight(
'ficheinter',
'supprimer');
182if (
GETPOST(
'cancel',
'alpha')) {
186if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
190$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
191$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
196if (empty($reshook)) {
198 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
201 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
203 $search_ref_client =
"";
204 $search_company =
"";
205 $search_projet_ref =
"";
206 $search_contrat_ref =
"";
209 $search_signed_status =
'';
210 $search_date_startday =
'';
211 $search_date_startmonth =
'';
212 $search_date_startyear =
'';
213 $search_date_endday =
'';
214 $search_date_endmonth =
'';
215 $search_date_endyear =
'';
216 $search_date_start =
'';
217 $search_date_end =
'';
219 $search_array_options = array();
223 $objectclass =
'Fichinter';
224 $objectlabel =
'Interventions';
225 $uploaddir =
$conf->ficheinter->dir_output;
226 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
236$form =
new Form($db);
239$companystatic =
new Societe($db);
240if (isModEnabled(
'project')) {
241 $projetstatic =
new Project($db);
243if (isModEnabled(
'contract')) {
244 $contratstatic =
new Contrat($db);
249$title = $langs->trans(
"Interventions");
255$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
256$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
258$atleastonefieldinlines = 0;
259foreach ($arrayfields as $tmpkey => $tmpval) {
260 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
261 $atleastonefieldinlines++;
267$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,";
269 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
271$sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
272if (isModEnabled(
'project')) {
273 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
275if (isModEnabled(
'contract')) {
276 $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";
279if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
280 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
281 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
285$parameters = array();
286$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
287$sql .= $hookmanager->resPrint;
291$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
292if (isModEnabled(
'project')) {
293 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
295if (isModEnabled(
'contract')) {
296 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
298if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
299 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
302 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
306$parameters = array();
307$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
308$sql .= $hookmanager->resPrint;
310if (!$user->hasRight(
'societe',
'client',
'voir')) {
311 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
313$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
314$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
315$sql .=
" AND f.fk_soc = s.rowid";
319if ($search_ref_client) {
322if ($search_company) {
325if ($search_projet_ref) {
328if ($search_contrat_ref) {
333 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
338if ($search_status !=
'' && $search_status >= 0) {
339 $sql .=
' AND f.fk_statut = '.urlencode($search_status);
341if ($search_signed_status !=
'' && $search_signed_status >= 0) {
342 $sql .=
' AND f.signed_status = '.urlencode($search_signed_status);
345 if ($search_date_start) {
346 $sql .=
" AND fd.date >= '".$db->idate($search_date_start).
"'";
348 if ($search_date_end) {
349 $sql .=
" AND fd.date <= '".$db->idate($search_date_end).
"'";
352if (!$user->hasRight(
'societe',
'client',
'voir')) {
353 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
356 $sql .=
" AND s.rowid = ".((int) $socid);
359 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
371include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
373$parameters = array();
374$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
375$sql .= $hookmanager->resPrint;
377$parameters = array(
'search_all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
378$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
379$sql .= $hookmanager->resPrint;
382$nbtotalofrecords =
'';
385 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
386 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
387 $resql = $db->query($sqlforcount);
389 $objforcount = $db->fetch_object($resql);
390 $nbtotalofrecords = $objforcount->nbtotalofrecords;
395 if (($page * $limit) > $nbtotalofrecords) {
403$sql .= $db->order($sortfield, $sortorder);
405 $sql .= $db->plimit($limit + 1, $offset);
408$resql = $db->query($sql);
414$num = $db->num_rows($resql);
418if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
419 $obj = $db->fetch_object($resql);
429llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-fichinter page-list');
432$arrayofselected = is_array($toselect) ? $toselect : array();
437 if (empty($search_company)) {
438 $search_company = $soc->name;
444 $param .=
'&mode='.urlencode($mode);
446if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
447 $param .=
'&contextpage='.urlencode($contextpage);
449if ($limit > 0 && $limit !=
$conf->liste_limit) {
450 $param .=
'&limit='.((int) $limit);
453 $param .=
"&search_all=".urlencode($search_all);
456 $param .=
"&socid=".urlencode((
string) ($socid));
459 $param .=
"&search_ref=".urlencode($search_ref);
461if ($search_ref_client) {
462 $param .=
"&search_ref_client=".urlencode($search_ref_client);
464if ($search_company) {
465 $param .=
"&search_company=".urlencode($search_company);
468 $param .=
"&search_desc=".urlencode($search_desc);
470if ($search_status !=
'' && $search_status > -1) {
471 $param .=
"&search_status=".urlencode($search_status);
473if ($search_signed_status !=
'' && $search_signed_status >= 0) {
474 $param .=
'&search_signed_status='.urlencode($search_signed_status);
476if ($search_date_startday > 0) {
477 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
479if ($search_date_startmonth > 0) {
480 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
482if ($search_date_startyear > 0) {
483 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
485if ($search_date_endday > 0) {
486 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
488if ($search_date_endmonth > 0) {
489 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
491if ($search_date_endyear > 0) {
492 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
495 $param .=
'&show_files='.urlencode((
string) ($show_files));
497if ($optioncss !=
'') {
498 $param .=
'&optioncss='.urlencode($optioncss);
501include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
503$parameters = array(
'param' => &$param);
504$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
505$param .= $hookmanager->resPrint;
508$arrayofmassactions = array(
509 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
510 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
513if (!empty($permissiontodelete)) {
514 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
516if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
517 $arrayofmassactions = array();
519$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
522print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
523if ($optioncss !=
'') {
524 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
526print
'<input type="hidden" name="token" value="'.newToken().
'">';
527print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
528print
'<input type="hidden" name="action" value="list">';
529print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
530print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
531print
'<input type="hidden" name="page" value="'.$page.
'">';
532print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
533print
'<input type="hidden" name="page_y" value="">';
534print
'<input type="hidden" name="mode" value="'.$mode.
'">';
537$url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
539 $url .=
'&socid='.$socid;
542$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'));
543$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'));
545$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'ficheinter',
'creer'));
547print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
549$topicmail =
"Information";
550$modelmail =
"intervention";
552$trackid =
'int'.$object->id;
553include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
557 foreach ($fieldstosearchall as $key => $val) {
558 $fieldstosearchall[$key] = $langs->trans($val);
559 $setupstring .= $key.
"=".$val.
";";
561 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
562 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
567$parameters = array();
568$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
569if (empty($reshook)) {
570 $moreforfilter .= $hookmanager->resPrint;
572 $moreforfilter = $hookmanager->resPrint;
575if (!empty($moreforfilter)) {
576 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
577 print $moreforfilter;
581$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
582$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
583$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
584$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
586print
'<div class="div-table-responsive">';
587print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
591print
'<tr class="liste_titre_filter">';
594 print
'<td class="liste_titre center maxwidthsearch">';
595 $searchpicto = $form->showFilterButtons(
'left');
599if (!empty($arrayfields[
'f.ref'][
'checked'])) {
600 print
'<td class="liste_titre">';
601 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
604if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
605 print
'<td class="liste_titre">';
606 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
609if (!empty($arrayfields[
's.nom'][
'checked'])) {
610 print
'<td class="liste_titre">';
611 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
614if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
615 print
'<td class="liste_titre">';
616 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
619if (!empty($arrayfields[
'c.ref'][
'checked'])) {
620 print
'<td class="liste_titre">';
621 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
624if (!empty($arrayfields[
'f.description'][
'checked'])) {
625 print
'<td class="liste_titre">';
626 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
630include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
633$parameters = array(
'arrayfields' => $arrayfields);
634$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
635print $hookmanager->resPrint;
636if (!empty($arrayfields[
'f.datec'][
'checked'])) {
638 print
'<td class="liste_titre">';
641if (!empty($arrayfields[
'f.tms'][
'checked'])) {
643 print
'<td class="liste_titre">';
646if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
648 print
'<td class="liste_titre">';
651if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
653 print
'<td class="liste_titre">';
657if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
658 print
'<td class="liste_titre right parentonrightofpage">';
660 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
661 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
662 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
663 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
666 unset($liststatus[2]);
669 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
673if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
674 print
'<td class="liste_titre center">';
675 $list_signed_status =
$object->getSignedStatusLocalisedArray();
676 print $form->selectarray(
'search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status');
680if (!empty($arrayfields[
'fd.description'][
'checked'])) {
681 print
'<td class="liste_titre"> </td>';
683if (!empty($arrayfields[
'fd.date'][
'checked'])) {
684 print
'<td class="liste_titre center">';
685 print
'<div class="nowrapfordate">';
686 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
688 print
'<div class="nowrapfordate">';
689 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
693if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
694 print
'<td class="liste_titre"> </td>';
698 print
'<td class="liste_titre center maxwidthsearch">';
699 $searchpicto = $form->showFilterButtons();
705$totalarray = array();
706$totalarray[
'nbfield'] = 0;
710print
'<tr class="liste_titre">';
713 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
714 $totalarray[
'nbfield']++;
716if (!empty($arrayfields[
'f.ref'][
'checked'])) {
718 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
719 $totalarray[
'nbfield']++;
721if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
722 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
723 $totalarray[
'nbfield']++;
725if (!empty($arrayfields[
's.nom'][
'checked'])) {
726 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
727 $totalarray[
'nbfield']++;
729if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
730 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
731 $totalarray[
'nbfield']++;
733if (!empty($arrayfields[
'c.ref'][
'checked'])) {
734 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
735 $totalarray[
'nbfield']++;
737if (!empty($arrayfields[
'f.description'][
'checked'])) {
738 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
739 $totalarray[
'nbfield']++;
742include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
744$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
745$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
746print $hookmanager->resPrint;
747if (!empty($arrayfields[
'f.datec'][
'checked'])) {
748 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
749 $totalarray[
'nbfield']++;
751if (!empty($arrayfields[
'f.tms'][
'checked'])) {
752 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
753 $totalarray[
'nbfield']++;
755if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
756 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
757 $totalarray[
'nbfield']++;
759if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
760 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
761 $totalarray[
'nbfield']++;
763if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
764 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
765 $totalarray[
'nbfield']++;
767if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
768 print_liste_field_titre($arrayfields[
'f.signed_status'][
'label'], $_SERVER[
"PHP_SELF"],
"f.signed_status",
"", $param,
'', $sortfield, $sortorder,
'center ');
769 $totalarray[
'nbfield']++;
771if (!empty($arrayfields[
'fd.description'][
'checked'])) {
773 $totalarray[
'nbfield']++;
775if (!empty($arrayfields[
'fd.date'][
'checked'])) {
776 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
777 $totalarray[
'nbfield']++;
779if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
780 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
781 $totalarray[
'nbfield']++;
786 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
787 $totalarray[
'nbfield']++;
795$savnbfield = $totalarray[
'nbfield'];
796$totalarray = array();
797$totalarray[
'nbfield'] = 0;
798$totalarray[
'val'] = array();
799$totalarray[
'val'][
'fd.duree'] = 0;
801$imaxinloop = ($limit ? min($num, $limit) : $num);
802while ($i < $imaxinloop) {
803 $obj = $db->fetch_object($resql);
811 $objectstatic->id = $obj->rowid;
812 $objectstatic->ref = $obj->ref;
813 $objectstatic->ref_client = $obj->ref_client;
814 $objectstatic->statut = $obj->status;
815 $objectstatic->status = $obj->status;
816 $objectstatic->signed_status = $obj->signed_status;
818 $companystatic->name = $obj->name;
819 $companystatic->id = $obj->socid;
820 $companystatic->client = $obj->client;
821 $companystatic->fournisseur = $obj->fournisseur;
822 $companystatic->email = $obj->email;
823 $companystatic->status = $obj->thirdpartystatus;
826 if ($mode ==
'kanban') {
828 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
829 print
'<div class="box-flex-container kanban">';
833 if ($massactionbutton || $massaction) {
835 if (in_array(
$object->id, $arrayofselected)) {
840 $objectstatic->duration = $obj->duree;
841 $arraydata = array();
842 $arraydata[
'thirdparty'] = $companystatic;
843 print $objectstatic->getKanbanView(
'', $arraydata);
844 if ($i == ($imaxinloop - 1)) {
851 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
854 print
'<td class="nowrap center">';
855 if ($massactionbutton || $massaction) {
857 if (in_array($obj->rowid, $arrayofselected)) {
860 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
864 $totalarray[
'nbfield']++;
869 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
872 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
873 print
'<td class="nobordernopadding nowraponall">';
874 print $objectstatic->getNomUrl(1);
879 if (!empty($obj->note_private)) {
880 $warnornote .= ($warnornote ?
' ' :
'');
881 $warnornote .=
'<span class="note">';
882 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
883 $warnornote .=
'</span>';
886 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
892 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
895 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
896 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
897 print
'</td></tr></table>';
901 $totalarray[
'nbfield']++;
906 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
907 print
'<td class="nowrap tdoverflowmax200">';
911 $totalarray[
'nbfield']++;
915 if (!empty($arrayfields[
's.nom'][
'checked'])) {
916 print
'<td class="tdoverflowmax125">';
917 print $companystatic->getNomUrl(1,
'', 44);
920 $totalarray[
'nbfield']++;
924 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
925 print
'<td class="tdoverflowmax150">';
926 $projetstatic->id = $obj->projet_id;
927 $projetstatic->ref = $obj->projet_ref;
928 $projetstatic->title = $obj->projet_title;
929 if ($projetstatic->id > 0) {
930 print $projetstatic->getNomUrl(1,
'');
934 $totalarray[
'nbfield']++;
938 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
939 print
'<td class="tdoverflowmax150">';
940 $contratstatic->id = $obj->contrat_id;
941 $contratstatic->ref = $obj->contrat_ref;
942 $contratstatic->ref_customer = $obj->contrat_ref_customer;
943 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
944 if ($contratstatic->id > 0) {
945 print $contratstatic->getNomUrl(1,
'');
949 $totalarray[
'nbfield']++;
952 if (!empty($arrayfields[
'f.description'][
'checked'])) {
955 $totalarray[
'nbfield']++;
960 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
962 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
963 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
964 print $hookmanager->resPrint;
966 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
967 print
'<td class="center nowraponall">';
968 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
971 $totalarray[
'nbfield']++;
975 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
976 print
'<td class="center nowraponall">';
977 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
980 $totalarray[
'nbfield']++;
984 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
985 print
'<td class="sensiblehtmlcontent center">';
989 $totalarray[
'nbfield']++;
993 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
994 print
'<td class="sensiblehtmlcontent center">';
998 $totalarray[
'nbfield']++;
1002 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1003 print
'<td class="center">'.$objectstatic->getLibStatut(5).
'</td>';
1005 $totalarray[
'nbfield']++;
1009 if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
1010 print
'<td class="center">'.$objectstatic->getLibSignedStatus(5).
'</td>';
1012 $totalarray[
'nbfield']++;
1016 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
1019 print
'<div class="classfortooltip tdoverflowmax250 small" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).
'">';
1024 $totalarray[
'nbfield']++;
1028 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
1029 print
'<td class="center nowraponall" title="'.dol_print_date($db->jdate($obj->dp),
'dayhour').
'">'.
dol_print_date($db->jdate($obj->dp),
'dayhour').
"</td>\n";
1031 $totalarray[
'nbfield']++;
1035 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
1036 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
1038 $totalarray[
'nbfield']++;
1041 $totalarray[
'type'][$totalarray[
'nbfield']] =
'duration';
1044 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'fd.duree';
1046 $totalarray[
'val'][
'fd.duree'] += $obj->duree;
1050 print
'<td class="nowrap center">';
1051 if ($massactionbutton || $massaction) {
1053 if (in_array($obj->rowid, $arrayofselected)) {
1056 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1060 $totalarray[
'nbfield']++;
1066 $total += (isset($obj->duree) ? $obj->duree : 0);
1073include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1078 foreach ($arrayfields as $key => $val) {
1079 if (!empty($val[
'checked'])) {
1083 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1088$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1089$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1090print $hookmanager->resPrint;
1092print
'</table>'.
"\n";
1095print
'</form>'.
"\n";
1097if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1098 $hidegeneratedfilelistifempty = 1;
1099 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1100 $hidegeneratedfilelistifempty = 0;
1103 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1107 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1108 $urlsource .= str_replace(
'&',
'&', $param);
1110 $filedir = $diroutputmassaction;
1111 $genallowed = $permissiontoread;
1112 $delallowed = $permissiontoadd;
1114 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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.