27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
34global $conf, $db, $hookmanager, $langs, $user;
37$langs->loadLangs(array(
'mrp',
'other'));
39$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
40$massaction =
GETPOST(
'massaction',
'alpha');
41$show_files =
GETPOST(
'show_files',
'int');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$cancel =
GETPOST(
'cancel',
'alpha');
44$toselect =
GETPOST(
'toselect',
'array');
45$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
46$backtopage =
GETPOST(
'backtopage',
'alpha');
47$optioncss =
GETPOST(
'optioncss',
'aZ');
54$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
55$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
56$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
57$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
58if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
62$offset = $limit * $page;
69$diroutputmassaction = $conf->workstation->dir_output.
'/temp/massgeneration/'.$user->id;
70$hookmanager->initHooks(array(
'workstationlist'));
73$extrafields->fetch_name_optionals_label($object->table_element);
76$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
80 reset($object->fields);
81 $sortfield =
"t.".key($object->fields);
88$search_all = trim(
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'));
101$groups =
GETPOST(
'groups',
'array:int');
102$resources =
GETPOST(
'resources',
'array:int');
105$fieldstosearchall = array();
106foreach ($object->fields as $key => $val) {
107 if (!empty($val[
'searchall'])) {
108 $fieldstosearchall[
't.'.$key] = $val[
'label'];
113$arrayfields = array();
114foreach ($object->fields as $key => $val) {
116 if (!empty($val[
'visible'])) {
117 $visible = (int)
dol_eval($val[
'visible'], 1);
118 $arrayfields[
't.'.$key] = array(
119 'label'=>$val[
'label'],
120 'checked'=>(($visible < 0) ? 0 : 1),
121 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
122 'position'=>$val[
'position'],
123 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
128$arrayfields[
'wug.fk_usergroup'] = array(
129 'label'=>$langs->trans(
'UserGroups'),
130 'checked'=>(($visible < 0) ? 0 : 1),
131 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1)),
133 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
134 'csslist' =>
'minwidth100'
148include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
153$permissiontoread = $user->hasRight(
'workstation',
'workstation',
'read');
154$permissiontoadd = $user->hasRight(
'workstation',
'workstation',
'write');
155$permissiontodelete = $user->hasRight(
'workstation',
'workstation',
'delete');
158restrictedArea($user, $object->element, 0, $object->table_element,
'workstation');
165if (
GETPOST(
'cancel',
'alpha')) {
169if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
173$parameters = array();
174$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
179if (empty($reshook)) {
181 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
184 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
185 foreach ($object->fields as $key => $val) {
187 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
188 $search[$key.
'_dtstart'] =
'';
189 $search[$key.
'_dtend'] =
'';
192 $groups = $resources=array();
194 $search_array_options = array();
196 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
197 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
202 $objectclass =
'Workstation';
203 $objectlabel =
'Workstation';
204 $uploaddir = $conf->workstation->dir_output;
205 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
214$form =
new Form($db);
219$title = $langs->trans(
"Workstations");
220$help_url =
'EN:Module_Workstation';
228$sql .= $object->getFieldList(
't');
230if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
231 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
232 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
236$parameters = array();
237$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
238$sql .= $hookmanager->resPrint;
239$sql = preg_replace(
'/,\s*$/',
'', $sql);
243$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
244if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
245 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
247if (!empty($groups)) {
248 $sql.=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
250if (!empty($resources)) {
251 $sql.=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
254$parameters = array();
255$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
256$sql .= $hookmanager->resPrint;
257if ($object->ismultientitymanaged == 1) {
258 $sql .=
" WHERE t.entity IN (".getEntity($object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
260 $sql .=
" WHERE 1 = 1";
262foreach ($search as $key => $val) {
263 if (array_key_exists($key, $object->fields)) {
264 if ($key ==
'status' && $search[$key] == -1) {
267 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
268 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
269 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
274 if ($search[$key] !=
'') {
275 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
278 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
279 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
280 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
281 if (preg_match(
'/_dtstart$/', $key)) {
282 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
284 if (preg_match(
'/_dtend$/', $key)) {
285 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
292 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
298if (!empty($groups)) {
299 $sql.=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
303if (!empty($resources)) {
304 $sql.=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
307include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
309$parameters = array();
310$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
311$sql .= $hookmanager->resPrint;
314foreach ($object->fields as $key => $val) {
315 $sql .=
"t.".$db->escape($key).
", ";
318if (! empty($extrafields->attributes[$object->table_element][
'label'])) {
319 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
320 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
324$parameters = array();
325$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
326$sql .= $hookmanager->resPrint;
327$sql = preg_replace(
'/,\s*$/',
'', $sql);
330$nbtotalofrecords =
'';
333 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
334 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
336 $resql = $db->query($sqlforcount);
338 $objforcount = $db->fetch_object($resql);
339 $nbtotalofrecords = $objforcount->nbtotalofrecords;
344 if (($page * $limit) > $nbtotalofrecords) {
352$sql .= $db->order($sortfield, $sortorder);
354 $sql .= $db->plimit($limit + 1, $offset);
357$resql = $db->query($sql);
363$num = $db->num_rows($resql);
367if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
368 $obj = $db->fetch_object($resql);
370 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.((
int) $id));
378llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
380$arrayofselected = is_array($toselect) ? $toselect : array();
384 $param .=
'&mode='.urlencode($mode);
386if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
387 $param .=
'&contextpage='.urlencode($contextpage);
389if ($limit > 0 && $limit != $conf->liste_limit) {
390 $param .=
'&limit='.((int) $limit);
392if ($optioncss !=
'') {
393 $param .=
'&optioncss='.urlencode($optioncss);
395foreach ($search as $key => $val) {
396 if (is_array($search[$key])) {
397 foreach ($search[$key] as $skey) {
399 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
402 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
403 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
404 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
405 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
406 } elseif ($search[$key] !=
'') {
407 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
411include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
413$parameters = array(
'param' => &$param);
414$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
415$param .= $hookmanager->resPrint;
418$arrayofmassactions = array(
424if (!empty($permissiontodelete)) {
425 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
427if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
428 $arrayofmassactions = array();
430$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
432print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
433if ($optioncss !=
'') {
434 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
436print
'<input type="hidden" name="token" value="'.newToken().
'">';
437print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
438print
'<input type="hidden" name="action" value="list">';
439print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
440print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
441print
'<input type="hidden" name="page" value="'.$page.
'">';
442print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
443print
'<input type="hidden" name="page_y" value="">';
444print
'<input type="hidden" name="mode" value="'.$mode.
'">';
447$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'));
448$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'));
450$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
452print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
455$topicmail =
"SendWorkstationRef";
456$modelmail =
"workstation";
458$trackid =
'xxxx'.$object->id;
459include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
463 foreach ($fieldstosearchall as $key => $val) {
464 $fieldstosearchall[$key] = $langs->trans($val);
465 $setupstring .= $key.
"=".$val.
";";
467 print
'<!-- Search done like if WORKSTATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
468 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
476$parameters = array();
477$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
478if (empty($reshook)) {
479 $moreforfilter .= $hookmanager->resPrint;
481 $moreforfilter = $hookmanager->resPrint;
484if (!empty($moreforfilter)) {
485 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
486 print $moreforfilter;
487 $parameters = array();
488 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
489 print $hookmanager->resPrint;
493$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
494$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
495$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
497print
'<div class="div-table-responsive">';
498print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
504print
'<tr class="liste_titre_filter">';
507 print
'<td class="liste_titre center maxwidthsearch">';
508 $searchpicto = $form->showFilterButtons(
'left');
512foreach ($object->fields as $key => $val) {
513 $searchkey = empty($search[$key]) ?
'' : $search[$key];
514 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
515 if ($key ==
'status') {
516 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
517 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
518 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
519 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
520 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
521 } 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'])) {
522 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
524 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
525 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
526 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
527 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
528 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
529 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
530 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
531 print
'<div class="nowrap">';
532 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
534 print
'<div class="nowrap">';
535 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
537 } elseif ($key ==
'lang') {
538 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
540 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
542 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
549if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
550 print
'<td class="liste_titre minwidth100">';
551 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'', $conf->entity,
true);
556if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
557 print
'<td class="liste_titre">';
558 print $formresource->select_resource_list($resources,
'resources',
'',
'', 0,
'',
'', $conf->entity,
true, 0,
'',
true);
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;
571 print
'<td class="liste_titre center maxwidthsearch">';
572 $searchpicto = $form->showFilterButtons();
578$totalarray = array();
579$totalarray[
'nbfield'] = 0;
583print
'<tr class="liste_titre">';
586 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
587 $totalarray[
'nbfield']++;
589foreach ($object->fields as $key => $val) {
590 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
591 if ($key ==
'status') {
592 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
593 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
594 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
595 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
596 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
597 } 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'])) {
598 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
600 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
601 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
602 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";
603 $totalarray[
'nbfield']++;
608if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
609 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
613if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
614 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
618include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
620$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
621$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
622print $hookmanager->resPrint;
625 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
626 $totalarray[
'nbfield']++;
632$needToFetchEachLine = 0;
633if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
634 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
635 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
636 $needToFetchEachLine++;
645$savnbfield = $totalarray[
'nbfield'];
646$totalarray = array();
647$totalarray[
'nbfield'] = 0;
648$imaxinloop = ($limit ? min($num, $limit) : $num);
649while ($i < $imaxinloop) {
650 $obj = $db->fetch_object($resql);
656 $object->setVarsFromFetchObj($obj);
661 if ($mode ==
'kanban') {
663 print
'<tr class="trkanban"><td colspan="'.($savnbfield+1).
'">';
664 print
'<div class="box-flex-container kanban">';
668 if ($massactionbutton || $massaction) {
670 if (in_array($object->id, $arrayofselected)) {
674 print $object->getKanbanView(
'', array(
'selected' => $selected));
675 if ($i == ($imaxinloop - 1)) {
682 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
685 print
'<td class="nowrap center">';
686 if ($massactionbutton || $massaction) {
688 if (in_array($object->id, $arrayofselected)) {
691 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
695 $totalarray[
'nbfield']++;
698 foreach ($object->fields as $key => $val) {
699 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
700 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
701 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
702 } elseif ($key ==
'status') {
703 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
706 if (in_array($val[
'type'], array(
'timestamp'))) {
707 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
708 } elseif ($key ==
'ref') {
709 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
712 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
713 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
717 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
718 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
719 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric($object->$key)) {
720 print
' title="'.dol_escape_htmltag($object->$key).
'"';
723 if ($key ==
'status') {
724 print $object->getLibStatut(5);
725 } elseif ($key ==
'rowid') {
726 print $object->showOutputField($val, $key, $object->id,
'');
728 print $object->showOutputField($val, $key, $object->$key,
'');
732 $totalarray[
'nbfield']++;
734 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
736 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
738 if (!isset($totalarray[
'val'])) {
739 $totalarray[
'val'] = array();
741 if (!isset($totalarray[
'val'][
't.'.$key])) {
742 $totalarray[
'val'][
't.'.$key] = 0;
744 $totalarray[
'val'][
't.'.$key] += $object->$key;
749 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
752 if (count($object->usergroups) >= 4) {
753 $cssforli =
'tdoverflowmax60';
754 } elseif (count($object->usergroups) >= 2) {
755 $cssforli =
'tdoverflowmax80';
757 foreach ($object->usergroups as $id_group) {
759 $g->fetch($id_group);
760 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
763 print
'<td class="minwidth300imp nowraponall">';
764 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
768 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
771 if (count($object->resources) >= 4) {
772 $cssforli =
'tdoverflowmax60';
773 } elseif (count($object->resources) >= 2) {
774 $cssforli =
'tdoverflowmax80';
776 foreach ($object->resources as $id_resource) {
778 $r->fetch($id_resource);
779 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
782 print
'<td class="minwidth300imp">';
783 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
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;
795 print
'<td class="nowrap center">';
796 if ($massactionbutton || $massaction) {
798 if (in_array($object->id, $arrayofselected)) {
801 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
805 $totalarray[
'nbfield']++;
816include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
821 foreach ($arrayfields as $key => $val) {
822 if (!empty($val[
'checked'])) {
826 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
832$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
833$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
834print $hookmanager->resPrint;
836print
'</table>'.
"\n";
841if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
842 $hidegeneratedfilelistifempty = 1;
843 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
844 $hidegeneratedfilelistifempty = 0;
847 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
851 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
852 $urlsource .= str_replace(
'&',
'&', $param);
854 $filedir = $diroutputmassaction;
855 $genallowed = $permissiontoread;
856 $delallowed = $permissiontoadd;
858 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 to manage user groups.
static getAllResourcesOfWorkstation($fk_workstation)
Function used to get an array with all resources linked to a workstation.
static getAllGroupsOfWorkstation($fk_workstation)
Function used to get an array with all usergroups linked to a workstation.
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...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.