26 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33 require_once __DIR__.
'/class/availabilities.class.php';
39 $langs->loadLangs(array(
"bookcal@bookcal",
"other"));
44 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
45 $massaction =
GETPOST(
'massaction',
'alpha');
46 $show_files =
GETPOST(
'show_files',
'int');
47 $confirm =
GETPOST(
'confirm',
'alpha');
48 $cancel =
GETPOST(
'cancel',
'alpha');
49 $toselect =
GETPOST(
'toselect',
'array');
50 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
51 $backtopage =
GETPOST(
'backtopage',
'alpha');
52 $optioncss =
GETPOST(
'optioncss',
'aZ');
56 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
57 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
64 $offset = $limit * $page;
65 $pageprev = $page - 1;
66 $pagenext = $page + 1;
71 $diroutputmassaction = $conf->bookcal->dir_output.
'/temp/massgeneration/'.$user->id;
72 $hookmanager->initHooks(array(
'availabilitieslist'));
75 $extrafields->fetch_name_optionals_label($object->table_element);
78 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
82 reset($object->fields);
83 $sortfield =
"t.".key($object->fields);
90 $search_all =
GETPOST(
'search_all',
'alphanohtml');
92 foreach ($object->fields as $key => $val) {
93 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
94 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
96 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
97 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
98 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
103 $fieldstosearchall = array();
104 foreach ($object->fields as $key => $val) {
105 if (!empty($val[
'searchall'])) {
106 $fieldstosearchall[
't.'.$key] = $val[
'label'];
111 $arrayfields = array();
112 foreach ($object->fields as $key => $val) {
114 if (!empty($val[
'visible'])) {
115 $visible = (int)
dol_eval($val[
'visible'], 1);
116 $arrayfields[
't.'.$key] = array(
117 'label'=>$val[
'label'],
118 'checked'=>(($visible < 0) ? 0 : 1),
119 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
120 'position'=>$val[
'position'],
121 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
126 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
134 $enablepermissioncheck = 0;
135 if ($enablepermissioncheck) {
136 $permissiontoread = $user->rights->bookcal->availabilities->read;
137 $permissiontoadd = $user->rights->bookcal->availabilities->write;
138 $permissiontodelete = $user->rights->bookcal->availabilities->delete;
140 $permissiontoread = 1;
141 $permissiontoadd = 1;
142 $permissiontodelete = 1;
151 if (empty($conf->bookcal->enabled))
accessforbidden(
'Module not enabled');
159 if (
GETPOST(
'cancel',
'alpha')) {
163 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
167 $parameters = array();
168 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
173 if (empty($reshook)) {
175 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
178 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
179 foreach ($object->fields as $key => $val) {
181 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
182 $search[$key.
'_dtstart'] =
'';
183 $search[$key.
'_dtend'] =
'';
187 $search_array_options = array();
189 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
190 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
195 $objectclass =
'Availabilities';
196 $objectlabel =
'Availabilities';
197 $uploaddir = $conf->bookcal->dir_output;
198 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
213 $title = $langs->trans(
"Availabilitiess");
221 $sql .= $object->getFieldList(
't');
223 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
224 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
225 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
229 $parameters = array();
230 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
231 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
232 $sql = preg_replace(
'/,\s*$/',
'', $sql);
234 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
236 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
237 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
240 $parameters = array();
241 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
242 $sql .= $hookmanager->resPrint;
243 if ($object->ismultientitymanaged == 1) {
244 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
246 $sql .=
" WHERE 1 = 1";
248 foreach ($search as $key => $val) {
249 if (array_key_exists($key, $object->fields)) {
250 if ($key ==
'status' && $search[$key] == -1) {
253 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
254 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
255 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
260 if ($search[$key] !=
'') {
261 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
264 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
265 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
266 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
267 if (preg_match(
'/_dtstart$/', $key)) {
268 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
270 if (preg_match(
'/_dtend$/', $key)) {
271 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
278 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
282 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
284 $parameters = array();
285 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
286 $sql .= $hookmanager->resPrint;
315 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
330 $sqlforcount = preg_replace(
'/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
331 $resql = $db->query($sqlforcount);
333 $objforcount = $db->fetch_object(
$resql);
347 $sql .= $db->order($sortfield, $sortorder);
349 $sql .= $db->plimit($limit + 1, $offset);
352 $resql = $db->query($sql);
358 $num = $db->num_rows(
$resql);
362 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
363 $obj = $db->fetch_object(
$resql);
365 header(
"Location: ".
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?id='.$id);
390 $arrayofselected = is_array($toselect) ? $toselect : array();
394 $param .=
'&mode='.urlencode($mode);
396 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
397 $param .=
'&contextpage='.urlencode($contextpage);
399 if ($limit > 0 && $limit != $conf->liste_limit) {
400 $param .=
'&limit='.urlencode($limit);
402 foreach ($search as $key => $val) {
403 if (is_array($search[$key]) && count($search[$key])) {
404 foreach ($search[$key] as $skey) {
406 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
409 } elseif ($search[$key] !=
'') {
410 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
413 if ($optioncss !=
'') {
414 $param .=
'&optioncss='.urlencode($optioncss);
417 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
419 $parameters = array();
420 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
421 $param .= $hookmanager->resPrint;
424 $arrayofmassactions = array(
430 if (!empty($permissiontodelete)) {
431 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
433 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
434 $arrayofmassactions = array();
436 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
438 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
439 if ($optioncss !=
'') {
440 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
442 print
'<input type="hidden" name="token" value="'.newToken().
'">';
443 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
444 print
'<input type="hidden" name="action" value="list">';
445 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
446 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
447 print
'<input type="hidden" name="page" value="'.$page.
'">';
448 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
449 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
453 $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'));
454 $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'));
456 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/bookcal/availabilities_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
458 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
461 $topicmail =
"SendAvailabilitiesRef";
462 $modelmail =
"availabilities";
464 $trackid =
'xxxx'.$object->id;
465 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
469 foreach ($fieldstosearchall as $key => $val) {
470 $fieldstosearchall[$key] = $langs->trans($val);
471 $setupstring .= $key.
"=".$val.
";";
473 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
474 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
482 $parameters = array();
483 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
484 if (empty($reshook)) {
485 $moreforfilter .= $hookmanager->resPrint;
487 $moreforfilter = $hookmanager->resPrint;
490 if (!empty($moreforfilter)) {
491 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
492 print $moreforfilter;
496 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
497 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
498 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
500 print
'<div class="div-table-responsive">';
501 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
506 print
'<tr class="liste_titre">';
508 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
509 print
'<td class="liste_titre maxwidthsearch">';
510 $searchpicto =
$form->showFilterButtons(
'left');
514 foreach ($object->fields as $key => $val) {
515 $searchkey = empty($search[$key]) ?
'' : $search[$key];
516 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
517 if ($key ==
'status') {
518 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
519 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
520 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
521 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
522 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
523 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
524 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
526 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
527 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
528 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
529 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
530 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
531 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
532 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
533 print
'<div class="nowrap">';
534 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
536 print
'<div class="nowrap">';
537 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
539 } elseif ($key ==
'lang') {
540 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
542 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
544 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
550 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
553 $parameters = array(
'arrayfields'=>$arrayfields);
554 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
555 print $hookmanager->resPrint;
560 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
561 print
'<td class="liste_titre maxwidthsearch">';
562 $searchpicto =
$form->showFilterButtons();
568 $totalarray = array();
569 $totalarray[
'nbfield'] = 0;
573 print
'<tr class="liste_titre">';
574 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
575 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
577 foreach ($object->fields as $key => $val) {
578 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
579 if ($key ==
'status') {
580 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
581 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
582 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
583 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
584 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
585 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
586 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
588 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
589 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
590 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
591 $totalarray[
'nbfield']++;
595 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
597 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
598 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
599 print $hookmanager->resPrint;
605 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
606 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
608 $totalarray[
'nbfield']++;
613 $needToFetchEachLine = 0;
614 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
615 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
616 if (preg_match(
'/\$object/', $val)) {
617 $needToFetchEachLine++;
626 $savnbfield = $totalarray[
'nbfield'];
627 $totalarray = array();
628 $totalarray[
'nbfield'] = 0;
629 $imaxinloop = ($limit ? min($num, $limit) : $num);
630 while ($i < $imaxinloop) {
631 $obj = $db->fetch_object(
$resql);
637 $object->setVarsFromFetchObj($obj);
639 if ($mode ==
'kanban') {
641 print
'<tr><td colspan="'.$savnbfield.
'">';
642 print
'<div class="box-flex-container">';
645 print $object->getKanbanView(
'');
646 if ($i == ($imaxinloop - 1)) {
653 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
655 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
656 print
'<td class="nowrap center">';
657 if ($massactionbutton || $massaction) {
659 if (in_array($object->id, $arrayofselected)) {
662 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
666 foreach ($object->fields as $key => $val) {
667 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
668 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
669 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
670 } elseif ($key ==
'status') {
671 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
674 if (in_array($val[
'type'], array(
'timestamp'))) {
675 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
676 } elseif ($key ==
'ref') {
677 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
680 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
681 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
685 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
686 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'');
687 if (preg_match(
'/tdoverflow/', $cssforfield)) {
688 print
' title="'.dol_escape_htmltag($object->$key).
'"';
691 if ($key ==
'status') {
692 print $object->getLibStatut(5);
693 } elseif ($key ==
'rowid') {
694 print $object->showOutputField($val, $key, $object->id,
'');
696 print $object->showOutputField($val, $key, $object->$key,
'');
700 $totalarray[
'nbfield']++;
702 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
704 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
706 if (!isset($totalarray[
'val'])) {
707 $totalarray[
'val'] = array();
709 if (!isset($totalarray[
'val'][
't.'.$key])) {
710 $totalarray[
'val'][
't.'.$key] = 0;
712 $totalarray[
'val'][
't.'.$key] += $object->$key;
717 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
719 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
720 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
721 print $hookmanager->resPrint;
726 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
727 print
'<td class="nowrap center">';
728 if ($massactionbutton || $massaction) {
730 if (in_array($object->id, $arrayofselected)) {
733 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
738 $totalarray[
'nbfield']++;
748 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
753 foreach ($arrayfields as $key => $val) {
754 if (!empty($val[
'checked'])) {
758 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
764 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
765 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
766 print $hookmanager->resPrint;
768 print
'</table>'.
"\n";
771 print
'</form>'.
"\n";
774 $hidegeneratedfilelistifempty = 1;
775 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
776 $hidegeneratedfilelistifempty = 0;
779 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
783 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
784 $urlsource .= str_replace(
'&',
'&', $param);
786 $filedir = $diroutputmassaction;
787 $genallowed = $permissiontoread;
788 $delallowed = $permissiontoadd;
790 print $formfile->showdocuments(
'massfilesarea_bookcal',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class for Availabilities.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
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.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.