29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
34require_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');
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_');
91 $sortfield =
"t.".key(
$object->fields);
98$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
101foreach (
$object->fields as $key => $val) {
102 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
103 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
105 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111$groups =
GETPOST(
'groups',
'array:int');
112$resources =
GETPOST(
'resources',
'array:int');
115$fieldstosearchall = array();
116foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'searchall'])) {
118 $fieldstosearchall[
't.'.$key] = $val[
'label'];
123$arrayfields = array();
124foreach (
$object->fields as $key => $val) {
126 if (!empty($val[
'visible'])) {
127 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
128 $arrayfields[
't.'.$key] = array(
129 'label' => $val[
'label'],
130 'checked' => (($visible < 0) ? 0 : 1),
131 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
132 'position' => $val[
'position'],
133 'help' => isset($val[
'help']) ? $val[
'help'] :
''
138$arrayfields[
'wug.fk_usergroup'] = array(
139 'label' => $langs->trans(
'UserGroups'),
140 'checked' => (($visible < 0) ? 0 : 1),
141 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
143 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
144 'csslist' =>
'minwidth100'
158include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
162'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
165$permissiontoread = $user->hasRight(
'workstation',
'workstation',
'read');
166$permissiontoadd = $user->hasRight(
'workstation',
'workstation',
'write');
167$permissiontodelete = $user->hasRight(
'workstation',
'workstation',
'delete');
178if (
GETPOST(
'cancel',
'alpha')) {
182if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
186$parameters = array();
187$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
192if (empty($reshook)) {
194 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
197 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
198 foreach (
$object->fields as $key => $val) {
200 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
201 $search[$key.
'_dtstart'] =
'';
202 $search[$key.
'_dtend'] =
'';
205 $groups = $resources = array();
207 $search_array_options = array();
209 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
210 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
215 $objectclass =
'Workstation';
216 $objectlabel =
'Workstation';
217 $uploaddir =
$conf->workstation->dir_output;
218 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
227$form =
new Form($db);
232$title = $langs->trans(
"Workstations");
233$help_url =
'EN:Module_Workstation';
242$sql .=
$object->getFieldList(
't');
244if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
245 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
247 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
252$parameters = array();
253$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
254$sql .= $hookmanager->resPrint;
255$sql = preg_replace(
'/,\s*$/',
'', $sql);
259$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
260if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
261 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
263if (!empty($groups)) {
264 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
266if (!empty($resources)) {
267 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
271$parameters = array();
272$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
273$sql .= $hookmanager->resPrint;
274if (
$object->ismultientitymanaged == 1) {
275 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
277 $sql .=
" WHERE 1 = 1";
279foreach ($search as $key => $val) {
280 if (array_key_exists($key,
$object->fields)) {
281 if ($key ==
'status' && $search[$key] == -1) {
285 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
286 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
291 if ($search[$key] !=
'') {
292 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
295 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
296 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
297 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
298 if (preg_match(
'/_dtstart$/', $key)) {
299 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
301 if (preg_match(
'/_dtend$/', $key)) {
302 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
309 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
315if (!empty($groups)) {
316 $sql .=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
320if (!empty($resources)) {
321 $sql .=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
324include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
326$parameters = array();
327$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
328$sql .= $hookmanager->resPrint;
331foreach (
$object->fields as $key => $val) {
332 $sql .=
"t.".$db->escape($key).
", ";
335if (! empty($extrafields->attributes[
$object->table_element][
'label'])) {
336 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
338 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
342$parameters = array();
343$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
344$sql .= $hookmanager->resPrint;
345$sql = preg_replace(
'/,\s*$/',
'', $sql);
348$nbtotalofrecords =
'';
351 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
352 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
354 $resql = $db->query($sqlforcount);
356 $objforcount = $db->fetch_object($resql);
357 $nbtotalofrecords = $objforcount->nbtotalofrecords;
362 if (($page * $limit) > $nbtotalofrecords) {
370$sql .= $db->order($sortfield, $sortorder);
372 $sql .= $db->plimit($limit + 1, $offset);
375$resql = $db->query($sql);
381$num = $db->num_rows($resql);
385if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
386 $obj = $db->fetch_object($resql);
388 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.((
int) $id));
396llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
398$arrayofselected = is_array($toselect) ? $toselect : array();
402 $param .=
'&mode='.urlencode($mode);
404if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
405 $param .=
'&contextpage='.urlencode($contextpage);
407if ($limit > 0 && $limit !=
$conf->liste_limit) {
408 $param .=
'&limit='.((int) $limit);
410if ($optioncss !=
'') {
411 $param .=
'&optioncss='.urlencode($optioncss);
413foreach ($search as $key => $val) {
414 if (is_array($search[$key])) {
415 foreach ($search[$key] as $skey) {
417 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
420 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
421 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
422 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
423 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
424 } elseif ($search[$key] !=
'') {
425 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
429include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
431$parameters = array(
'param' => &$param);
432$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
433$param .= $hookmanager->resPrint;
436$arrayofmassactions = array(
442if (!empty($permissiontodelete)) {
443 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
445if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
446 $arrayofmassactions = array();
448$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
450print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
451if ($optioncss !=
'') {
452 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
454print
'<input type="hidden" name="token" value="'.newToken().
'">';
455print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
456print
'<input type="hidden" name="action" value="list">';
457print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
458print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
459print
'<input type="hidden" name="page" value="'.$page.
'">';
460print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
461print
'<input type="hidden" name="page_y" value="">';
462print
'<input type="hidden" name="mode" value="'.$mode.
'">';
465$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'));
466$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'));
468$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
470print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
473$topicmail =
"SendWorkstationRef";
474$modelmail =
"workstation";
476$trackid =
'xxxx'.$object->id;
477include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
481 foreach ($fieldstosearchall as $key => $val) {
482 $fieldstosearchall[$key] = $langs->trans($val);
483 $setupstring .= $key.
"=".$val.
";";
485 print
'<!-- Search done like if WORKSTATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
486 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
494$parameters = array();
495$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
496if (empty($reshook)) {
497 $moreforfilter .= $hookmanager->resPrint;
499 $moreforfilter = $hookmanager->resPrint;
502if (!empty($moreforfilter)) {
503 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
504 print $moreforfilter;
508$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
509$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
510$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
511$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
513print
'<div class="div-table-responsive">';
514print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
520print
'<tr class="liste_titre_filter">';
523 print
'<td class="liste_titre center maxwidthsearch">';
524 $searchpicto = $form->showFilterButtons(
'left');
528foreach (
$object->fields as $key => $val) {
529 $searchkey = empty($search[$key]) ?
'' : $search[$key];
530 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
531 if ($key ==
'status') {
532 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
533 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
534 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
535 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
536 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
537 } 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'])) {
538 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
540 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
541 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
542 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
543 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);
544 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
545 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
546 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
547 print
'<div class="nowrap">';
548 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
550 print
'<div class="nowrap">';
551 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
553 } elseif ($key ==
'lang') {
554 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
556 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
558 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
565if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
566 print
'<td class="liste_titre minwidth100">';
567 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'',
$conf->entity,
true);
572if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
573 print
'<td class="liste_titre">';
574 print $formresource->select_resource_list($resources,
'resources', [],
'', 0,
'',
'',
$conf->entity,
true, 0,
'',
true);
579include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
582$parameters = array(
'arrayfields' => $arrayfields);
583$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
584print $hookmanager->resPrint;
587 print
'<td class="liste_titre center maxwidthsearch">';
588 $searchpicto = $form->showFilterButtons();
594$totalarray = array();
595$totalarray[
'nbfield'] = 0;
599print
'<tr class="liste_titre">';
602 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
603 $totalarray[
'nbfield']++;
605foreach (
$object->fields as $key => $val) {
606 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
607 if ($key ==
'status') {
608 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
609 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
610 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
611 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
612 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
613 } 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'])) {
614 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
616 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
617 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
618 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";
619 $totalarray[
'nbfield']++;
624if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
626 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
630if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
631 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
635include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
637$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
638$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
639print $hookmanager->resPrint;
642 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
643 $totalarray[
'nbfield']++;
649$needToFetchEachLine = 0;
650if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
651 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
652 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
653 $needToFetchEachLine++;
662$savnbfield = $totalarray[
'nbfield'];
663$totalarray = array();
664$totalarray[
'nbfield'] = 0;
665$imaxinloop = ($limit ? min($num, $limit) : $num);
666while ($i < $imaxinloop) {
667 $obj = $db->fetch_object($resql);
673 $object->setVarsFromFetchObj($obj);
678 if ($mode ==
'kanban') {
680 print
'<tr class="trkanban"><td colspan="'.($savnbfield + 1).
'">';
681 print
'<div class="box-flex-container kanban">';
685 if ($massactionbutton || $massaction) {
687 if (in_array(
$object->id, $arrayofselected)) {
691 print
$object->getKanbanView(
'', array(
'selected' => $selected));
692 if ($i == ($imaxinloop - 1)) {
699 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
702 print
'<td class="nowrap center">';
703 if ($massactionbutton || $massaction) {
705 if (in_array(
$object->id, $arrayofselected)) {
708 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
712 $totalarray[
'nbfield']++;
715 foreach (
$object->fields as $key => $val) {
716 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
717 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
718 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
719 } elseif ($key ==
'status') {
720 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
723 if (in_array($val[
'type'], array(
'timestamp'))) {
724 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
725 } elseif ($key ==
'ref') {
726 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
729 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'])) {
730 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
734 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
735 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
736 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
737 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
740 if ($key ==
'status') {
741 print
$object->getLibStatut(5);
742 } elseif ($key ==
'rowid') {
749 $totalarray[
'nbfield']++;
751 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
753 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
755 if (!isset($totalarray[
'val'])) {
756 $totalarray[
'val'] = array();
758 if (!isset($totalarray[
'val'][
't.'.$key])) {
759 $totalarray[
'val'][
't.'.$key] = 0;
761 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
766 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
769 if (count(
$object->usergroups) >= 4) {
770 $cssforli =
'tdoverflowmax60';
771 } elseif (count(
$object->usergroups) >= 2) {
772 $cssforli =
'tdoverflowmax80';
774 foreach (
$object->usergroups as $id_group) {
776 $g->fetch($id_group);
777 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
780 print
'<td class="minwidth300imp nowraponall">';
781 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
785 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
788 if (count(
$object->resources) >= 4) {
789 $cssforli =
'tdoverflowmax60';
790 } elseif (count(
$object->resources) >= 2) {
791 $cssforli =
'tdoverflowmax80';
793 foreach (
$object->resources as $id_resource) {
795 $r->fetch($id_resource);
796 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
799 print
'<td class="minwidth300imp">';
800 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
805 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
808 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
809 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
810 print $hookmanager->resPrint;
814 print
'<td class="nowrap center">';
815 if ($massactionbutton || $massaction) {
817 if (in_array(
$object->id, $arrayofselected)) {
820 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
824 $totalarray[
'nbfield']++;
835include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
840 foreach ($arrayfields as $key => $val) {
841 if (!empty($val[
'checked'])) {
845 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
851$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
852$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
853print $hookmanager->resPrint;
855print
'</table>'.
"\n";
860if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
861 $hidegeneratedfilelistifempty = 1;
862 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
863 $hidegeneratedfilelistifempty = 0;
866 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
870 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
871 $urlsource .= str_replace(
'&',
'&', $param);
873 $filedir = $diroutputmassaction;
874 $genallowed = $permissiontoread;
875 $delallowed = $permissiontoadd;
877 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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_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...
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)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
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...
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a 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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.