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';
35$langs->loadLangs(array(
'mrp',
'other'));
37$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
38$massaction =
GETPOST(
'massaction',
'alpha');
39$show_files =
GETPOST(
'show_files',
'int');
40$confirm =
GETPOST(
'confirm',
'alpha');
41$cancel =
GETPOST(
'cancel',
'alpha');
42$toselect =
GETPOST(
'toselect',
'array');
43$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'workstationlist';
44$backtopage =
GETPOST(
'backtopage',
'alpha');
45$optioncss =
GETPOST(
'optioncss',
'aZ');
51$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
52$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
55if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59$offset = $limit * $page;
66$diroutputmassaction = $conf->workstation->dir_output.
'/temp/massgeneration/'.$user->id;
67$hookmanager->initHooks(array(
'workstationlist'));
70$extrafields->fetch_name_optionals_label($object->table_element);
73$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
77 reset($object->fields);
78 $sortfield =
"t.".key($object->fields);
85$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
88foreach ($object->fields as $key => $val) {
89 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
90 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
92 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
93 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
94 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
98$groups =
GETPOST(
'groups',
'array:int');
99$resources =
GETPOST(
'resources',
'array: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'] :
''
125$arrayfields[
'wug.fk_usergroup'] = array(
126 'label'=>$langs->trans(
'UserGroups'),
127 'checked'=>(($visible < 0) ? 0 : 1),
128 'enabled'=>($visible != 3 &&
dol_eval($val[
'enabled'], 1)),
130 'help' => empty($val[
'help']) ?
'' : $val[
'help']
144include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
149$permissiontoread = $user->rights->workstation->workstation->read;
150$permissiontoadd = $user->rights->workstation->workstation->write;
151$permissiontodelete = $user->rights->workstation->workstation->delete;
154restrictedArea($user, $object->element, 0, $object->table_element,
'workstation');
161if (
GETPOST(
'cancel',
'alpha')) {
165if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
169$parameters = array();
170$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
175if (empty($reshook)) {
177 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
180 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
181 foreach ($object->fields as $key => $val) {
183 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
184 $search[$key.
'_dtstart'] =
'';
185 $search[$key.
'_dtend'] =
'';
188 $groups = $resources=array();
190 $search_array_options = array();
192 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
193 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
198 $objectclass =
'Workstation';
199 $objectlabel =
'Workstation';
200 $uploaddir = $conf->workstation->dir_output;
201 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
210$form =
new Form($db);
215$help_url =
'EN:Module_Workstation';
216$title = $langs->trans(
"Workstations");
224$sql .= $object->getFieldList(
't');
226if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
227 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
228 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
232$parameters = array();
233$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
234$sql .= $hookmanager->resPrint;
235$sql = preg_replace(
'/,\s*$/',
'', $sql);
236$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
237if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
238 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
240if (!empty($groups)) {
241 $sql.=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
243if (!empty($resources)) {
244 $sql.=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
247$parameters = array();
248$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
249$sql .= $hookmanager->resPrint;
250if ($object->ismultientitymanaged == 1) {
251 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
253 $sql .=
" WHERE 1 = 1";
255foreach ($search as $key => $val) {
256 if (array_key_exists($key, $object->fields)) {
257 if ($key ==
'status' && $search[$key] == -1) {
260 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
261 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
262 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
267 if ($search[$key] !=
'') {
268 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
271 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
272 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
273 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
274 if (preg_match(
'/_dtstart$/', $key)) {
275 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
277 if (preg_match(
'/_dtend$/', $key)) {
278 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
285 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
291if (!empty($groups)) {
292 $sql.=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
296if (!empty($resources)) {
297 $sql.=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
300include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
302$parameters = array();
303$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
304$sql .= $hookmanager->resPrint;
307foreach ($object->fields as $key => $val) {
308 $sql .=
"t.".$db->escape($key).
", ";
311if (! empty($extrafields->attributes[$object->table_element][
'label'])) {
312 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
313 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
317$parameters = array();
318$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
319$sql .= $hookmanager->resPrint;
320$sql = preg_replace(
'/,\s*$/',
'', $sql);
323$nbtotalofrecords =
'';
326 $resql = $db->query($sql);
327 $nbtotalofrecords = $db->num_rows($resql);
329 if (($page * $limit) > $nbtotalofrecords) {
337$sql .= $db->order($sortfield, $sortorder);
339 $sql .= $db->plimit($limit + 1, $offset);
342$resql = $db->query($sql);
348$num = $db->num_rows($resql);
352if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
353 $obj = $db->fetch_object($resql);
355 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.$id);
363llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
365$arrayofselected = is_array($toselect) ? $toselect : array();
369 $param .=
'&mode='.urlencode($mode);
371if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
372 $param .=
'&contextpage='.urlencode($contextpage);
374if ($limit > 0 && $limit != $conf->liste_limit) {
375 $param .=
'&limit='.((int) $limit);
377foreach ($search as $key => $val) {
378 if (is_array($search[$key]) && count($search[$key])) {
379 foreach ($search[$key] as $skey) {
381 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
384 } elseif ($search[$key] !=
'') {
385 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
388if ($optioncss !=
'') {
389 $param .=
'&optioncss='.urlencode($optioncss);
392include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
394$parameters = array();
395$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
396$param .= $hookmanager->resPrint;
399$arrayofmassactions = array(
405if ($permissiontodelete) {
406 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
408if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
409 $arrayofmassactions = array();
411$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
413print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
414if ($optioncss !=
'') {
415 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
417print
'<input type="hidden" name="token" value="'.newToken().
'">';
418print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
419print
'<input type="hidden" name="action" value="list">';
420print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
421print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
422print
'<input type="hidden" name="page" value="'.$page.
'">';
423print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
424print
'<input type="hidden" name="mode" value="'.$mode.
'">';
427$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
429print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
432$topicmail =
"SendWorkstationRef";
433$modelmail =
"workstation";
435$trackid =
'xxxx'.$object->id;
436include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
439 foreach ($fieldstosearchall as $key => $val) {
440 $fieldstosearchall[$key] = $langs->trans($val);
442 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
450$parameters = array();
451$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
452if (empty($reshook)) {
453 $moreforfilter .= $hookmanager->resPrint;
455 $moreforfilter = $hookmanager->resPrint;
458if (!empty($moreforfilter)) {
459 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
460 print $moreforfilter;
464$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
465$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
466$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
468print
'<div class="div-table-responsive">';
469print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
475print
'<tr class="liste_titre">';
478 print
'<td class="liste_titre maxwidthsearch">';
479 $searchpicto = $form->showFilterButtons(
'left');
483foreach ($object->fields as $key => $val) {
484 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
485 if ($key ==
'status') {
486 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
487 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
488 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
489 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
490 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
491 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
492 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
494 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
495 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
496 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
497 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
498 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
499 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
500 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
501 print
'<div class="nowrap">';
502 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
504 print
'<div class="nowrap">';
505 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
507 } elseif ($key ==
'lang') {
508 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
510 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
512 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
519if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
520 print
'<td class="liste_titre">';
521 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'', $conf->entity,
true);
526if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
527 print
'<td class="liste_titre">';
528 print $formresource->select_resource_list($resources,
'resources',
'',
'', 0,
'',
'', $conf->entity,
true, 0,
'',
true);
533include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
536$parameters = array(
'arrayfields'=>$arrayfields);
537$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
538print $hookmanager->resPrint;
541 print
'<td class="liste_titre maxwidthsearch">';
542 $searchpicto = $form->showFilterButtons();
548$totalarray = array();
549$totalarray[
'nbfield'] = 0;
553print
'<tr class="liste_titre">';
556 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
557 $totalarray[
'nbfield']++;
559foreach ($object->fields as $key => $val) {
560 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
561 if ($key ==
'status') {
562 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
563 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
564 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
565 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
566 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
567 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
568 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
570 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
571 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
572 $totalarray[
'nbfield']++;
577if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
578 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
582if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
583 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
587include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
589$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
590$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
591print $hookmanager->resPrint;
594 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
595 $totalaray[
'nbfield']++;
601$needToFetchEachLine = 0;
602if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
603 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
604 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
605 $needToFetchEachLine++;
614$savnbfield = $totalarray[
'nbfield'];
615$totalarray[
'nbfield'] = 0;
616$imaxinloop = ($limit ? min($num, $limit) : $num);
617while ($i < $imaxinloop) {
618 $obj = $db->fetch_object($resql);
624 $object->setVarsFromFetchObj($obj);
629 if ($mode ==
'kanban') {
631 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
632 print
'<div class="box-flex-container kanban">';
635 print $object->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
636 if ($i == ($imaxinloop - 1)) {
643 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
646 print
'<td class="nowrap center">';
647 if ($massactionbutton || $massaction) {
649 if (in_array($object->id, $arrayofselected)) {
652 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
656 $totalarray[
'nbfield']++;
659 foreach ($object->fields as $key => $val) {
660 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
661 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
662 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
663 } elseif ($key ==
'status') {
664 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
667 if (in_array($val[
'type'], array(
'timestamp'))) {
668 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
669 } elseif ($key ==
'ref') {
670 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
673 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
674 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
678 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
679 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
680 if ($key ==
'status') {
681 print $object->getLibStatut(5);
682 } elseif ($key ==
'rowid') {
683 print $object->showOutputField($val, $key, $object->id,
'');
685 print $object->showOutputField($val, $key, $object->$key,
'');
689 $totalarray[
'nbfield']++;
691 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
693 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
695 if (!isset($totalarray[
'val'])) {
696 $totalarray[
'val'] = array();
698 if (!isset($totalarray[
'val'][
't.'.$key])) {
699 $totalarray[
'val'][
't.'.$key] = 0;
701 $totalarray[
'val'][
't.'.$key] += $object->$key;
706 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
709 if (count($object->usergroups) >= 4) {
710 $cssforli =
'tdoverflowmax60';
711 } elseif (count($object->usergroups) >= 2) {
712 $cssforli =
'tdoverflowmax80';
714 foreach ($object->usergroups as $id_group) {
716 $g->fetch($id_group);
717 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
721 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
725 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
728 if (count($object->resources) >= 4) {
729 $cssforli =
'tdoverflowmax60';
730 } elseif (count($object->resources) >= 2) {
731 $cssforli =
'tdoverflowmax80';
733 foreach ($object->resources as $id_resource) {
735 $r->fetch($id_resource);
736 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
740 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
745 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
747 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
748 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
749 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);
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_workstation',
'', $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 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.
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.