27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
35 $langs->loadLangs(array(
'workstation',
'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');
55 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59 $offset = $limit * $page;
60 $pageprev = $page - 1;
61 $pagenext = $page + 1;
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');
88 foreach ($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();
103 foreach ($object->fields as $key => $val) {
104 if (!empty($val[
'searchall'])) {
105 $fieldstosearchall[
't.'.$key] = $val[
'label'];
110 $arrayfields = array();
111 foreach ($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']
144 include 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;
154 restrictedArea($user, $object->element, 0, $object->table_element,
'workstation');
161 if (
GETPOST(
'cancel',
'alpha')) {
165 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
169 $parameters = array();
170 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
175 if (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';
216 $title = $langs->trans(
'ListOf', $langs->transnoentitiesnoconv(
"Workstations"));
224 $sql .= $object->getFieldList(
't');
226 if (!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 .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
235 $sql = preg_replace(
'/,\s*$/',
'', $sql);
236 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
237 if (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)";
240 if (!empty($groups)) {
241 $sql.=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
243 if (!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;
250 if ($object->ismultientitymanaged == 1) {
251 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
253 $sql .=
" WHERE 1 = 1";
255 foreach ($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);
291 if (!empty($groups)) {
292 $sql.=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
296 if (!empty($resources)) {
297 $sql.=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
300 include 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;
307 foreach ($object->fields as $key => $val) {
308 $sql .=
"t.".$db->escape($key).
", ";
311 if (! 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);
324 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
326 $resql = $db->query($sql);
337 $sql .= $db->order($sortfield, $sortorder);
339 $sql .= $db->plimit($limit + 1, $offset);
342 $resql = $db->query($sql);
348 $num = $db->num_rows(
$resql);
352 if ($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);
363 llxHeader(
'', $title,
$help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
365 $arrayofselected = is_array($toselect) ? $toselect : array();
369 $param .=
'&mode='.urlencode($mode);
371 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
372 $param .=
'&contextpage='.urlencode($contextpage);
374 if ($limit > 0 && $limit != $conf->liste_limit) {
375 $param .=
'&limit='.urlencode($limit);
377 foreach ($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]);
388 if ($optioncss !=
'') {
389 $param .=
'&optioncss='.urlencode($optioncss);
392 include 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(
405 if ($permissiontodelete) {
406 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
408 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
409 $arrayofmassactions = array();
411 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
413 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
414 if ($optioncss !=
'') {
415 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
417 print
'<input type="hidden" name="token" value="'.newToken().
'">';
418 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
419 print
'<input type="hidden" name="action" value="list">';
420 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
421 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
422 print
'<input type="hidden" name="page" value="'.$page.
'">';
423 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
424 print
'<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);
429 print_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;
436 include 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);
452 if (empty($reshook)) {
453 $moreforfilter .= $hookmanager->resPrint;
455 $moreforfilter = $hookmanager->resPrint;
458 if (!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);
466 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
468 print
'<div class="div-table-responsive">';
469 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
475 print
'<tr class="liste_titre">';
476 foreach ($object->fields as $key => $val) {
477 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
478 if ($key ==
'status') {
479 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
480 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
481 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
482 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
483 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
484 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
485 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
487 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
488 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
489 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
490 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
491 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
492 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
493 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
494 print
'<div class="nowrap">';
495 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
497 print
'<div class="nowrap">';
498 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
500 } elseif ($key ==
'lang') {
501 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
503 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
505 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
512 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
513 print
'<td class="liste_titre">';
514 print
$form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'', $conf->entity,
true);
519 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
520 print
'<td class="liste_titre">';
521 print $formresource->select_resource_list($resources,
'resources',
'',
'', 0,
'',
'', $conf->entity,
true, 0,
'',
true);
526 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
529 $parameters = array(
'arrayfields'=>$arrayfields);
530 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
531 print $hookmanager->resPrint;
533 print
'<td class="liste_titre maxwidthsearch">';
534 $searchpicto =
$form->showFilterButtons();
539 $totalarray = array();
540 $totalarray[
'nbfield'] = 0;
544 print
'<tr class="liste_titre">';
545 foreach ($object->fields as $key => $val) {
546 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
547 if ($key ==
'status') {
548 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
549 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
550 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
551 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
552 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
553 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
554 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
556 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
557 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
558 $totalarray[
'nbfield']++;
563 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
564 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
568 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
569 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
573 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
575 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
576 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
577 print $hookmanager->resPrint;
579 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
580 $totalarray[
'nbfield']++;
585 $needToFetchEachLine = 0;
586 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
587 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
588 if (preg_match(
'/\$object/', $val)) {
589 $needToFetchEachLine++;
598 $savnbfield = $totalarray[
'nbfield'];
599 $totalarray[
'nbfield'] = 0;
600 $imaxinloop = ($limit ? min($num, $limit) : $num);
601 while ($i < $imaxinloop) {
602 $obj = $db->fetch_object(
$resql);
608 $object->setVarsFromFetchObj($obj);
613 if ($mode ==
'kanban') {
615 print
'<tr><td colspan="'.$savnbfield.
'">';
616 print
'<div class="box-flex-container">';
619 print $object->getKanbanView(
'');
620 if ($i == ($imaxinloop - 1)) {
627 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
628 foreach ($object->fields as $key => $val) {
629 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
630 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
631 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
632 } elseif ($key ==
'status') {
633 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
636 if (in_array($val[
'type'], array(
'timestamp'))) {
637 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
638 } elseif ($key ==
'ref') {
639 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
642 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
643 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
647 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
648 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
649 if ($key ==
'status') {
650 print $object->getLibStatut(5);
651 } elseif ($key ==
'rowid') {
652 print $object->showOutputField($val, $key, $object->id,
'');
654 print $object->showOutputField($val, $key, $object->$key,
'');
658 $totalarray[
'nbfield']++;
660 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
662 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
664 if (!isset($totalarray[
'val'])) {
665 $totalarray[
'val'] = array();
667 if (!isset($totalarray[
'val'][
't.'.$key])) {
668 $totalarray[
'val'][
't.'.$key] = 0;
670 $totalarray[
'val'][
't.'.$key] += $object->$key;
675 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
678 if (count($object->usergroups) >= 4) {
679 $cssforli =
'tdoverflowmax60';
680 } elseif (count($object->usergroups) >= 2) {
681 $cssforli =
'tdoverflowmax80';
683 foreach ($object->usergroups as $id_group) {
685 $g->fetch($id_group);
686 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
690 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
694 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
697 if (count($object->resources) >= 4) {
698 $cssforli =
'tdoverflowmax60';
699 } elseif (count($object->resources) >= 2) {
700 $cssforli =
'tdoverflowmax80';
702 foreach ($object->resources as $id_resource) {
704 $r->fetch($id_resource);
705 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
709 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
714 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
716 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
717 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
718 print $hookmanager->resPrint;
720 print
'<td class="nowrap center">';
721 if ($massactionbutton || $massaction) {
723 if (in_array($object->id, $arrayofselected)) {
726 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
730 $totalarray[
'nbfield']++;
740 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
745 foreach ($arrayfields as $key => $val) {
746 if (!empty($val[
'checked'])) {
750 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
756 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
757 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
758 print $hookmanager->resPrint;
760 print
'</table>'.
"\n";
763 print
'</form>'.
"\n";
766 $hidegeneratedfilelistifempty = 1;
767 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
768 $hidegeneratedfilelistifempty = 0;
771 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
775 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
776 $urlsource .= str_replace(
'&',
'&', $param);
778 $filedir = $diroutputmassaction;
779 $genallowed = $permissiontoread;
780 $delallowed = $permissiontoadd;
782 print $formfile->showdocuments(
'massfilesarea_workstation',
'', $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 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.
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.
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.
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.
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.