26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32require_once __DIR__.
'/class/availabilities.class.php';
38$langs->loadLangs(array(
"agenda",
"other"));
43$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
44$massaction =
GETPOST(
'massaction',
'alpha');
45$show_files =
GETPOST(
'show_files',
'int');
46$confirm =
GETPOST(
'confirm',
'alpha');
47$cancel =
GETPOST(
'cancel',
'alpha');
48$toselect =
GETPOST(
'toselect',
'array');
49$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$optioncss =
GETPOST(
'optioncss',
'aZ');
55$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
56$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
58$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
59if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
63$offset = $limit * $page;
70$diroutputmassaction = $conf->bookcal->dir_output.
'/temp/massgeneration/'.$user->id;
71$hookmanager->initHooks(array($contextpage));
74$extrafields->fetch_name_optionals_label($object->table_element);
77$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
81 reset($object->fields);
82 $sortfield =
"t.".key($object->fields);
89$search_all =
GETPOST(
'search_all',
'alphanohtml');
91foreach ($object->fields as $key => $val) {
92 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
93 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
95 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
96 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
97 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
117$arrayfields = array();
118foreach ($object->fields as $key => $val) {
120 if (!empty($val[
'visible'])) {
121 $visible = (int)
dol_eval($val[
'visible'], 1);
122 $arrayfields[
't.'.$key] = array(
123 'label'=>$val[
'label'],
124 'checked'=>(($visible < 0) ? 0 : 1),
125 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
126 'position'=>$val[
'position'],
127 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
132include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
140$enablepermissioncheck = 0;
141if ($enablepermissioncheck) {
142 $permissiontoread = $user->hasRight(
'bookcal',
'availabilities',
'read');
143 $permissiontoadd = $user->hasRight(
'bookcal',
'availabilities',
'write');
144 $permissiontodelete = $user->hasRight(
'bookcal',
'availabilities',
'delete');
146 $permissiontoread = 1;
147 $permissiontoadd = 1;
148 $permissiontodelete = 1;
152if ($user->socid > 0) {
159if (!isModEnabled(
'bookcal')) {
162if (!$permissiontoread) {
171if (
GETPOST(
'cancel',
'alpha')) {
175if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
179$parameters = array();
180$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
185if (empty($reshook)) {
187 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
190 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
191 foreach ($object->fields as $key => $val) {
193 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
194 $search[$key.
'_dtstart'] =
'';
195 $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 =
'Availabilities';
208 $objectlabel =
'Availabilities';
209 $uploaddir = $conf->bookcal->dir_output;
210 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
222$form =
new Form($db);
226$title = $langs->trans(
"Availabilities");
236$sql .= $object->getFieldList(
't');
238if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
239 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
240 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
244$parameters = array();
245$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
246$sql .= $hookmanager->resPrint;
247$sql = preg_replace(
'/,\s*$/',
'', $sql);
252$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
254if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
255 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
258$parameters = array();
259$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
260$sql .= $hookmanager->resPrint;
261if ($object->ismultientitymanaged == 1) {
262 $sql .=
" WHERE t.entity IN (".getEntity($object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
264 $sql .=
" WHERE 1 = 1";
266foreach ($search as $key => $val) {
267 if (array_key_exists($key, $object->fields)) {
268 if ($key ==
'status' && $search[$key] == -1) {
271 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
272 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
273 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
278 if ($search[$key] !=
'') {
279 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
282 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
283 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
284 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
285 if (preg_match(
'/_dtstart$/', $key)) {
286 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
288 if (preg_match(
'/_dtend$/', $key)) {
289 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
296 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
300include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
302$parameters = array();
303$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
304$sql .= $hookmanager->resPrint;
332$nbtotalofrecords =
'';
335 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
336 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
337 $resql = $db->query($sqlforcount);
339 $objforcount = $db->fetch_object($resql);
340 $nbtotalofrecords = $objforcount->nbtotalofrecords;
345 if (($page * $limit) > $nbtotalofrecords) {
353$sql .= $db->order($sortfield, $sortorder);
355 $sql .= $db->plimit($limit + 1, $offset);
358$resql = $db->query($sql);
364$num = $db->num_rows($resql);
368if ($num == 1 && !
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
369 $obj = $db->fetch_object($resql);
371 header(
"Location: ".
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?id='.$id);
379llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
396$arrayofselected = is_array($toselect) ? $toselect : array();
400 $param .=
'&mode='.urlencode($mode);
402if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
403 $param .=
'&contextpage='.urlencode($contextpage);
405if ($limit > 0 && $limit != $conf->liste_limit) {
406 $param .=
'&limit='.((int) $limit);
408if ($optioncss !=
'') {
409 $param .=
'&optioncss='.urlencode($optioncss);
411foreach ($search as $key => $val) {
412 if (is_array($search[$key])) {
413 foreach ($search[$key] as $skey) {
415 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
418 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
419 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
420 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
421 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
422 } elseif ($search[$key] !=
'') {
423 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
427include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
429$parameters = array(
'param' => &$param);
430$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
431$param .= $hookmanager->resPrint;
434$arrayofmassactions = array(
440if (!empty($permissiontodelete)) {
441 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
443if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
444 $arrayofmassactions = array();
446$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
448print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
449if ($optioncss !=
'') {
450 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
452print
'<input type="hidden" name="token" value="'.newToken().
'">';
453print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
454print
'<input type="hidden" name="action" value="list">';
455print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
456print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
457print
'<input type="hidden" name="page" value="'.$page.
'">';
458print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
459print
'<input type="hidden" name="mode" value="'.$mode.
'">';
463$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'));
464$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'));
466$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
468print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
471$topicmail =
"SendAvailabilitiesRef";
472$modelmail =
"availabilities";
474$trackid =
'xxxx'.$object->id;
475include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
479 foreach ($fieldstosearchall as $key => $val) {
480 $fieldstosearchall[$key] = $langs->trans($val);
481 $setupstring .= $key.
"=".$val.
";";
483 print
'<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
484 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
492$parameters = array();
493$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
494if (empty($reshook)) {
495 $moreforfilter .= $hookmanager->resPrint;
497 $moreforfilter = $hookmanager->resPrint;
500if (!empty($moreforfilter)) {
501 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
502 print $moreforfilter;
503 $parameters = array();
504 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
505 print $hookmanager->resPrint;
509$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
510$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
511$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
513print
'<div class="div-table-responsive">';
514print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
519print
'<tr class="liste_titre_filter">';
522 print
'<td class="liste_titre center maxwidthsearch">';
523 $searchpicto = $form->showFilterButtons(
'left');
527foreach ($object->fields as $key => $val) {
528 $searchkey = empty($search[$key]) ?
'' : $search[$key];
529 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
530 if ($key ==
'status') {
531 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
532 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
533 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
534 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
535 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
536 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
537 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
539 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
540 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
541 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
542 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);
543 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
544 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
545 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
546 print
'<div class="nowrap">';
547 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
549 print
'<div class="nowrap">';
550 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
552 } elseif ($key ==
'lang') {
553 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
555 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
557 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
563include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
566$parameters = array(
'arrayfields'=>$arrayfields);
567$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
568print $hookmanager->resPrint;
574 print
'<td class="liste_titre center maxwidthsearch">';
575 $searchpicto = $form->showFilterButtons();
581$totalarray = array();
582$totalarray[
'nbfield'] = 0;
586print
'<tr class="liste_titre">';
589 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
590 $totalarray[
'nbfield']++;
592foreach ($object->fields as $key => $val) {
593 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
594 if ($key ==
'status') {
595 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
596 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
597 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
598 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
599 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
600 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
601 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
603 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
604 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
605 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";
606 $totalarray[
'nbfield']++;
610include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
612$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
613$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
614print $hookmanager->resPrint;
621 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
622 $totalarray[
'nbfield']++;
628$needToFetchEachLine = 0;
629if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
630 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
631 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
632 $needToFetchEachLine++;
641$savnbfield = $totalarray[
'nbfield'];
642$totalarray = array();
643$totalarray[
'nbfield'] = 0;
644$imaxinloop = ($limit ? min($num, $limit) : $num);
645while ($i < $imaxinloop) {
646 $obj = $db->fetch_object($resql);
652 $object->setVarsFromFetchObj($obj);
654 if ($mode ==
'kanban') {
656 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
657 print
'<div class="box-flex-container kanban">';
661 if ($massactionbutton || $massaction) {
663 if (in_array($object->id, $arrayofselected)) {
667 print $object->getKanbanView(
'', array(
'selected' => $selected));
668 if ($i == ($imaxinloop - 1)) {
675 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
678 print
'<td class="nowrap center">';
679 if ($massactionbutton || $massaction) {
681 if (in_array($object->id, $arrayofselected)) {
684 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
688 $totalarray[
'nbfield']++;
691 foreach ($object->fields as $key => $val) {
692 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
693 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
694 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
695 } elseif ($key ==
'status') {
696 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
699 if (in_array($val[
'type'], array(
'timestamp'))) {
700 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
701 } elseif ($key ==
'ref') {
702 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
705 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
706 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
710 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
711 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
712 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
713 print
' title="'.dol_escape_htmltag($object->$key).
'"';
716 if ($key ==
'status') {
717 print $object->getLibStatut(5);
718 } elseif ($key ==
'rowid') {
719 print $object->showOutputField($val, $key, $object->id,
'');
721 print $object->showOutputField($val, $key, $object->$key,
'');
725 $totalarray[
'nbfield']++;
727 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
729 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
731 if (!isset($totalarray[
'val'])) {
732 $totalarray[
'val'] = array();
734 if (!isset($totalarray[
'val'][
't.'.$key])) {
735 $totalarray[
'val'][
't.'.$key] = 0;
737 $totalarray[
'val'][
't.'.$key] += $object->$key;
742 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
744 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
745 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
746 print $hookmanager->resPrint;
752 print
'<td class="nowrap center">';
753 if ($massactionbutton || $massaction) {
755 if (in_array($object->id, $arrayofselected)) {
758 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
762 $totalarray[
'nbfield']++;
773include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
778 foreach ($arrayfields as $key => $val) {
779 if (!empty($val[
'checked'])) {
783 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
789$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
790$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
791print $hookmanager->resPrint;
793print
'</table>'.
"\n";
798if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
799 $hidegeneratedfilelistifempty = 1;
800 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
801 $hidegeneratedfilelistifempty = 0;
804 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
808 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
809 $urlsource .= str_replace(
'&',
'&', $param);
811 $filedir = $diroutputmassaction;
812 $genallowed = $permissiontoread;
813 $delallowed = $permissiontoadd;
815 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.
Class for Availabilities.
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...
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.