29require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
45$langs->loadLangs(array(
'mrp',
'other'));
47$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
48$massaction =
GETPOST(
'massaction',
'alpha');
50$confirm =
GETPOST(
'confirm',
'alpha');
51$cancel =
GETPOST(
'cancel',
'alpha');
52$toselect =
GETPOST(
'toselect',
'array:int');
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
54$backtopage =
GETPOST(
'backtopage',
'alpha');
55$optioncss =
GETPOST(
'optioncss',
'aZ');
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
72$offset = $limit * $page;
79$diroutputmassaction =
$conf->workstation->dir_output.
'/temp/massgeneration/'.$user->id;
80$hookmanager->initHooks(array(
'workstationlist'));
83$extrafields->fetch_name_optionals_label(
$object->table_element);
86$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
97$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
100foreach (
$object->fields as $key => $val) {
101 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
102 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
110$groups =
GETPOST(
'groups',
'array:int');
111$resources =
GETPOST(
'resources',
'array:int');
114$fieldstosearchall = array();
115foreach (
$object->fields as $key => $val) {
116 if (!empty($val[
'searchall'])) {
117 $fieldstosearchall[
't.'.$key] = $val[
'label'];
122$arrayfields = array();
123foreach (
$object->fields as $key => $val) {
125 if (!empty($val[
'visible'])) {
126 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
127 $arrayfields[
't.'.$key] = array(
128 'label' => $val[
'label'],
129 'checked' => (($visible < 0) ?
'0' :
'1'),
130 'enabled' => (
string) (int) (abs($visible) != 3 && (bool)
dol_eval((
string) $val[
'enabled'], 1)),
131 'position' => $val[
'position'],
132 'help' => isset($val[
'help']) ? $val[
'help'] :
''
137$arrayfields[
'wug.fk_usergroup'] = array(
138 'label' => $langs->trans(
'UserGroups'),
142 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
143 'csslist' =>
'minwidth100'
157include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
159$parameters = array(
'arrayfields' => &$arrayfields);
160$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
166$permissiontoread = $user->hasRight(
'workstation',
'workstation',
'read');
167$permissiontoadd = $user->hasRight(
'workstation',
'workstation',
'write');
168$permissiontodelete = $user->hasRight(
'workstation',
'workstation',
'delete');
179if (
GETPOST(
'cancel',
'alpha')) {
183if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
187$parameters = array();
188$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193if (empty($reshook)) {
195 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
198 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
199 foreach (
$object->fields as $key => $val) {
201 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
202 $search[$key.
'_dtstart'] =
'';
203 $search[$key.
'_dtend'] =
'';
206 $groups = $resources = array();
208 $search_array_options = array();
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
211 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
216 $objectclass =
'Workstation';
217 $objectlabel =
'Workstation';
218 $uploaddir =
$conf->workstation->dir_output;
219 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
233$title = $langs->trans(
"Workstations");
234$help_url =
'EN:Module_Workstation';
243$sql .=
$object->getFieldList(
't');
245if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
246 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
248 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
253$parameters = array();
254$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
255$sql .= $hookmanager->resPrint;
256$sql = preg_replace(
'/,\s*$/',
'', $sql);
260$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
261if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
262 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
264if (!empty($groups)) {
265 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
267if (!empty($resources)) {
268 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
272$parameters = array();
273$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
274$sql .= $hookmanager->resPrint;
275if (
$object->ismultientitymanaged == 1) {
276 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
278 $sql .=
" WHERE 1 = 1";
280foreach ($search as $key => $val) {
281 if (array_key_exists($key,
$object->fields)) {
282 if ($key ==
'status' && $search[$key] == -1) {
286 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
287 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
292 if ($search[$key] !=
'') {
293 $sql .=
natural_search(
"t.".
$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
296 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
297 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
298 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
299 if (preg_match(
'/_dtstart$/', $key)) {
300 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".
$db->idate($search[$key]).
"'";
302 if (preg_match(
'/_dtend$/', $key)) {
303 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".
$db->idate($search[$key]).
"'";
310 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
316if (!empty($groups)) {
317 $sql .=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
321if (!empty($resources)) {
322 $sql .=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
325include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
327$parameters = array();
328$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
329$sql .= $hookmanager->resPrint;
332foreach (
$object->fields as $key => $val) {
333 $sql .=
"t.".$db->sanitize($key).
", ";
336if (! empty($extrafields->attributes[
$object->table_element][
'label'])) {
337 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
339 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
343$parameters = array();
344$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
345$sql .= $hookmanager->resPrint;
346$sql = preg_replace(
'/,\s*$/',
'', $sql);
349$nbtotalofrecords =
'';
352 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
353 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
355 $resql =
$db->query($sqlforcount);
357 $objforcount =
$db->fetch_object($resql);
358 $nbtotalofrecords = $objforcount->nbtotalofrecords;
363 if (($page * $limit) > (
int) $nbtotalofrecords) {
371$sql .=
$db->order($sortfield, $sortorder);
373 $sql .=
$db->plimit($limit + 1, $offset);
376$resql =
$db->query($sql);
382$num =
$db->num_rows($resql);
386if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
387 $obj =
$db->fetch_object($resql);
389 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.((
int) $id));
397llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
399$arrayofselected = is_array($toselect) ? $toselect : array();
403 $param .=
'&mode='.urlencode($mode);
405if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
406 $param .=
'&contextpage='.urlencode($contextpage);
408if ($limit > 0 && $limit !=
$conf->liste_limit) {
409 $param .=
'&limit='.((int) $limit);
411if ($optioncss !=
'') {
412 $param .=
'&optioncss='.urlencode($optioncss);
414foreach ($search as $key => $val) {
415 if (is_array($search[$key])) {
416 foreach ($search[$key] as $skey) {
418 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
421 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
422 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
423 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
424 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
425 } elseif ($search[$key] !=
'') {
426 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
430include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
432$parameters = array(
'param' => &$param);
433$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
434$param .= $hookmanager->resPrint;
437$arrayofmassactions = array(
443if (!empty($permissiontodelete)) {
444 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
446if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
447 $arrayofmassactions = array();
449$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
451print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
452if ($optioncss !=
'') {
453 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
455print
'<input type="hidden" name="token" value="'.newToken().
'">';
456print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
457print
'<input type="hidden" name="action" value="list">';
458print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
459print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
460print
'<input type="hidden" name="page" value="'.$page.
'">';
461print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
462print
'<input type="hidden" name="page_y" value="">';
463print
'<input type="hidden" name="mode" value="'.$mode.
'">';
466$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'));
467$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'));
469$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
471print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
474$topicmail =
"SendWorkstationRef";
475$modelmail =
"workstation";
477$trackid =
'xxxx'.$object->id;
478include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
482 foreach ($fieldstosearchall as $key => $val) {
483 $fieldstosearchall[$key] = $langs->trans($val);
484 $setupstring .= $key.
"=".$val.
";";
486 print
'<!-- Search done like if WORKSTATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
487 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
495$parameters = array();
496$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
497if (empty($reshook)) {
498 $moreforfilter .= $hookmanager->resPrint;
500 $moreforfilter = $hookmanager->resPrint;
503if (!empty($moreforfilter)) {
504 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
505 print $moreforfilter;
509$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
510$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
511$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
512$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
514print
'<div class="div-table-responsive">';
515print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
521print
'<tr class="liste_titre_filter">';
523if (
$conf->main_checkbox_left_column) {
524 print
'<td class="liste_titre center maxwidthsearch">';
525 $searchpicto = $form->showFilterButtons(
'left');
529foreach (
$object->fields as $key => $val) {
530 $searchkey = empty($search[$key]) ?
'' : $search[$key];
531 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
532 if ($key ==
'status') {
533 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
534 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
535 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
536 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
537 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
538 } 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'])) {
539 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
541 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
542 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
543 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
544 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);
545 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
546 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
547 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
548 print
'<div class="nowrap">';
549 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
551 print
'<div class="nowrap">';
552 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
554 } elseif ($key ==
'lang') {
555 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
557 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
559 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
566if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
567 print
'<td class="liste_titre minwidth100">';
568 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'', array(), (
string)
$conf->entity,
true);
573if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
574 print
'<td class="liste_titre">';
575 print $formresource->select_resource_list($resources,
'resources',
'', 0, 0, 0, array(), (
string)
$conf->entity, 1, 0,
'',
true);
580include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
583$parameters = array(
'arrayfields' => $arrayfields);
584$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
585print $hookmanager->resPrint;
587if (!
$conf->main_checkbox_left_column) {
588 print
'<td class="liste_titre center maxwidthsearch">';
589 $searchpicto = $form->showFilterButtons();
600print
'<tr class="liste_titre">';
602if (
$conf->main_checkbox_left_column) {
603 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
606foreach (
$object->fields as $key => $val) {
607 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
608 if ($key ==
'status') {
609 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
610 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
611 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
612 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
613 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
614 } 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'])) {
615 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
617 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
618 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
619 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";
625if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
627 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
631if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
632 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
636include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
638$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
639$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
640print $hookmanager->resPrint;
642if (!
$conf->main_checkbox_left_column) {
643 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
650$needToFetchEachLine = 0;
651if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
652 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
653 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
654 $needToFetchEachLine++;
666$imaxinloop = ($limit ? min($num, $limit) : $num);
667while ($i < $imaxinloop) {
668 $obj =
$db->fetch_object($resql);
674 $object->setVarsFromFetchObj($obj);
679 if ($mode ==
'kanban') {
681 print
'<tr class="trkanban"><td colspan="'.($savnbfield + 1).
'">';
682 print
'<div class="box-flex-container kanban">';
686 if ($massactionbutton || $massaction) {
688 if (in_array(
$object->id, $arrayofselected)) {
692 print
$object->getKanbanView(
'', array(
'selected' => $selected));
693 if ($i == ($imaxinloop - 1)) {
700 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
702 if (
$conf->main_checkbox_left_column) {
703 print
'<td class="nowrap center">';
704 if ($massactionbutton || $massaction) {
706 if (in_array(
$object->id, $arrayofselected)) {
709 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
716 foreach (
$object->fields as $key => $val) {
717 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
718 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
719 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
720 } elseif ($key ==
'status') {
721 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
724 if (in_array($val[
'type'], array(
'timestamp'))) {
725 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
726 } elseif ($key ==
'ref') {
727 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
730 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'])) {
731 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
735 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
736 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
737 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
738 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
741 if ($key ==
'status') {
742 print
$object->getLibStatut(5);
743 } elseif ($key ==
'rowid') {
744 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
752 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
756 if (!isset($totalarray[
'val'])) {
759 if (!isset($totalarray[
'val'][
't.'.$key])) {
767 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
770 if (count(
$object->usergroups) >= 4) {
771 $cssforli =
'tdoverflowmax60';
772 } elseif (count(
$object->usergroups) >= 2) {
773 $cssforli =
'tdoverflowmax80';
775 foreach (
$object->usergroups as $id_group) {
777 $g->fetch($id_group);
778 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
781 print
'<td class="minwidth300imp nowraponall">';
782 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
786 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
789 if (count(
$object->resources) >= 4) {
790 $cssforli =
'tdoverflowmax60';
791 } elseif (count(
$object->resources) >= 2) {
792 $cssforli =
'tdoverflowmax80';
794 foreach (
$object->resources as $id_resource) {
796 $r->fetch($id_resource);
797 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
800 print
'<td class="minwidth300imp">';
801 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
806 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
809 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
810 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
811 print $hookmanager->resPrint;
814 if (!
$conf->main_checkbox_left_column) {
815 print
'<td class="nowrap center">';
816 if ($massactionbutton || $massaction) {
818 if (in_array(
$object->id, $arrayofselected)) {
821 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
836include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
841 foreach ($arrayfields as $key => $val) {
842 if (!empty($val[
'checked'])) {
846 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
852$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
853$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
854print $hookmanager->resPrint;
856print
'</table>'.
"\n";
861if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
862 $hidegeneratedfilelistifempty = 1;
863 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
864 $hidegeneratedfilelistifempty = 0;
867 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
871 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
872 $urlsource .= str_replace(
'&',
'&', $param);
874 $filedir = $diroutputmassaction;
875 $genallowed = $permissiontoread;
876 $delallowed = $permissiontoadd;
878 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.