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(
'availabilitieslist'));
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'));
102$fieldstosearchall = array();
103foreach ($object->fields as $key => $val) {
104 if (!empty($val[
'searchall'])) {
105 $fieldstosearchall[
't.'.$key] = $val[
'label'];
110$arrayfields = array();
111foreach ($object->fields as $key => $val) {
113 if (!empty($val[
'visible'])) {
114 $visible = (int)
dol_eval($val[
'visible'], 1);
115 $arrayfields[
't.'.$key] = array(
116 'label'=>$val[
'label'],
117 'checked'=>(($visible < 0) ? 0 : 1),
118 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
119 'position'=>$val[
'position'],
120 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
125include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
133$enablepermissioncheck = 0;
134if ($enablepermissioncheck) {
135 $permissiontoread = $user->hasRight(
'bookcal',
'availabilities',
'read');
136 $permissiontoadd = $user->hasRight(
'bookcal',
'availabilities',
'write');
137 $permissiontodelete = $user->hasRight(
'bookcal',
'availabilities',
'delete');
139 $permissiontoread = 1;
140 $permissiontoadd = 1;
141 $permissiontodelete = 1;
158if (
GETPOST(
'cancel',
'alpha')) {
162if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
166$parameters = array();
167$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
172if (empty($reshook)) {
174 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
177 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
178 foreach ($object->fields as $key => $val) {
180 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
181 $search[$key.
'_dtstart'] =
'';
182 $search[$key.
'_dtend'] =
'';
186 $search_array_options = array();
188 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
189 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
194 $objectclass =
'Availabilities';
195 $objectlabel =
'Availabilities';
196 $uploaddir = $conf->bookcal->dir_output;
197 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
206$form =
new Form($db);
212$title = $langs->trans(
"Availabilities");
220$sql .= $object->getFieldList(
't');
222if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
223 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
224 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
228$parameters = array();
229$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
230$sql .= $hookmanager->resPrint;
231$sql = preg_replace(
'/,\s*$/',
'', $sql);
233$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
235if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
236 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
239$parameters = array();
240$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
241$sql .= $hookmanager->resPrint;
242if ($object->ismultientitymanaged == 1) {
243 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
245 $sql .=
" WHERE 1 = 1";
247foreach ($search as $key => $val) {
248 if (array_key_exists($key, $object->fields)) {
249 if ($key ==
'status' && $search[$key] == -1) {
252 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
253 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
254 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
259 if ($search[$key] !=
'') {
260 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
263 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
264 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
265 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
266 if (preg_match(
'/_dtstart$/', $key)) {
267 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
269 if (preg_match(
'/_dtend$/', $key)) {
270 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
277 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
281include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
283$parameters = array();
284$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
285$sql .= $hookmanager->resPrint;
313$nbtotalofrecords =
'';
329 $sqlforcount = preg_replace(
'/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
330 $resql = $db->query($sqlforcount);
332 $objforcount = $db->fetch_object($resql);
333 $nbtotalofrecords = $objforcount->nbtotalofrecords;
338 if (($page * $limit) > $nbtotalofrecords) {
346$sql .= $db->order($sortfield, $sortorder);
348 $sql .= $db->plimit($limit + 1, $offset);
351$resql = $db->query($sql);
357$num = $db->num_rows($resql);
361if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
362 $obj = $db->fetch_object($resql);
364 header(
"Location: ".
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?id='.$id);
372llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
389$arrayofselected = is_array($toselect) ? $toselect : array();
393 $param .=
'&mode='.urlencode($mode);
395if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
396 $param .=
'&contextpage='.urlencode($contextpage);
398if ($limit > 0 && $limit != $conf->liste_limit) {
399 $param .=
'&limit='.((int) $limit);
401foreach ($search as $key => $val) {
402 if (is_array($search[$key]) && count($search[$key])) {
403 foreach ($search[$key] as $skey) {
405 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
408 } elseif ($search[$key] !=
'') {
409 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
412if ($optioncss !=
'') {
413 $param .=
'&optioncss='.urlencode($optioncss);
416include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
418$parameters = array();
419$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
420$param .= $hookmanager->resPrint;
423$arrayofmassactions = array(
429if (!empty($permissiontodelete)) {
430 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
432if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
433 $arrayofmassactions = array();
435$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
437print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
438if ($optioncss !=
'') {
439 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
441print
'<input type="hidden" name="token" value="'.newToken().
'">';
442print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
443print
'<input type="hidden" name="action" value="list">';
444print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
445print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
446print
'<input type="hidden" name="page" value="'.$page.
'">';
447print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
448print
'<input type="hidden" name="mode" value="'.$mode.
'">';
452$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'));
453$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'));
455$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
457print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
460$topicmail =
"SendAvailabilitiesRef";
461$modelmail =
"availabilities";
463$trackid =
'xxxx'.$object->id;
464include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
468 foreach ($fieldstosearchall as $key => $val) {
469 $fieldstosearchall[$key] = $langs->trans($val);
470 $setupstring .= $key.
"=".$val.
";";
472 print
'<!-- Search done like if BOOKCAL_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
473 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
481$parameters = array();
482$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
483if (empty($reshook)) {
484 $moreforfilter .= $hookmanager->resPrint;
486 $moreforfilter = $hookmanager->resPrint;
489if (!empty($moreforfilter)) {
490 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
491 print $moreforfilter;
495$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
496$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
497$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
499print
'<div class="div-table-responsive">';
500print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
505print
'<tr class="liste_titre">';
507if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
508 print
'<td class="liste_titre maxwidthsearch">';
509 $searchpicto = $form->showFilterButtons(
'left');
513foreach ($object->fields as $key => $val) {
514 $searchkey = empty($search[$key]) ?
'' : $search[$key];
515 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
516 if ($key ==
'status') {
517 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
518 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
519 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
520 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
521 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
522 } 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'])) {
523 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
525 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
526 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
527 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
528 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
529 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
530 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
531 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
532 print
'<div class="nowrap">';
533 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
535 print
'<div class="nowrap">';
536 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
538 } elseif ($key ==
'lang') {
539 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
541 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
543 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
549include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
552$parameters = array(
'arrayfields'=>$arrayfields);
553$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
554print $hookmanager->resPrint;
559if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
560 print
'<td class="liste_titre maxwidthsearch">';
561 $searchpicto = $form->showFilterButtons();
567$totalarray = array();
568$totalarray[
'nbfield'] = 0;
572print
'<tr class="liste_titre">';
573if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
574 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
576foreach ($object->fields as $key => $val) {
577 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
578 if ($key ==
'status') {
579 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
580 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
581 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
582 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
583 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
584 } 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'])) {
585 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
587 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
588 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
589 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
590 $totalarray[
'nbfield']++;
594include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
596$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
597$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
598print $hookmanager->resPrint;
604if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
605 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
607$totalarray[
'nbfield']++;
612$needToFetchEachLine = 0;
613if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
614 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
615 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
616 $needToFetchEachLine++;
625$savnbfield = $totalarray[
'nbfield'];
626$totalarray = array();
627$totalarray[
'nbfield'] = 0;
628$imaxinloop = ($limit ? min($num, $limit) : $num);
629while ($i < $imaxinloop) {
630 $obj = $db->fetch_object($resql);
636 $object->setVarsFromFetchObj($obj);
638 if ($mode ==
'kanban') {
640 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
641 print
'<div class="box-flex-container kanban">';
644 print $object->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
645 if ($i == ($imaxinloop - 1)) {
652 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
654 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
655 print
'<td class="nowrap center">';
656 if ($massactionbutton || $massaction) {
658 if (in_array($object->id, $arrayofselected)) {
661 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
665 foreach ($object->fields as $key => $val) {
666 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
667 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
668 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
669 } elseif ($key ==
'status') {
670 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
673 if (in_array($val[
'type'], array(
'timestamp'))) {
674 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
675 } elseif ($key ==
'ref') {
676 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
679 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
680 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
684 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
685 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
686 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
687 print
' title="'.dol_escape_htmltag($object->$key).
'"';
690 if ($key ==
'status') {
691 print $object->getLibStatut(5);
692 } elseif ($key ==
'rowid') {
693 print $object->showOutputField($val, $key, $object->id,
'');
695 print $object->showOutputField($val, $key, $object->$key,
'');
699 $totalarray[
'nbfield']++;
701 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
703 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
705 if (!isset($totalarray[
'val'])) {
706 $totalarray[
'val'] = array();
708 if (!isset($totalarray[
'val'][
't.'.$key])) {
709 $totalarray[
'val'][
't.'.$key] = 0;
711 $totalarray[
'val'][
't.'.$key] += $object->$key;
716 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
718 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
719 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
720 print $hookmanager->resPrint;
725 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
726 print
'<td class="nowrap center">';
727 if ($massactionbutton || $massaction) {
729 if (in_array($object->id, $arrayofselected)) {
732 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
737 $totalarray[
'nbfield']++;
747include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
752 foreach ($arrayfields as $key => $val) {
753 if (!empty($val[
'checked'])) {
757 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
763$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
764$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
765print $hookmanager->resPrint;
767print
'</table>'.
"\n";
772if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
773 $hidegeneratedfilelistifempty = 1;
774 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
775 $hidegeneratedfilelistifempty = 0;
778 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
782 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
783 $urlsource .= str_replace(
'&',
'&', $param);
785 $filedir = $diroutputmassaction;
786 $genallowed = $permissiontoread;
787 $delallowed = $permissiontoadd;
789 print $formfile->showdocuments(
'massfilesarea_bookcal',
'', $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 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.