51if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
52 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
55$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
56$tmp2 = realpath(__FILE__);
58$j = strlen($tmp2) - 1;
59while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
63if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
64 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
66if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
67 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
70if (!$res && file_exists(
"../main.inc.php")) {
71 $res = @include
"../main.inc.php";
73if (!$res && file_exists(
"../../main.inc.php")) {
74 $res = @include
"../../main.inc.php";
76if (!$res && file_exists(
"../../../main.inc.php")) {
77 $res = @include
"../../../main.inc.php";
80 die(
"Include of main fails");
83require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
84require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
85require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
87require_once __DIR__.
'/class/myobject.class.php';
100$langs->loadLangs(array(
"mymodule@mymodule",
"other"));
103$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
104$massaction =
GETPOST(
'massaction',
'alpha');
106$confirm =
GETPOST(
'confirm',
'alpha');
107$cancel =
GETPOST(
'cancel',
'alpha');
108$toselect =
GETPOST(
'toselect',
'array:int');
109$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
110$backtopage =
GETPOST(
'backtopage',
'alpha');
111$optioncss =
GETPOST(
'optioncss',
'aZ');
113$groupby =
GETPOST(
'groupby',
'aZ09');
120$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
121$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
123if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
127$offset = $limit * $page;
128$pageprev = $page - 1;
129$pagenext = $page + 1;
134$diroutputmassaction =
$conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
135$hookmanager->initHooks(array($contextpage));
138$extrafields->fetch_name_optionals_label(
$object->table_element);
141$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
146 $sortfield =
"t.".key(
$object->fields);
153$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
155foreach (
$object->fields as $key => $val) {
156 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
157 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
159 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
166$fieldstosearchall = array();
182$arrayfields = array();
183foreach (
$object->fields as $key => $val) {
185 if (!empty($val[
'visible'])) {
186 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
187 $arrayfields[$tableprefix.
'.'.$key] = array(
188 'label' => $val[
'label'],
189 'checked' => (($visible < 0) ?
'0' :
'1'),
190 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
191 'position' => $val[
'position'],
192 'help' => isset($val[
'help']) ? $val[
'help'] :
''
197include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
205$enablepermissioncheck =
getDolGlobalInt(
'MYMODULE_ENABLE_PERMISSION_CHECK');
206if ($enablepermissioncheck) {
207 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
208 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
209 $permissiontodelete = $user->hasRight(
'mymodule',
'myobject',
'delete');
211 $permissiontoread = 1;
212 $permissiontoadd = 1;
213 $permissiontodelete = 1;
217if ($user->socid > 0) {
224if (!isModEnabled(
"mymodule")) {
227if (!$permissiontoread) {
236if (
GETPOST(
'cancel',
'alpha')) {
240if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
244$parameters = array(
'arrayfields' => &$arrayfields);
245$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
250if (empty($reshook)) {
252 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
255 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
256 foreach (
$object->fields as $key => $val) {
258 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
259 $search[$key.
'_dtstart'] =
'';
260 $search[$key.
'_dtend'] =
'';
265 $search_array_options = array();
267 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
268 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
273 $objectclass =
'MyObject';
274 $objectlabel =
'MyObject';
275 $uploaddir =
$conf->mymodule->dir_output;
278 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
290$form =
new Form($db);
294$title = $langs->trans(
"MyObjects");
304$sql .=
" ".$object->getFieldList(
't');
306if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
307 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
308 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
312$parameters = array();
313$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
314$sql .= $hookmanager->resPrint;
315$sql = preg_replace(
'/,\s*$/',
'', $sql);
319$sql .=
" FROM ".$db->prefix().$object->table_element.
" as t";
321if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
322 $sql .=
" LEFT JOIN ".$db->prefix().$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
325$parameters = array();
326$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
327$sql .= $hookmanager->resPrint;
328if (
$object->ismultientitymanaged == 1) {
329 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
331 $sql .=
" WHERE 1 = 1";
333foreach ($search as $key => $val) {
334 if (array_key_exists($key,
$object->fields)) {
335 if ($key ==
'status' && $search[$key] == -1) {
338 $field_spec =
$object->fields[$key];
339 if ($field_spec ===
null) {
342 $mode_search = ((
$object->isInt($field_spec) ||
$object->isFloat($field_spec)) ? 1 : 0);
343 if ((strpos($field_spec[
'type'],
'integer:') === 0) || (strpos($field_spec[
'type'],
'sellist:') === 0) || !empty($field_spec[
'arrayofkeyval'])) {
344 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($field_spec[
'arrayofkeyval']) || !array_key_exists(
'0', $field_spec[
'arrayofkeyval'])))) {
349 if ($field_spec[
'type'] ===
'boolean') {
351 if ($search[$key] ==
'-1') {
355 if (empty($field_spec[
'searchmulti'])) {
356 if (!is_array($search[$key]) && $search[$key] !=
'') {
357 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
360 if (is_array($search[$key]) && !empty($search[$key])) {
361 $sql .=
natural_search(
"t.".$db->escape($key), implode(
',', $search[$key]), (($key ==
'status') ? 2 : $mode_search));
365 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
366 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
367 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
368 if (preg_match(
'/_dtstart$/', $key)) {
369 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
371 if (preg_match(
'/_dtend$/', $key)) {
372 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
379 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
402include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
404$parameters = array();
405$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
406$sql .= $hookmanager->resPrint;
434$nbtotalofrecords =
'';
437 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
438 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
440 $resql = $db->query($sqlforcount);
442 $objforcount = $db->fetch_object($resql);
443 $nbtotalofrecords = $objforcount->nbtotalofrecords;
448 if (($page * $limit) > $nbtotalofrecords) {
456$sql .= $db->order($sortfield, $sortorder);
458 $sql .= $db->plimit($limit + 1, $offset);
461$resql = $db->query($sql);
467$num = $db->num_rows($resql);
471if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
472 $obj = $db->fetch_object($resql);
474 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
482llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
499$arrayofselected = is_array($toselect) ? $toselect : array();
503 $param .=
'&mode='.urlencode($mode);
505if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
506 $param .=
'&contextpage='.urlencode($contextpage);
508if ($limit > 0 && $limit !=
$conf->liste_limit) {
509 $param .=
'&limit='.((int) $limit);
511if ($optioncss !=
'') {
512 $param .=
'&optioncss='.urlencode($optioncss);
515 $param .=
'&groupby='.urlencode($groupby);
517foreach ($search as $key => $val) {
518 if (is_array($search[$key])) {
519 foreach ($search[$key] as $skey) {
521 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
524 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
525 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
526 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
527 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
528 } elseif ($search[$key] !=
'') {
529 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
533include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
535$parameters = array(
'param' => &$param);
536$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
537$param .= $hookmanager->resPrint;
540$arrayofmassactions = array(
546if (!empty($permissiontodelete)) {
547 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
549if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
550 $arrayofmassactions = array();
552$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
554print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
555if ($optioncss !=
'') {
556 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
558print
'<input type="hidden" name="token" value="'.newToken().
'">';
559print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
560print
'<input type="hidden" name="action" value="list">';
561print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
562print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
563print
'<input type="hidden" name="page" value="'.$page.
'">';
564print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
565print
'<input type="hidden" name="page_y" value="">';
566print
'<input type="hidden" name="mode" value="'.$mode.
'">';
570$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'));
571$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'));
575$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
577print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
580$topicmail =
"SendMyObjectRef";
581$modelmail =
"myobject";
583$trackid =
'xxxx'.$object->id;
584include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
589 foreach ($fieldstosearchall as $key => $val) {
590 $fieldstosearchall[$key] = $langs->trans($val);
591 $setupstring .= $key.
"=".$val.
";";
593 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
594 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
602$parameters = array();
603$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
604if (empty($reshook)) {
605 $moreforfilter .= $hookmanager->resPrint;
607 $moreforfilter = $hookmanager->resPrint;
610 'arrayfields' => &$arrayfields,
613if (!empty($moreforfilter)) {
614 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
615 print $moreforfilter;
619$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
620$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
621$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
622$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
624print
'<div class="div-table-responsive">';
625print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
629print
'<tr class="liste_titre_filter">';
631if (
$conf->main_checkbox_left_column) {
632 print
'<td class="liste_titre center maxwidthsearch">';
633 $searchpicto = $form->showFilterButtons(
'left');
637foreach (
$object->fields as $key => $val) {
639 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
640 if ($key ==
'status') {
641 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
642 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
643 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
644 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
645 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
646 } 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'])) {
647 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
649 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
650 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
651 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
652 if (empty($val[
'searchmulti'])) {
653 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);
655 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
657 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
658 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
659 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
660 print
'<div class="nowrap">';
661 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
663 print
'<div class="nowrap">';
664 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
666 } elseif ($key ==
'lang') {
667 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
669 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
670 } elseif ($val[
'type'] ===
'boolean') {
671 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
673 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] :
'').
'">';
679include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
682$parameters = array(
'arrayfields' => $arrayfields);
683$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
684print $hookmanager->resPrint;
689if (!
$conf->main_checkbox_left_column) {
690 print
'<td class="liste_titre center maxwidthsearch">';
691 $searchpicto = $form->showFilterButtons();
702print
'<tr class="liste_titre">';
704if (
$conf->main_checkbox_left_column) {
705 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
708foreach (
$object->fields as $key => $val) {
709 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
710 if ($key ==
'status') {
711 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
712 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
713 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
714 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
715 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
716 } 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'])) {
717 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
719 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
720 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
721 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";
726include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
728$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
729$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
730print $hookmanager->resPrint;
736if (!
$conf->main_checkbox_left_column) {
737 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
743$needToFetchEachLine = 0;
744if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
745 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
746 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
747 $needToFetchEachLine++;
759$imaxinloop = ($limit ? min($num, $limit) : $num);
760while ($i < $imaxinloop) {
761 $obj = $db->fetch_object($resql);
767 $object->setVarsFromFetchObj($obj);
783 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
785 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
786 print
'<div class="box-flex-container kanban">';
790 if ($massactionbutton || $massaction) {
792 if (in_array(
$object->id, $arrayofselected)) {
797 print
$object->getKanbanView(
'', array(
'selected' => $selected));
798 if ($i == ($imaxinloop - 1)) {
805 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
808 if (
$conf->main_checkbox_left_column) {
809 print
'<td class="nowrap center">';
810 if ($massactionbutton || $massaction) {
812 if (in_array(
$object->id, $arrayofselected)) {
815 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
823 foreach (
$object->fields as $key => $val) {
824 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
825 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
826 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
827 } elseif ($key ==
'status') {
828 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
831 if (in_array($val[
'type'], array(
'timestamp'))) {
832 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
833 } elseif ($key ==
'ref') {
834 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
837 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'])) {
838 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
842 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
843 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
844 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
845 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
848 if ($key ==
'status') {
849 print
$object->getLibStatut(5);
850 } elseif ($key ==
'rowid') {
851 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
853 if ($val[
'type'] ==
'html') {
854 print
'<div class="small lineheightsmall twolinesmax-normallineheight">';
856 print
$object->showOutputField($val, $key, (
string)
$object->$key,
'');
857 if ($val[
'type'] ==
'html') {
865 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
869 if (!isset($totalarray[
'val'])) {
872 if (!isset($totalarray[
'val'][
't.'.$key])) {
880 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
882 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
883 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
884 print $hookmanager->resPrint;
891 if (empty(
$conf->main_checkbox_left_column)) {
892 print
'<td class="nowrap center">';
893 if ($massactionbutton || $massaction) {
895 if (in_array(
$object->id, $arrayofselected)) {
898 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
913include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
918 foreach ($arrayfields as $key => $val) {
919 if (!empty($val[
'checked'])) {
923 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
929$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
930$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
931print $hookmanager->resPrint;
933print
'</table>'.
"\n";
938if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
939 $hidegeneratedfilelistifempty = 1;
940 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
941 $hidegeneratedfilelistifempty = 0;
944 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
948 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
949 $urlsource .= str_replace(
'&',
'&', $param);
951 $filedir = $diroutputmassaction;
952 $genallowed = $permissiontoread;
953 $delallowed = $permissiontoadd;
955 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( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_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.
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)
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_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.
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.