27require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39require_once __DIR__.
'/class/triggerhistory.class.php';
43$langs->loadLangs(array(
"webhook@webhook",
"other",
"admin"));
46$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
47$massaction =
GETPOST(
'massaction',
'alpha');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array:int');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$optioncss =
GETPOST(
'optioncss',
'aZ');
56$groupby =
GETPOST(
'groupby',
'aZ09');
63$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
64$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
66if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
70$offset = $limit * $page;
77$diroutputmassaction = $conf->webhook->dir_output.
'/temp/massgeneration/'.$user->id;
78$hookmanager->initHooks(array($contextpage));
81$extrafields->fetch_name_optionals_label(
$object->table_element);
84$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
89 $sortfield =
"t.".key(
$object->fields);
96$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
98foreach (
$object->fields as $key => $val) {
99 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
100 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
102 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
108$fieldstosearchall = array();
125$arrayfields = array();
126foreach (
$object->fields as $key => $val) {
128 if (!empty($val[
'visible'])) {
129 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
130 $arrayfields[$tableprefix.
'.'.$key] = array(
131 'label' => $val[
'label'],
132 'checked' => (($visible < 0) ?
'0' :
'1'),
133 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
134 'position' => $val[
'position'],
135 'help' => isset($val[
'help']) ? $val[
'help'] :
''
140include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
148$permissiontoread = $permissiontoadd = $permissiontodelete = (!empty($user->admin) ? 1 : 0);
151if ($user->socid > 0) {
161if (!$permissiontoread) {
170if (
GETPOST(
'cancel',
'alpha')) {
174if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
178$parameters = array(
'arrayfields' => &$arrayfields);
179$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
184if (empty($reshook)) {
186 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
189 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
190 foreach (
$object->fields as $key => $val) {
192 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
193 $search[$key.
'_dtstart'] =
'';
194 $search[$key.
'_dtend'] =
'';
199 $search_array_options = array();
201 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
202 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
207 $objectclass =
'TriggerHistory';
208 $objectlabel =
'TriggerHistory';
209 $uploaddir = $conf->webhook->dir_output;
212 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
224$form =
new Form($db);
228$title = $langs->trans(
"");
238$sql .=
" ".$object->getFieldList(
't');
240if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
241 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
242 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
246$parameters = array();
247$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
248$sql .= $hookmanager->resPrint;
249$sql = preg_replace(
'/,\s*$/',
'', $sql);
253$sql .=
" FROM ".$db->prefix().$object->table_element.
" as t";
255if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
256 $sql .=
" LEFT JOIN ".$db->prefix().$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
259$parameters = array();
260$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
261$sql .= $hookmanager->resPrint;
262if (
$object->ismultientitymanaged == 1) {
263 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
265 $sql .=
" WHERE 1 = 1";
267foreach ($search as $key => $val) {
268 if (array_key_exists($key,
$object->fields)) {
269 if ($key ==
'status' && $search[$key] == -1) {
272 $field_spec =
$object->fields[$key];
273 if ($field_spec ===
null) {
276 $mode_search = ((
$object->isInt($field_spec) ||
$object->isFloat($field_spec)) ? 1 : 0);
277 if ((strpos($field_spec[
'type'],
'integer:') === 0) || (strpos($field_spec[
'type'],
'sellist:') === 0) || !empty($field_spec[
'arrayofkeyval'])) {
278 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($field_spec[
'arrayofkeyval']) || !array_key_exists(
'0', $field_spec[
'arrayofkeyval'])))) {
283 if ($field_spec[
'type'] ===
'boolean') {
285 if ($search[$key] ==
'-1') {
289 if (empty($field_spec[
'searchmulti'])) {
290 if (!is_array($search[$key]) && $search[$key] !=
'') {
291 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
294 if (is_array($search[$key]) && !empty($search[$key])) {
295 $sql .=
natural_search(
"t.".$db->escape($key), implode(
',', $search[$key]), (($key ==
'status') ? 2 : $mode_search));
299 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
300 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
301 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
302 if (preg_match(
'/_dtstart$/', $key)) {
303 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
305 if (preg_match(
'/_dtend$/', $key)) {
306 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
313 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
336include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
338$parameters = array();
339$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
340$sql .= $hookmanager->resPrint;
368$nbtotalofrecords =
'';
371 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
372 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
374 $resql = $db->query($sqlforcount);
376 $objforcount = $db->fetch_object($resql);
377 $nbtotalofrecords = $objforcount->nbtotalofrecords;
382 if (($page * $limit) > $nbtotalofrecords) {
390$sql .= $db->order($sortfield, $sortorder);
392 $sql .= $db->plimit($limit + 1, $offset);
395$resql = $db->query($sql);
401$num = $db->num_rows($resql);
405if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
406 $obj = $db->fetch_object($resql);
408 header(
"Location: ".
dol_buildpath(
'/webhook/history_card.php', 1).
'?id='.((
int) $id));
416llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-webhook page-list bodyforlist');
418if ($mode ==
'modulesetup') {
419 require_once DOL_DOCUMENT_ROOT.
'/webhook/lib/webhook.lib.php';
423 $page_name =
"WebhookSetup";
425 $linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
426 print
load_fiche_titre($langs->trans($page_name), $linkback,
'title_setup');
429 print
dol_get_fiche_head($head,
'triggerhistory', $langs->trans($page_name), -1,
"webhook");
446$arrayofselected = is_array($toselect) ? $toselect : array();
450 $param .=
'&mode='.urlencode($mode);
452if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
453 $param .=
'&contextpage='.urlencode($contextpage);
455if ($limit > 0 && $limit != $conf->liste_limit) {
456 $param .=
'&limit='.((int) $limit);
458if ($optioncss !=
'') {
459 $param .=
'&optioncss='.urlencode($optioncss);
462 $param .=
'&groupby='.urlencode($groupby);
464foreach ($search as $key => $val) {
465 if (is_array($search[$key])) {
466 foreach ($search[$key] as $skey) {
468 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
471 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
472 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
473 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
474 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
475 } elseif ($search[$key] !=
'') {
476 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
480include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
482$parameters = array(
'param' => &$param);
483$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
484$param .= $hookmanager->resPrint;
487$arrayofmassactions = array(
493if (!empty($permissiontodelete)) {
494 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
496if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
497 $arrayofmassactions = array();
499$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
501print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
502if ($optioncss !=
'') {
503 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
505print
'<input type="hidden" name="token" value="'.newToken().
'">';
506print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
507print
'<input type="hidden" name="action" value="list">';
508print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
509print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
510print
'<input type="hidden" name="page" value="'.$page.
'">';
511print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
512print
'<input type="hidden" name="page_y" value="">';
513print
'<input type="hidden" name="mode" value="'.$mode.
'">';
517$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
518$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
524print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
527$topicmail =
"SendHistoryRef";
528$modelmail =
"triggerhistory";
530$trackid =
'xxxx'.$object->id;
531include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
536 foreach ($fieldstosearchall as $key => $val) {
537 $fieldstosearchall[$key] = $langs->trans($val);
538 $setupstring .= $key.
"=".$val.
";";
540 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
541 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
549$parameters = array();
550$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
551if (empty($reshook)) {
552 $moreforfilter .= $hookmanager->resPrint;
554 $moreforfilter = $hookmanager->resPrint;
557 'arrayfields' => &$arrayfields,
560if (!empty($moreforfilter)) {
561 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
562 print $moreforfilter;
566$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
567$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);
568$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
569$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
571print
'<div class="div-table-responsive">';
572print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
576print
'<tr class="liste_titre_filter">';
578if ($conf->main_checkbox_left_column) {
579 print
'<td class="liste_titre center maxwidthsearch">';
580 $searchpicto = $form->showFilterButtons(
'left');
584foreach (
$object->fields as $key => $val) {
586 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
587 if ($key ==
'status') {
588 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
589 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
590 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
591 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
592 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
593 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
594 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
596 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
597 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
598 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
599 if (empty($val[
'searchmulti'])) {
600 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
602 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
604 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
605 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
606 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
607 print
'<div class="nowrap">';
608 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
610 print
'<div class="nowrap">';
611 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
613 } elseif ($key ==
'lang') {
614 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
616 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
617 } elseif ($val[
'type'] ===
'boolean') {
618 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
620 print
'<input type="text" class="flat maxwidth'.(in_array($val[
'type'], array(
'integer',
'price')) ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
626include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
629$parameters = array(
'arrayfields' => $arrayfields);
630$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
631print $hookmanager->resPrint;
636if (!$conf->main_checkbox_left_column) {
637 print
'<td class="liste_titre center maxwidthsearch">';
638 $searchpicto = $form->showFilterButtons();
649print
'<tr class="liste_titre">';
651if ($conf->main_checkbox_left_column) {
652 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
655foreach (
$object->fields as $key => $val) {
656 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
657 if ($key ==
'status') {
658 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
659 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
660 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
661 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
662 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
663 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
664 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
666 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
667 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
668 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
''), 0, (empty($val[
'helplist']) ?
'' : $val[
'helplist'])).
"\n";
673include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
675$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
676$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
677print $hookmanager->resPrint;
683if (!$conf->main_checkbox_left_column) {
684 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
690$needToFetchEachLine = 0;
691if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
692 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
693 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
694 $needToFetchEachLine++;
706$imaxinloop = ($limit ? min($num, $limit) : $num);
707while ($i < $imaxinloop) {
708 $obj = $db->fetch_object($resql);
714 $object->setVarsFromFetchObj($obj);
730 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
732 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
733 print
'<div class="box-flex-container kanban">';
737 if ($massactionbutton || $massaction) {
739 if (in_array(
$object->id, $arrayofselected)) {
744 print
$object->getKanbanView(
'', array(
'selected' => $selected));
745 if ($i == ($imaxinloop - 1)) {
752 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
755 if ($conf->main_checkbox_left_column) {
756 print
'<td class="nowrap center">';
757 if ($massactionbutton || $massaction) {
759 if (in_array(
$object->id, $arrayofselected)) {
762 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
770 foreach (
$object->fields as $key => $val) {
771 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
772 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
773 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
774 } elseif ($key ==
'status') {
775 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
778 if (in_array($val[
'type'], array(
'timestamp'))) {
779 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
780 } elseif ($key ==
'ref') {
781 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
784 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
785 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
789 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
790 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
791 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
792 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
795 if ($key ==
'status') {
796 print
$object->getLibStatut(5);
797 } elseif ($key ==
'rowid') {
798 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
800 print
$object->showOutputField($val, $key, (
string)
$object->$key,
'');
806 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
810 if (!isset($totalarray[
'val'])) {
813 if (!isset($totalarray[
'val'][
't.'.$key])) {
821 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
823 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
824 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
825 print $hookmanager->resPrint;
832 if (empty($conf->main_checkbox_left_column)) {
833 print
'<td class="nowrap center">';
834 if ($massactionbutton || $massaction) {
836 if (in_array(
$object->id, $arrayofselected)) {
839 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
854include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
859 foreach ($arrayfields as $key => $val) {
860 if (!empty($val[
'checked'])) {
864 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
870$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
871$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
872print $hookmanager->resPrint;
874print
'</table>'.
"\n";
879if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
880 $hidegeneratedfilelistifempty = 1;
881 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
882 $hidegeneratedfilelistifempty = 0;
885 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
889 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
890 $urlsource .= str_replace(
'&',
'&', $param);
892 $filedir = $diroutputmassaction;
893 $genallowed = $permissiontoread;
894 $delallowed = $permissiontoadd;
896 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $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.
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_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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
webhookAdminPrepareHead()
Prepare admin pages header.