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']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
56while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
60if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
61 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
63if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
64 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
67if (!$res && file_exists(
"../main.inc.php")) {
68 $res = @include
"../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";
77 die(
"Include of main fails");
80require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
81require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
82require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
85require_once __DIR__.
'/class/myobject.class.php';
91$langs->loadLangs(array(
"mymodule@mymodule",
"other"));
94$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
95$massaction =
GETPOST(
'massaction',
'alpha');
96$show_files =
GETPOST(
'show_files',
'int');
97$confirm =
GETPOST(
'confirm',
'alpha');
98$cancel =
GETPOST(
'cancel',
'alpha');
99$toselect =
GETPOST(
'toselect',
'array');
100$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
101$backtopage =
GETPOST(
'backtopage',
'alpha');
102$optioncss =
GETPOST(
'optioncss',
'aZ');
109$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
110$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
111$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
113if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
117$offset = $limit * $page;
118$pageprev = $page - 1;
119$pagenext = $page + 1;
124$diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
125$hookmanager->initHooks(array($contextpage));
128$extrafields->fetch_name_optionals_label($object->table_element);
131$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
135 reset($object->fields);
136 $sortfield =
"t.".key($object->fields);
143$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
145foreach ($object->fields as $key => $val) {
146 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
147 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
149 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
150 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
151 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
155$fieldstosearchall = array();
171$arrayfields = array();
172foreach ($object->fields as $key => $val) {
174 if (!empty($val[
'visible'])) {
175 $visible = (int)
dol_eval($val[
'visible'], 1);
176 $arrayfields[
't.'.$key] = array(
177 'label'=>$val[
'label'],
178 'checked'=>(($visible < 0) ? 0 : 1),
179 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
180 'position'=>$val[
'position'],
181 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
186include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
194$enablepermissioncheck = 0;
195if ($enablepermissioncheck) {
196 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
197 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
198 $permissiontodelete = $user->hasRight(
'mymodule',
'myobject',
'delete');
200 $permissiontoread = 1;
201 $permissiontoadd = 1;
202 $permissiontodelete = 1;
206if ($user->socid > 0) {
213if (!isModEnabled(
"mymodule")) {
216if (!$permissiontoread) {
225if (
GETPOST(
'cancel',
'alpha')) {
229if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
233$parameters = array();
234$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
239if (empty($reshook)) {
241 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
244 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
245 foreach ($object->fields as $key => $val) {
247 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
248 $search[$key.
'_dtstart'] =
'';
249 $search[$key.
'_dtend'] =
'';
253 $search_array_options = array();
255 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
256 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
261 $objectclass =
'MyObject';
262 $objectlabel =
'MyObject';
263 $uploaddir = $conf->mymodule->dir_output;
264 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
276$form =
new Form($db);
280$title = $langs->trans(
"MyObjects");
290$sql .= $object->getFieldList(
't');
292if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
293 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
294 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
298$parameters = array();
299$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
300$sql .= $hookmanager->resPrint;
301$sql = preg_replace(
'/,\s*$/',
'', $sql);
305$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
307if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
308 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
311$parameters = array();
312$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
313$sql .= $hookmanager->resPrint;
314if ($object->ismultientitymanaged == 1) {
315 $sql .=
" WHERE t.entity IN (".getEntity($object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
317 $sql .=
" WHERE 1 = 1";
319foreach ($search as $key => $val) {
320 if (array_key_exists($key, $object->fields)) {
321 if ($key ==
'status' && $search[$key] == -1) {
324 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
325 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
326 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
331 if ($search[$key] !=
'') {
332 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
335 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
336 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
337 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
338 if (preg_match(
'/_dtstart$/', $key)) {
339 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
341 if (preg_match(
'/_dtend$/', $key)) {
342 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
349 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
353include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
355$parameters = array();
356$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
357$sql .= $hookmanager->resPrint;
385$nbtotalofrecords =
'';
388 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
389 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
391 $resql = $db->query($sqlforcount);
393 $objforcount = $db->fetch_object($resql);
394 $nbtotalofrecords = $objforcount->nbtotalofrecords;
399 if (($page * $limit) > $nbtotalofrecords) {
407$sql .= $db->order($sortfield, $sortorder);
409 $sql .= $db->plimit($limit + 1, $offset);
412$resql = $db->query($sql);
418$num = $db->num_rows($resql);
422if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
423 $obj = $db->fetch_object($resql);
425 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
433llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
450$arrayofselected = is_array($toselect) ? $toselect : array();
454 $param .=
'&mode='.urlencode($mode);
456if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
457 $param .=
'&contextpage='.urlencode($contextpage);
459if ($limit > 0 && $limit != $conf->liste_limit) {
460 $param .=
'&limit='.((int) $limit);
462if ($optioncss !=
'') {
463 $param .=
'&optioncss='.urlencode($optioncss);
465foreach ($search as $key => $val) {
466 if (is_array($search[$key])) {
467 foreach ($search[$key] as $skey) {
469 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
472 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
473 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
474 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
475 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
476 } elseif ($search[$key] !=
'') {
477 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
481include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
483$parameters = array(
'param' => &$param);
484$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
485$param .= $hookmanager->resPrint;
488$arrayofmassactions = array(
494if (!empty($permissiontodelete)) {
495 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
497if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
498 $arrayofmassactions = array();
500$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
502print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
503if ($optioncss !=
'') {
504 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
506print
'<input type="hidden" name="token" value="'.newToken().
'">';
507print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
508print
'<input type="hidden" name="action" value="list">';
509print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
510print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
511print
'<input type="hidden" name="page" value="'.$page.
'">';
512print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
513print
'<input type="hidden" name="page_y" value="">';
514print
'<input type="hidden" name="mode" value="'.$mode.
'">';
518$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'));
519$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'));
521$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
523print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
526$topicmail =
"SendMyObjectRef";
527$modelmail =
"myobject";
529$trackid =
'xxxx'.$object->id;
530include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
534 foreach ($fieldstosearchall as $key => $val) {
535 $fieldstosearchall[$key] = $langs->trans($val);
536 $setupstring .= $key.
"=".$val.
";";
538 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
539 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
547$parameters = array();
548$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
549if (empty($reshook)) {
550 $moreforfilter .= $hookmanager->resPrint;
552 $moreforfilter = $hookmanager->resPrint;
555if (!empty($moreforfilter)) {
556 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
557 print $moreforfilter;
558 $parameters = array();
559 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
560 print $hookmanager->resPrint;
564$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
565$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
566$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
568print
'<div class="div-table-responsive">';
569print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
573print
'<tr class="liste_titre_filter">';
576 print
'<td class="liste_titre center maxwidthsearch">';
577 $searchpicto = $form->showFilterButtons(
'left');
581foreach ($object->fields as $key => $val) {
582 $searchkey = empty($search[$key]) ?
'' : $search[$key];
583 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
584 if ($key ==
'status') {
585 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
586 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
587 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
588 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
589 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
590 } 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'])) {
591 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
593 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
594 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
595 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
596 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);
597 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
598 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
599 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
600 print
'<div class="nowrap">';
601 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
603 print
'<div class="nowrap">';
604 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
606 } elseif ($key ==
'lang') {
607 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
609 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
611 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
617include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
620$parameters = array(
'arrayfields'=>$arrayfields);
621$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
622print $hookmanager->resPrint;
628 print
'<td class="liste_titre center maxwidthsearch">';
629 $searchpicto = $form->showFilterButtons();
635$totalarray = array();
636$totalarray[
'nbfield'] = 0;
640print
'<tr class="liste_titre">';
643 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
644 $totalarray[
'nbfield']++;
646foreach ($object->fields as $key => $val) {
647 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
648 if ($key ==
'status') {
649 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
650 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
651 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
652 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
653 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
654 } 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'])) {
655 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
657 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
658 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
659 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";
660 $totalarray[
'nbfield']++;
664include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
666$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
667$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
668print $hookmanager->resPrint;
675 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
676 $totalarray[
'nbfield']++;
681$needToFetchEachLine = 0;
682if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
683 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
684 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
685 $needToFetchEachLine++;
694$savnbfield = $totalarray[
'nbfield'];
695$totalarray = array();
696$totalarray[
'nbfield'] = 0;
697$imaxinloop = ($limit ? min($num, $limit) : $num);
698while ($i < $imaxinloop) {
699 $obj = $db->fetch_object($resql);
705 $object->setVarsFromFetchObj($obj);
721 if ($mode ==
'kanban') {
723 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
724 print
'<div class="box-flex-container kanban">';
728 if ($massactionbutton || $massaction) {
730 if (in_array($object->id, $arrayofselected)) {
735 print $object->getKanbanView(
'', array(
'selected' => $selected));
736 if ($i == ($imaxinloop - 1)) {
743 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
747 print
'<td class="nowrap center">';
748 if ($massactionbutton || $massaction) {
750 if (in_array($object->id, $arrayofselected)) {
753 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
757 $totalarray[
'nbfield']++;
760 foreach ($object->fields as $key => $val) {
761 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
762 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
763 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
764 } elseif ($key ==
'status') {
765 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
768 if (in_array($val[
'type'], array(
'timestamp'))) {
769 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
770 } elseif ($key ==
'ref') {
771 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
774 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'])) {
775 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
779 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
780 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
781 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric($object->$key)) {
782 print
' title="'.dol_escape_htmltag($object->$key).
'"';
785 if ($key ==
'status') {
786 print $object->getLibStatut(5);
787 } elseif ($key ==
'rowid') {
788 print $object->showOutputField($val, $key, $object->id,
'');
790 print $object->showOutputField($val, $key, $object->$key,
'');
794 $totalarray[
'nbfield']++;
796 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
798 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
800 if (!isset($totalarray[
'val'])) {
801 $totalarray[
'val'] = array();
803 if (!isset($totalarray[
'val'][
't.'.$key])) {
804 $totalarray[
'val'][
't.'.$key] = 0;
806 $totalarray[
'val'][
't.'.$key] += $object->$key;
811 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
813 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
814 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
815 print $hookmanager->resPrint;
823 print
'<td class="nowrap center">';
824 if ($massactionbutton || $massaction) {
826 if (in_array($object->id, $arrayofselected)) {
829 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
833 $totalarray[
'nbfield']++;
844include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
849 foreach ($arrayfields as $key => $val) {
850 if (!empty($val[
'checked'])) {
854 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
860$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
861$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
862print $hookmanager->resPrint;
864print
'</table>'.
"\n";
869if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
870 $hidegeneratedfilelistifempty = 1;
871 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
872 $hidegeneratedfilelistifempty = 0;
875 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
879 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
880 $urlsource .= str_replace(
'&',
'&', $param);
882 $filedir = $diroutputmassaction;
883 $genallowed = $permissiontoread;
884 $delallowed = $permissiontoadd;
886 print $formfile->showdocuments(
'massfilesarea_'.$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.