36require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
50 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
62$langs->loadLangs(array(
'companies',
'bills',
'interventions'));
64 $langs->load(
"projects");
67 $langs->load(
"contracts");
70 $langs->load(
"categories");
73$action =
GETPOST(
'action',
'aZ09');
74$massaction =
GETPOST(
'massaction',
'alpha');
76$confirm =
GETPOST(
'confirm',
'alpha');
77$toselect =
GETPOST(
'toselect',
'array:int');
78$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'interventionlist';
79$mode =
GETPOST(
'mode',
'alpha');
82 $userschilds = $user->getAllChildIds();
84 $userschilds = array();
87$search_ref =
GETPOST(
'search_ref') ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'search_inter',
'alpha');
88$search_ref_client =
GETPOST(
'search_ref_client',
'alpha');
89$search_company =
GETPOST(
'search_company',
'alpha');
90$search_desc =
GETPOST(
'search_desc',
'alpha');
91$search_projet_ref =
GETPOST(
'search_projet_ref',
'alpha');
92$search_contrat_ref =
GETPOST(
'search_contrat_ref',
'alpha');
93$search_status =
GETPOST(
'search_status',
'alpha');
94$search_signed_status =
GETPOST(
'search_signed_status',
'alpha');
95$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
96$search_date_startday =
GETPOSTINT(
'search_date_startday');
97$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
98$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
99$search_date_endday =
GETPOSTINT(
'search_date_endday');
100$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
101$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
102$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
103$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
104$optioncss =
GETPOST(
'optioncss',
'alpha');
107$searchCategoryFichinterOperator = 0;
108if (GETPOSTISSET(
'formfilteraction')) {
109 $searchCategoryFichinterOperator =
GETPOSTINT(
'search_category_fichinter_operator');
111 $searchCategoryFichinterOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
113$searchCategoryFichinterList =
GETPOST(
'search_category_fichinter_list',
'array');
114$catid =
GETPOST(
'catid',
'int');
115if (!empty($catid) && empty($searchCategoryFichinterList)) {
116 $searchCategoryFichinterList = array($catid);
119$diroutputmassaction =
$conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id;
123$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
124$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
126if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
130$offset = $limit * $page;
131$pageprev = $page - 1;
132$pagenext = $page + 1;
137 $sortfield =
"f.ref";
142$hookmanager->initHooks(array($contextpage));
145$extrafields->fetch_name_optionals_label(
$object->table_element);
147$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
150$fieldstosearchall = array(
152 's.nom' =>
"ThirdParty",
153 'f.description' =>
'Description',
154 'f.note_public' =>
'NotePublic',
155 'fd.description' =>
'DescriptionOfLine',
157if (empty($user->socid)) {
158 $fieldstosearchall[
"f.note_private"] =
"NotePrivate";
161 unset($fieldstosearchall[
'fd.description']);
166 'f.ref' => array(
'label' =>
'Ref',
'checked' =>
'1'),
167 'f.ref_client' => array(
'label' =>
'RefCustomer',
'checked' =>
'1'),
168 's.nom' => array(
'label' =>
'ThirdParty',
'checked' =>
'1'),
169 'pr.ref' => array(
'label' =>
'Project',
'checked' =>
'1',
'enabled' => (!
isModEnabled(
'project') ?
'0' :
'1')),
170 'c.ref' => array(
'label' =>
'Contract',
'checked' =>
'1',
'enabled' => (empty(
$conf->contrat->enabled) ?
'0' :
'1')),
171 'f.description' => array(
'label' =>
'Description',
'checked' =>
'1'),
172 'f.datec' => array(
'label' =>
'DateCreation',
'checked' =>
'0',
'position' => 500),
173 'f.tms' => array(
'label' =>
'DateModificationShort',
'checked' =>
'0',
'position' => 500),
174 'f.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'position' => 510,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
175 'f.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'position' => 511,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
176 'f.fk_statut' => array(
'label' =>
'Status',
'checked' =>
'1',
'position' => 1000),
177 'f.signed_status' => array(
'label' =>
'SignedStatus',
'checked' =>
'0',
'position' => 1001),
178 'fd.description' => array(
'label' =>
"DescriptionOfLine",
'checked' =>
'1',
'enabled' =>
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') !=
'1' ?
'1' :
'0'),
179 'fd.date' => array(
'label' =>
'DateOfLine',
'checked' =>
'1',
'enabled' =>
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') !=
'1' ?
'1' :
'0'),
180 'fd.duree' => array(
'label' =>
'DurationOfLine',
'type' =>
'duration',
'checked' =>
'1',
'enabled' => !
getDolGlobalString(
'FICHINTER_DISABLE_DETAILS') ?
'1' :
'0'),
183include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
191 $socid = $user->socid;
195$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
196$permissiontoread = $user->hasRight(
'ficheinter',
'lire');
197$permissiontoadd = $user->hasRight(
'ficheinter',
'creer');
198$permissiontodelete = $user->hasRight(
'ficheinter',
'supprimer');
205if (
GETPOST(
'cancel',
'alpha')) {
209if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
213$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
214$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
219if (empty($reshook)) {
221 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
224 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
226 $search_ref_client =
"";
227 $searchCategoryFichinterList = array();
228 $search_company =
"";
229 $search_projet_ref =
"";
230 $search_contrat_ref =
"";
233 $search_signed_status =
'';
234 $search_date_startday =
'';
235 $search_date_startmonth =
'';
236 $search_date_startyear =
'';
237 $search_date_endday =
'';
238 $search_date_endmonth =
'';
239 $search_date_endyear =
'';
240 $search_date_start =
'';
241 $search_date_end =
'';
243 $search_array_options = array();
247 $objectclass =
'Fichinter';
248 $objectlabel =
'Interventions';
249 $uploaddir =
$conf->ficheinter->dir_output;
250 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
265$contratstatic =
null;
275$title = $langs->trans(
"Interventions");
281$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
282$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
284$atleastonefieldinlines = 0;
285foreach ($arrayfields as $tmpkey => $tmpval) {
286 if (preg_match(
'/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey][
'checked'])) {
287 $atleastonefieldinlines++;
293$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,";
295 $sql .=
" fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
297$sql .=
" s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
299 $sql .=
", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
302 $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";
305if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
306 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
307 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
311$parameters = array();
312$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
313$sql .= $hookmanager->resPrint;
317$sql .=
" FROM ".MAIN_DB_PREFIX.
"fichinter as f";
319 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as pr on f.fk_projet = pr.rowid";
322 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"contrat as c on f.fk_contrat = c.rowid";
324if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
325 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (f.rowid = ef.fk_object)";
328 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"fichinterdet as fd ON fd.fk_fichinter = f.rowid";
332$parameters = array();
333$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
334$sql .= $hookmanager->resPrint;
336$sql .=
", ".MAIN_DB_PREFIX.
"societe as s";
337$sql .=
" WHERE f.entity IN (".getEntity(
'intervention').
")";
338$sql .=
" AND f.fk_soc = s.rowid";
342if ($search_ref_client) {
345if ($search_company) {
348if ($search_projet_ref) {
351if ($search_contrat_ref) {
356 $sql .=
natural_search(array(
'f.description',
'fd.description'), $search_desc);
362if (!empty($searchCategoryFichinterList)) {
363 $searchCategoryFichinterSqlList = array();
364 $listofcategoryid =
'';
365 foreach ($searchCategoryFichinterList as $searchCategoryFichinter) {
366 if (intval($searchCategoryFichinter) == -2) {
367 $searchCategoryFichinterSqlList[] =
"NOT EXISTS (SELECT ck.fk_fichinter FROM ".MAIN_DB_PREFIX.
"categorie_fichinter as ck WHERE f.rowid = ck.fk_fichinter)";
368 } elseif (intval($searchCategoryFichinter) > 0) {
369 if ($searchCategoryFichinterOperator == 0) {
370 $searchCategoryFichinterSqlList[] =
" EXISTS (SELECT ck.fk_fichinter FROM ".MAIN_DB_PREFIX.
"categorie_fichinter as ck WHERE f.rowid = ck.fk_fichinter AND ck.fk_categorie = ".((int) $searchCategoryFichinter).
")";
372 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryFichinter);
376 if ($listofcategoryid) {
377 $searchCategoryFichinterSqlList[] =
" EXISTS (SELECT ck.fk_fichinter FROM ".MAIN_DB_PREFIX.
"categorie_fichinter as ck WHERE f.rowid = ck.fk_fichinter AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
379 if ($searchCategoryFichinterOperator == 1) {
380 if (!empty($searchCategoryFichinterSqlList)) {
381 $sql .=
" AND (".implode(
' OR ', $searchCategoryFichinterSqlList).
")";
384 if (!empty($searchCategoryFichinterSqlList)) {
385 $sql .=
" AND (".implode(
' AND ', $searchCategoryFichinterSqlList).
")";
389if ($search_status !=
'' && $search_status >= 0) {
390 $sql .=
' AND f.fk_statut = '.((int) ($search_status));
392if ($search_signed_status !=
'' && $search_signed_status >= 0) {
393 $sql .=
' AND f.signed_status = '.((int) $search_signed_status);
396 if ($search_date_start) {
397 $sql .=
" AND fd.date >= '".$db->idate($search_date_start).
"'";
399 if ($search_date_end) {
400 $sql .=
" AND fd.date <= '".$db->idate($search_date_end).
"'";
404 $sql .=
" AND s.rowid = ".((int) $socid);
407if (empty($user->socid) && !$permissiontoreadallthirdparty) {
408 $sql .=
" AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $user->id).
")";
410 $sql .=
" OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user IN (".
$db->sanitize(implode(
',', $userschilds)).
"))";
416 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
428include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
430$parameters = array();
431$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
432$sql .= $hookmanager->resPrint;
434$parameters = array(
'search_all' => $search_all,
'fieldstosearchall' => $fieldstosearchall);
435$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
436$sql .= $hookmanager->resPrint;
439$nbtotalofrecords =
'';
442 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
443 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
444 $resql =
$db->query($sqlforcount);
446 $objforcount =
$db->fetch_object($resql);
447 $nbtotalofrecords = $objforcount->nbtotalofrecords;
452 if (($page * $limit) > (
int) $nbtotalofrecords) {
460$sql .=
$db->order($sortfield, $sortorder);
462 $sql .=
$db->plimit($limit + 1, $offset);
465$resql =
$db->query($sql);
471$num =
$db->num_rows($resql);
475if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
476 $obj =
$db->fetch_object($resql);
486foreach ($searchCategoryFichinterList as $searchCategoryFichinter) {
487 $paramsCat .=
"&search_category_fichinter_list[]=".urlencode($searchCategoryFichinter);
490llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-fichinter page-list');
493$arrayofselected = is_array($toselect) ? $toselect : array();
498 if (empty($search_company)) {
499 $search_company = $soc->name;
505 $param .=
'&mode='.urlencode($mode);
507if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
508 $param .=
'&contextpage='.urlencode($contextpage);
510if ($limit > 0 && $limit !=
$conf->liste_limit) {
511 $param .=
'&limit='.((int) $limit);
514 $param .=
"&search_all=".urlencode($search_all);
517 $param .=
"&socid=".urlencode((
string) ($socid));
519if ($searchCategoryFichinterOperator == 1) {
520 $param .=
"&search_category_fichinter_operator=".urlencode((
string) $searchCategoryFichinterOperator);
522foreach ($searchCategoryFichinterList as $searchCategoryFichinter) {
523 $param .=
"&search_category_fichinter_list[]=".urlencode($searchCategoryFichinter);
526 $param .=
"&search_ref=".urlencode($search_ref);
528if ($search_ref_client) {
529 $param .=
"&search_ref_client=".urlencode($search_ref_client);
531if ($search_company) {
532 $param .=
"&search_company=".urlencode($search_company);
535 $param .=
"&search_desc=".urlencode($search_desc);
537if ($search_status !=
'' && $search_status > -1) {
538 $param .=
"&search_status=".urlencode($search_status);
540if ($search_signed_status !=
'' && $search_signed_status >= 0) {
541 $param .=
'&search_signed_status='.urlencode($search_signed_status);
543if ($search_date_startday > 0) {
544 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
546if ($search_date_startmonth > 0) {
547 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
549if ($search_date_startyear > 0) {
550 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
552if ($search_date_endday > 0) {
553 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
555if ($search_date_endmonth > 0) {
556 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
558if ($search_date_endyear > 0) {
559 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
562 $param .=
'&show_files='.urlencode((
string) ($show_files));
564if ($optioncss !=
'') {
565 $param .=
'&optioncss='.urlencode($optioncss);
568include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
570$parameters = array(
'param' => &$param);
571$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
572$param .= $hookmanager->resPrint;
575$arrayofmassactions = array(
576 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
577 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
580if (!empty($permissiontodelete)) {
581 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
583if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'creer')) {
584 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
586if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag'))) {
587 $arrayofmassactions = array();
589$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
592print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
593if ($optioncss !=
'') {
594 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
596print
'<input type="hidden" name="token" value="'.newToken().
'">';
597print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
598print
'<input type="hidden" name="action" value="list">';
599print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
600print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
601print
'<input type="hidden" name="page" value="'.$page.
'">';
602print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
603print
'<input type="hidden" name="page_y" value="">';
604print
'<input type="hidden" name="mode" value="'.$mode.
'">';
607$url = DOL_URL_ROOT.
'/fichinter/card.php?action=create';
609 $url .=
'&socid='.$socid;
612$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'));
613$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'));
614$newcardbutton .= dolGetButtonTitleSeparator();
615$newcardbutton .= dolGetButtonTitle($langs->trans(
'NewIntervention'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'ficheinter',
'creer'));
617print_barre_liste($title, $page, $_SERVER[
'PHP_SELF'], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
619$topicmail =
"Information";
620$modelmail =
"intervention";
622$trackid =
'int'.$object->id;
623include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
626 print
"<div id='ways'>";
628 $ways =
$c->print_all_ways(
' > ',
'fichinter/list.php');
629 print
" > ".$ways[0].
"<br>\n";
635 foreach ($fieldstosearchall as $key => $val) {
636 $fieldstosearchall[$key] = $langs->trans($val);
637 $setupstring .= $key.
"=".$val.
";";
639 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
640 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
645if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire')) {
647 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_FICHINTER, $searchCategoryFichinterList,
'minwidth300', $searchCategoryFichinterOperator ? $searchCategoryFichinterOperator : 0);
649$parameters = array();
650$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
651if (empty($reshook)) {
652 $moreforfilter .= $hookmanager->resPrint;
654 $moreforfilter = $hookmanager->resPrint;
657if (!empty($moreforfilter)) {
658 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
659 print $moreforfilter;
663$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
664$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
665$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
666$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
668print
'<div class="div-table-responsive">';
669print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
673print
'<tr class="liste_titre_filter">';
675if (
$conf->main_checkbox_left_column) {
676 print
'<td class="liste_titre center maxwidthsearch">';
677 $searchpicto = $form->showFilterButtons(
'left');
681if (!empty($arrayfields[
'f.ref'][
'checked'])) {
682 print
'<td class="liste_titre">';
683 print
'<input type="text" class="flat" name="search_ref" value="'.$search_ref.
'" size="8">';
686if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
687 print
'<td class="liste_titre">';
688 print
'<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.
'" size="8">';
691if (!empty($arrayfields[
's.nom'][
'checked'])) {
692 print
'<td class="liste_titre">';
693 print
'<input type="text" class="flat" name="search_company" value="'.$search_company.
'" size="10">';
696if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
697 print
'<td class="liste_titre">';
698 print
'<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.
'" size="8">';
701if (!empty($arrayfields[
'c.ref'][
'checked'])) {
702 print
'<td class="liste_titre">';
703 print
'<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.
'" size="8">';
706if (!empty($arrayfields[
'f.description'][
'checked'])) {
707 print
'<td class="liste_titre">';
708 print
'<input type="text" class="flat" name="search_desc" value="'.$search_desc.
'" size="12">';
712include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
715$parameters = array(
'arrayfields' => $arrayfields);
716$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
717print $hookmanager->resPrint;
718if (!empty($arrayfields[
'f.datec'][
'checked'])) {
720 print
'<td class="liste_titre">';
723if (!empty($arrayfields[
'f.tms'][
'checked'])) {
725 print
'<td class="liste_titre">';
728if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
730 print
'<td class="liste_titre">';
733if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
735 print
'<td class="liste_titre">';
739if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
740 print
'<td class="liste_titre right parentonrightofpage">';
742 $object::STATUS_DRAFT => $langs->transnoentitiesnoconv(
'Draft'),
743 $object::STATUS_VALIDATED => $langs->transnoentitiesnoconv(
'Validated'),
744 $object::STATUS_BILLED => $langs->transnoentitiesnoconv(
'StatusInterInvoiced'),
745 $object::STATUS_CLOSED => $langs->transnoentitiesnoconv(
'Done'),
748 unset($liststatus[2]);
751 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status width100 onrightofpage');
755if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
756 print
'<td class="liste_titre center">';
757 $list_signed_status =
$object->getSignedStatusLocalisedArray();
758 print $form->selectarray(
'search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status');
762if (!empty($arrayfields[
'fd.description'][
'checked'])) {
763 print
'<td class="liste_titre"> </td>';
765if (!empty($arrayfields[
'fd.date'][
'checked'])) {
766 print
'<td class="liste_titre center">';
767 print
'<div class="nowrapfordate">';
768 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
770 print
'<div class="nowrapfordate">';
771 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
775if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
776 print
'<td class="liste_titre"> </td>';
779if (!
$conf->main_checkbox_left_column) {
780 print
'<td class="liste_titre center maxwidthsearch">';
781 $searchpicto = $form->showFilterButtons();
792print
'<tr class="liste_titre">';
794if (
$conf->main_checkbox_left_column) {
795 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
798if (!empty($arrayfields[
'f.ref'][
'checked'])) {
800 print_liste_field_titre($arrayfields[
'f.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref",
"", $param,
'', $sortfield, $sortorder);
803if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
804 print_liste_field_titre($arrayfields[
'f.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
"f.ref_client",
"", $param,
'', $sortfield, $sortorder);
807if (!empty($arrayfields[
's.nom'][
'checked'])) {
808 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
811if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
812 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"pr.ref",
"", $param,
'', $sortfield, $sortorder);
815if (!empty($arrayfields[
'c.ref'][
'checked'])) {
816 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
819if (!empty($arrayfields[
'f.description'][
'checked'])) {
820 print_liste_field_titre($arrayfields[
'f.description'][
'label'], $_SERVER[
"PHP_SELF"],
"f.description",
"", $param,
'', $sortfield, $sortorder);
824include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
826$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
827$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
828print $hookmanager->resPrint;
829if (!empty($arrayfields[
'f.datec'][
'checked'])) {
830 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
833if (!empty($arrayfields[
'f.tms'][
'checked'])) {
834 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
837if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
838 print_liste_field_titre($arrayfields[
'f.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_public",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
841if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
842 print_liste_field_titre($arrayfields[
'f.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"f.note_private",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
845if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
846 print_liste_field_titre($arrayfields[
'f.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"f.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
849if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
850 print_liste_field_titre($arrayfields[
'f.signed_status'][
'label'], $_SERVER[
"PHP_SELF"],
"f.signed_status",
"", $param,
'', $sortfield, $sortorder,
'center ');
853if (!empty($arrayfields[
'fd.description'][
'checked'])) {
857if (!empty($arrayfields[
'fd.date'][
'checked'])) {
858 print_liste_field_titre($arrayfields[
'fd.date'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.date",
"", $param,
'', $sortfield, $sortorder,
'center ');
861if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
862 print_liste_field_titre($arrayfields[
'fd.duree'][
'label'], $_SERVER[
"PHP_SELF"],
"fd.duree",
"", $param,
'', $sortfield, $sortorder,
'right ');
867if (!
$conf->main_checkbox_left_column) {
868 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
883$imaxinloop = ($limit ? min($num, $limit) : $num);
884while ($i < $imaxinloop) {
885 $obj =
$db->fetch_object($resql);
893 $objectstatic->id = $obj->rowid;
894 $objectstatic->ref = $obj->ref;
895 $objectstatic->ref_client = $obj->ref_client;
896 $objectstatic->statut = $obj->status;
897 $objectstatic->status = $obj->status;
898 $objectstatic->signed_status = $obj->signed_status;
900 $companystatic->name = $obj->name;
901 $companystatic->id = $obj->socid;
902 $companystatic->client = $obj->client;
903 $companystatic->fournisseur = $obj->fournisseur;
904 $companystatic->email = $obj->email;
905 $companystatic->status = $obj->thirdpartystatus;
908 if ($mode ==
'kanban') {
910 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
911 print
'<div class="box-flex-container kanban">';
915 if ($massactionbutton || $massaction) {
917 if (in_array(
$object->id, $arrayofselected)) {
922 $objectstatic->duration = $obj->duree;
923 $arraydata = array();
924 $arraydata[
'thirdparty'] = $companystatic;
925 print $objectstatic->getKanbanView(
'', $arraydata);
926 if ($i == ($imaxinloop - 1)) {
933 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
935 if (
$conf->main_checkbox_left_column) {
936 print
'<td class="nowrap center">';
937 if ($massactionbutton || $massaction) {
939 if (in_array($obj->rowid, $arrayofselected)) {
942 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
951 if (!empty($arrayfields[
'f.ref'][
'checked'])) {
954 print
'<table class="nobordernopadding"><tr class="nocellnopadd">';
955 print
'<td class="nobordernopadding nowraponall">';
956 print $objectstatic->getNomUrl(1);
961 if (!empty($obj->note_private)) {
962 $warnornote .= ($warnornote ?
' ' :
'');
963 $warnornote .=
'<span class="note">';
964 $warnornote .=
'<a href="note.php?id='.$obj->rowid.
'">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'object_generic').
'</a>';
965 $warnornote .=
'</span>';
968 print
'<td style="min-width: 20px" class="nobordernopadding nowrap">';
974 print
'<td width="16" class="right nobordernopadding hideonsmartphone">';
977 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
978 print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
979 print
'</td></tr></table>';
988 if (!empty($arrayfields[
'f.ref_client'][
'checked'])) {
989 print
'<td class="nowrap tdoverflowmax200">';
997 if (!empty($arrayfields[
's.nom'][
'checked'])) {
998 print
'<td class="tdoverflowmax125">';
999 print $companystatic->getNomUrl(1,
'', 44);
1006 if (!empty($arrayfields[
'pr.ref'][
'checked']) && $projetstatic !==
null) {
1007 print
'<td class="tdoverflowmax150">';
1008 $projetstatic->id = $obj->projet_id;
1009 $projetstatic->ref = $obj->projet_ref;
1010 $projetstatic->title = $obj->projet_title;
1011 if ($projetstatic->id > 0) {
1012 print $projetstatic->getNomUrl(1,
'');
1020 if (!empty($arrayfields[
'c.ref'][
'checked']) && $contratstatic !==
null) {
1021 print
'<td class="tdoverflowmax150">';
1022 $contratstatic->id = $obj->contrat_id;
1023 $contratstatic->ref = $obj->contrat_ref;
1024 $contratstatic->ref_customer = $obj->contrat_ref_customer;
1025 $contratstatic->ref_supplier = $obj->contrat_ref_supplier;
1026 if ($contratstatic->id > 0) {
1027 print $contratstatic->getNomUrl(1, 0);
1034 if (!empty($arrayfields[
'f.description'][
'checked'])) {
1042 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1044 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
1045 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1046 print $hookmanager->resPrint;
1048 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1049 print
'<td class="center nowraponall">';
1057 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1058 print
'<td class="center nowraponall">';
1066 if (!empty($arrayfields[
'f.note_public'][
'checked'])) {
1067 print
'<td class="sensiblehtmlcontent center">';
1068 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
1075 if (!empty($arrayfields[
'f.note_private'][
'checked'])) {
1076 print
'<td class="sensiblehtmlcontent center">';
1077 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
1084 if (!empty($arrayfields[
'f.fk_statut'][
'checked'])) {
1085 print
'<td class="center">'.$objectstatic->getLibStatut(5).
'</td>';
1091 if (!empty($arrayfields[
'f.signed_status'][
'checked'])) {
1092 print
'<td class="center">'.$objectstatic->getLibSignedStatus(5).
'</td>';
1098 if (!empty($arrayfields[
'fd.description'][
'checked'])) {
1101 print
'<div class="classfortooltip tdoverflowmax250 small" title="'.dol_escape_htmltag($obj->descriptiondetail, 1, 1).
'">';
1110 if (!empty($arrayfields[
'fd.date'][
'checked'])) {
1111 print
'<td class="center nowraponall" title="'.dol_print_date(
$db->jdate($obj->dp),
'dayhour').
'">'.
dol_print_date(
$db->jdate($obj->dp),
'dayhour').
"</td>\n";
1117 if (!empty($arrayfields[
'fd.duree'][
'checked'])) {
1118 print
'<td class="right">'.convertSecondToTime($obj->duree,
'allhourmin').
'</td>';
1131 if (!
$conf->main_checkbox_left_column) {
1132 print
'<td class="nowrap center">';
1133 if ($massactionbutton || $massaction) {
1135 if (in_array($obj->rowid, $arrayofselected)) {
1138 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1148 $total += (isset($obj->duree) ? $obj->duree : 0);
1155include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1160 foreach ($arrayfields as $key => $val) {
1161 if (!empty($val[
'checked'])) {
1165 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1170$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1171$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1172print $hookmanager->resPrint;
1174print
'</table>'.
"\n";
1177print
'</form>'.
"\n";
1179if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1180 $hidegeneratedfilelistifempty = 1;
1181 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1182 $hidegeneratedfilelistifempty = 0;
1185 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1189 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1190 $urlsource .= str_replace(
'&',
'&', $param);
1192 $filedir = $diroutputmassaction;
1193 $genallowed = $permissiontoread;
1194 $delallowed = $permissiontoadd;
1196 print $formfile->showdocuments(
'massfilesarea_interventions',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 categories.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_now($mode='gmt')
Return date for now.
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_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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, $allowothertags=array())
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.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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.