48 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
49 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
52 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
53 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
57 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
58 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
60 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
61 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
64 if (!$res && file_exists(
"../main.inc.php")) {
65 $res = @include
"../main.inc.php";
67 if (!$res && file_exists(
"../../main.inc.php")) {
68 $res = @include
"../../main.inc.php";
70 if (!$res && file_exists(
"../../../main.inc.php")) {
71 $res = @include
"../../../main.inc.php";
74 die(
"Include of main fails");
77 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
78 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
79 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
82 require_once __DIR__.
'/class/calendar.class.php';
88 $langs->loadLangs(array(
"bookcal@bookcal",
"other"));
90 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
91 $massaction =
GETPOST(
'massaction',
'alpha');
92 $show_files =
GETPOST(
'show_files',
'int');
93 $confirm =
GETPOST(
'confirm',
'alpha');
94 $cancel =
GETPOST(
'cancel',
'alpha');
95 $toselect =
GETPOST(
'toselect',
'array');
96 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
97 $backtopage =
GETPOST(
'backtopage',
'alpha');
98 $optioncss =
GETPOST(
'optioncss',
'aZ');
102 $ref =
GETPOST(
'ref',
'alpha');
105 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
106 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
107 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
109 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
113 $offset = $limit * $page;
114 $pageprev = $page - 1;
115 $pagenext = $page + 1;
120 $diroutputmassaction = $conf->bookcal->dir_output.
'/temp/massgeneration/'.$user->id;
121 $hookmanager->initHooks(array($contextpage));
124 $extrafields->fetch_name_optionals_label($object->table_element);
127 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
131 reset($object->fields);
132 $sortfield =
"t.".key($object->fields);
139 $search_all =
GETPOST(
'search_all',
'alphanohtml');
141 foreach ($object->fields as $key => $val) {
142 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
143 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
145 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
146 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
147 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
167 $arrayfields = array();
168 foreach ($object->fields as $key => $val) {
170 if (!empty($val[
'visible'])) {
171 $visible = (int)
dol_eval($val[
'visible'], 1);
172 $arrayfields[
't.'.$key] = array(
173 'label'=>$val[
'label'],
174 'checked'=>(($visible < 0) ? 0 : 1),
175 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
176 'position'=>$val[
'position'],
177 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
182 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
190 $enablepermissioncheck = 0;
191 if ($enablepermissioncheck) {
192 $permissiontoread = $user->hasRight(
'bookcal',
'calendar',
'read');
193 $permissiontoadd = $user->hasRight(
'bookcal',
'calendar',
'write');
194 $permissiontodelete = $user->hasRight(
'bookcal',
'calendar',
'delete');
196 $permissiontoread = 1;
197 $permissiontoadd = 1;
198 $permissiontodelete = 1;
217 if (
GETPOST(
'cancel',
'alpha')) {
221 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
225 $parameters = array();
226 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
231 if (empty($reshook)) {
233 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
236 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
237 foreach ($object->fields as $key => $val) {
239 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
240 $search[$key.
'_dtstart'] =
'';
241 $search[$key.
'_dtend'] =
'';
245 $search_array_options = array();
247 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
248 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
253 $objectclass =
'Calendar';
254 $objectlabel =
'Calendar';
255 $uploaddir = $conf->bookcal->dir_output;
256 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
272 $title = $langs->trans(
"Calendars");
282 $sql .= $object->getFieldList(
't');
284 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
285 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
286 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
290 $parameters = array();
291 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
292 $sql .= $hookmanager->resPrint;
293 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
298 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
300 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
301 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
304 $parameters = array();
305 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
306 $sql .= $hookmanager->resPrint;
307 if ($object->ismultientitymanaged == 1) {
308 $sql .=
" WHERE t.entity IN (".getEntity($object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
310 $sql .=
" WHERE 1 = 1";
312 foreach ($search as $key => $val) {
313 if (array_key_exists($key, $object->fields)) {
314 if ($key ==
'status' && $search[$key] == -1) {
317 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
318 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
319 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
324 if ($search[$key] !=
'') {
325 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
328 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
329 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
330 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
331 if (preg_match(
'/_dtstart$/', $key)) {
332 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
334 if (preg_match(
'/_dtend$/', $key)) {
335 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
346 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
348 $parameters = array();
349 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
350 $sql .= $hookmanager->resPrint;
378 $nbtotalofrecords =
'';
381 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
382 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
383 $resql = $db->query($sqlforcount);
385 $objforcount = $db->fetch_object($resql);
386 $nbtotalofrecords = $objforcount->nbtotalofrecords;
391 if (($page * $limit) > $nbtotalofrecords) {
399 $sql .= $db->order($sortfield, $sortorder);
401 $sql .= $db->plimit($limit + 1, $offset);
404 $resql = $db->query(
$sql);
410 $num = $db->num_rows($resql);
414 if ($num == 1 && !
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
415 $obj = $db->fetch_object($resql);
417 header(
"Location: ".
dol_buildpath(
'/bookcal/calendar_card.php', 1).
'?id='.$id);
442 $arrayofselected = is_array($toselect) ? $toselect : array();
446 $param .=
'&mode='.urlencode($mode);
448 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
449 $param .=
'&contextpage='.urlencode($contextpage);
451 if ($limit > 0 && $limit != $conf->liste_limit) {
452 $param .=
'&limit='.((int) $limit);
454 if ($optioncss !=
'') {
455 $param .=
'&optioncss='.urlencode($optioncss);
457 foreach ($search as $key => $val) {
458 if (is_array($search[$key])) {
459 foreach ($search[$key] as $skey) {
461 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
464 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
465 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
466 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
467 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
468 } elseif ($search[$key] !=
'') {
469 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
473 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
475 $parameters = array();
476 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
477 $param .= $hookmanager->resPrint;
480 $arrayofmassactions = array(
486 if (!empty($permissiontodelete)) {
487 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
489 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
490 $arrayofmassactions = array();
492 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
494 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
495 if ($optioncss !=
'') {
496 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
498 print
'<input type="hidden" name="token" value="'.newToken().
'">';
499 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
500 print
'<input type="hidden" name="action" value="list">';
501 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
502 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
503 print
'<input type="hidden" name="page" value="'.$page.
'">';
504 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
505 print
'<input type="hidden" name="page_y" value="">';
506 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
510 $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'));
511 $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'));
513 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/bookcal/calendar_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
515 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
518 $topicmail =
"SendCalendarRef";
519 $modelmail =
"calendar";
521 $trackid =
'xxxx'.$object->id;
522 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
526 foreach ($fieldstosearchall as $key => $val) {
527 $fieldstosearchall[$key] = $langs->trans($val);
528 $setupstring .= $key.
"=".$val.
";";
530 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
531 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
539 $parameters = array();
540 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
541 if (empty($reshook)) {
542 $moreforfilter .= $hookmanager->resPrint;
544 $moreforfilter = $hookmanager->resPrint;
547 if (!empty($moreforfilter)) {
548 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
549 print $moreforfilter;
550 $parameters = array();
551 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
552 print $hookmanager->resPrint;
556 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
557 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
558 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
560 print
'<div class="div-table-responsive">';
561 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
565 print
'<tr class="liste_titre_filter">';
568 print
'<td class="liste_titre center maxwidthsearch">';
569 $searchpicto =
$form->showFilterButtons(
'left');
573 foreach ($object->fields as $key => $val) {
574 $searchkey = empty($search[$key]) ?
'' : $search[$key];
575 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
576 if ($key ==
'status') {
577 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
578 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
579 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
580 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
581 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
582 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
583 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
585 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
586 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
587 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
588 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
589 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
590 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
591 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
592 print
'<div class="nowrap">';
593 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
595 print
'<div class="nowrap">';
596 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
598 } elseif ($key ==
'lang') {
599 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
601 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
603 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
609 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
612 $parameters = array(
'arrayfields'=>$arrayfields);
613 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
614 print $hookmanager->resPrint;
620 print
'<td class="liste_titre center maxwidthsearch">';
621 $searchpicto =
$form->showFilterButtons();
627 $totalarray = array();
628 $totalarray[
'nbfield'] = 0;
632 print
'<tr class="liste_titre">';
635 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
636 $totalarray[
'nbfield']++;
638 foreach ($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')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
647 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
649 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
650 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
651 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";
652 $totalarray[
'nbfield']++;
656 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
658 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
659 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
660 print $hookmanager->resPrint;
667 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
668 $totalarray[
'nbfield']++;
673 $needToFetchEachLine = 0;
674 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
675 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
676 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
677 $needToFetchEachLine++;
686 $savnbfield = $totalarray[
'nbfield'];
687 $totalarray = array();
688 $totalarray[
'nbfield'] = 0;
689 $imaxinloop = ($limit ? min($num, $limit) : $num);
690 while ($i < $imaxinloop) {
691 $obj = $db->fetch_object($resql);
697 $object->setVarsFromFetchObj($obj);
699 if ($mode ==
'kanban') {
701 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
702 print
'<div class="box-flex-container kanban">';
706 if ($massactionbutton || $massaction) {
708 if (in_array($object->id, $arrayofselected)) {
712 print $object->getKanbanView(
'', array(
'selected' => $selected));
713 if ($i == ($imaxinloop - 1)) {
720 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
724 print
'<td class="nowrap center">';
725 if ($massactionbutton || $massaction) {
727 if (in_array($object->id, $arrayofselected)) {
730 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
734 $totalarray[
'nbfield']++;
737 foreach ($object->fields as $key => $val) {
738 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
739 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
740 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
741 } elseif ($key ==
'status') {
742 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
745 if (in_array($val[
'type'], array(
'timestamp'))) {
746 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
747 } elseif ($key ==
'ref') {
748 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
751 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
752 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
756 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
757 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
758 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
759 print
' title="'.dol_escape_htmltag($object->$key).
'"';
762 if ($key ==
'status') {
763 print $object->getLibStatut(5);
764 } elseif ($key ==
'rowid') {
765 print $object->showOutputField($val, $key, $object->id,
'');
767 print $object->showOutputField($val, $key, $object->$key,
'');
771 $totalarray[
'nbfield']++;
773 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
775 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
777 if (!isset($totalarray[
'val'])) {
778 $totalarray[
'val'] = array();
780 if (!isset($totalarray[
'val'][
't.'.$key])) {
781 $totalarray[
'val'][
't.'.$key] = 0;
783 $totalarray[
'val'][
't.'.$key] += $object->$key;
788 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
790 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
791 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
792 print $hookmanager->resPrint;
798 print
'<td class="nowrap center">';
799 if ($massactionbutton || $massaction) {
801 if (in_array($object->id, $arrayofselected)) {
804 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
808 $totalarray[
'nbfield']++;
819 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
824 foreach ($arrayfields as $key => $val) {
825 if (!empty($val[
'checked'])) {
829 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
835 $parameters = array(
'arrayfields' => $arrayfields,
'sql' =>
$sql);
836 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
837 print $hookmanager->resPrint;
839 print
'</table>'.
"\n";
842 print
'</form>'.
"\n";
844 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
845 $hidegeneratedfilelistifempty = 1;
846 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
847 $hidegeneratedfilelistifempty = 0;
850 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
854 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
855 $urlsource .= str_replace(
'&',
'&', $param);
857 $filedir = $diroutputmassaction;
858 $genallowed = $permissiontoread;
859 $delallowed = $permissiontoadd;
861 print $formfile->showdocuments(
'massfilesarea_'.$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);