28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/resource/class/html.formresource.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/workstation/class/workstation.class.php';
35global $conf, $db, $hookmanager, $langs, $user;
38$langs->loadLangs(array(
'mrp',
'other'));
40$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
41$massaction =
GETPOST(
'massaction',
'alpha');
43$confirm =
GETPOST(
'confirm',
'alpha');
44$cancel =
GETPOST(
'cancel',
'alpha');
45$toselect =
GETPOST(
'toselect',
'array');
46$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
47$backtopage =
GETPOST(
'backtopage',
'alpha');
48$optioncss =
GETPOST(
'optioncss',
'aZ');
56$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
57$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
59if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
63$offset = $limit * $page;
70$diroutputmassaction = $conf->workstation->dir_output.
'/temp/massgeneration/'.$user->id;
71$hookmanager->initHooks(array(
'workstationlist'));
74$extrafields->fetch_name_optionals_label(
$object->table_element);
77$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
82 $sortfield =
"t.".key(
$object->fields);
89$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
92foreach (
$object->fields as $key => $val) {
93 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
94 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
96 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
102$groups =
GETPOST(
'groups',
'array:int');
103$resources =
GETPOST(
'resources',
'array:int');
106$fieldstosearchall = array();
107foreach (
$object->fields as $key => $val) {
108 if (!empty($val[
'searchall'])) {
109 $fieldstosearchall[
't.'.$key] = $val[
'label'];
114$arrayfields = array();
115foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'visible'])) {
118 $visible = (int)
dol_eval($val[
'visible'], 1);
119 $arrayfields[
't.'.$key] = array(
120 'label' => $val[
'label'],
121 'checked' => (($visible < 0) ? 0 : 1),
122 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
123 'position' => $val[
'position'],
124 'help' => isset($val[
'help']) ? $val[
'help'] :
''
129$arrayfields[
'wug.fk_usergroup'] = array(
130 'label' => $langs->trans(
'UserGroups'),
131 'checked' => (($visible < 0) ? 0 : 1),
132 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
134 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
135 'csslist' =>
'minwidth100'
149include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
153'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
155$permissiontoread = $user->hasRight(
'workstation',
'workstation',
'read');
156$permissiontoadd = $user->hasRight(
'workstation',
'workstation',
'write');
157$permissiontodelete = $user->hasRight(
'workstation',
'workstation',
'delete');
167if (
GETPOST(
'cancel',
'alpha')) {
171if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
175$parameters = array();
176$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
181if (empty($reshook)) {
183 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
186 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
187 foreach (
$object->fields as $key => $val) {
189 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
190 $search[$key.
'_dtstart'] =
'';
191 $search[$key.
'_dtend'] =
'';
194 $groups = $resources = array();
196 $search_array_options = array();
198 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
199 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
204 $objectclass =
'Workstation';
205 $objectlabel =
'Workstation';
206 $uploaddir = $conf->workstation->dir_output;
207 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
216$form =
new Form($db);
221$title = $langs->trans(
"Workstations");
222$help_url =
'EN:Module_Workstation';
230$sql .=
$object->getFieldList(
't');
232if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
233 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
235 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
239$parameters = array();
240$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
241$sql .= $hookmanager->resPrint;
242$sql = preg_replace(
'/,\s*$/',
'', $sql);
246$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
247if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
248 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
250if (!empty($groups)) {
251 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
253if (!empty($resources)) {
254 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
257$parameters = array();
258$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
259$sql .= $hookmanager->resPrint;
260if (
$object->ismultientitymanaged == 1) {
261 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
263 $sql .=
" WHERE 1 = 1";
265foreach ($search as $key => $val) {
266 if (array_key_exists($key,
$object->fields)) {
267 if ($key ==
'status' && $search[$key] == -1) {
271 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
272 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
277 if ($search[$key] !=
'') {
278 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
281 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
282 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
283 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
284 if (preg_match(
'/_dtstart$/', $key)) {
285 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
287 if (preg_match(
'/_dtend$/', $key)) {
288 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
295 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
301if (!empty($groups)) {
302 $sql .=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
306if (!empty($resources)) {
307 $sql .=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
310include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
312$parameters = array();
313$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
314$sql .= $hookmanager->resPrint;
317foreach (
$object->fields as $key => $val) {
318 $sql .=
"t.".$db->escape($key).
", ";
321if (! empty($extrafields->attributes[
$object->table_element][
'label'])) {
322 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
324 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
328$parameters = array();
329$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
330$sql .= $hookmanager->resPrint;
331$sql = preg_replace(
'/,\s*$/',
'', $sql);
334$nbtotalofrecords =
'';
337 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
338 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
340 $resql = $db->query($sqlforcount);
342 $objforcount = $db->fetch_object($resql);
343 $nbtotalofrecords = $objforcount->nbtotalofrecords;
348 if (($page * $limit) > $nbtotalofrecords) {
356$sql .= $db->order($sortfield, $sortorder);
358 $sql .= $db->plimit($limit + 1, $offset);
361$resql = $db->query($sql);
367$num = $db->num_rows($resql);
371if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
372 $obj = $db->fetch_object($resql);
374 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.((
int) $id));
382llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
384$arrayofselected = is_array($toselect) ? $toselect : array();
388 $param .=
'&mode='.urlencode($mode);
390if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
391 $param .=
'&contextpage='.urlencode($contextpage);
393if ($limit > 0 && $limit != $conf->liste_limit) {
394 $param .=
'&limit='.((int) $limit);
396if ($optioncss !=
'') {
397 $param .=
'&optioncss='.urlencode($optioncss);
399foreach ($search as $key => $val) {
400 if (is_array($search[$key])) {
401 foreach ($search[$key] as $skey) {
403 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
406 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
407 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
408 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
409 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
410 } elseif ($search[$key] !=
'') {
411 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
415include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
417$parameters = array(
'param' => &$param);
418$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
419$param .= $hookmanager->resPrint;
422$arrayofmassactions = array(
428if (!empty($permissiontodelete)) {
429 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
431if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
432 $arrayofmassactions = array();
434$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
436print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
437if ($optioncss !=
'') {
438 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
440print
'<input type="hidden" name="token" value="'.newToken().
'">';
441print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
442print
'<input type="hidden" name="action" value="list">';
443print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
444print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
445print
'<input type="hidden" name="page" value="'.$page.
'">';
446print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
447print
'<input type="hidden" name="page_y" value="">';
448print
'<input type="hidden" name="mode" value="'.$mode.
'">';
451$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'));
452$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'));
454$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
456print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
459$topicmail =
"SendWorkstationRef";
460$modelmail =
"workstation";
462$trackid =
'xxxx'.$object->id;
463include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
467 foreach ($fieldstosearchall as $key => $val) {
468 $fieldstosearchall[$key] = $langs->trans($val);
469 $setupstring .= $key.
"=".$val.
";";
471 print
'<!-- Search done like if WORKSTATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
472 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
480$parameters = array();
481$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
482if (empty($reshook)) {
483 $moreforfilter .= $hookmanager->resPrint;
485 $moreforfilter = $hookmanager->resPrint;
488if (!empty($moreforfilter)) {
489 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
490 print $moreforfilter;
491 $parameters = array();
492 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
493 print $hookmanager->resPrint;
497$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
498$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
499$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
500$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
502print
'<div class="div-table-responsive">';
503print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
509print
'<tr class="liste_titre_filter">';
512 print
'<td class="liste_titre center maxwidthsearch">';
513 $searchpicto = $form->showFilterButtons(
'left');
517foreach (
$object->fields as $key => $val) {
518 $searchkey = empty($search[$key]) ?
'' : $search[$key];
519 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
520 if ($key ==
'status') {
521 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
522 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
523 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
524 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
525 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
526 } 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'])) {
527 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
529 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
530 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
531 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
532 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);
533 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
534 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
535 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
536 print
'<div class="nowrap">';
537 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
539 print
'<div class="nowrap">';
540 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
542 } elseif ($key ==
'lang') {
543 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
545 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
547 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
554if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
555 print
'<td class="liste_titre minwidth100">';
556 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'', $conf->entity,
true);
561if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
562 print
'<td class="liste_titre">';
563 print $formresource->select_resource_list($resources,
'resources', [],
'', 0,
'',
'', $conf->entity,
true, 0,
'',
true);
568include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
571$parameters = array(
'arrayfields' => $arrayfields);
572$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
573print $hookmanager->resPrint;
576 print
'<td class="liste_titre center maxwidthsearch">';
577 $searchpicto = $form->showFilterButtons();
583$totalarray = array();
584$totalarray[
'nbfield'] = 0;
588print
'<tr class="liste_titre">';
591 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
592 $totalarray[
'nbfield']++;
594foreach (
$object->fields as $key => $val) {
595 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
596 if ($key ==
'status') {
597 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
598 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
599 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
600 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
601 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
602 } 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'])) {
603 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
605 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
606 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
607 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";
608 $totalarray[
'nbfield']++;
613if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
614 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
618if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
619 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
623include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
625$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
626$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
627print $hookmanager->resPrint;
630 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
631 $totalarray[
'nbfield']++;
637$needToFetchEachLine = 0;
638if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
639 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
640 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
641 $needToFetchEachLine++;
650$savnbfield = $totalarray[
'nbfield'];
651$totalarray = array();
652$totalarray[
'nbfield'] = 0;
653$imaxinloop = ($limit ? min($num, $limit) : $num);
654while ($i < $imaxinloop) {
655 $obj = $db->fetch_object($resql);
661 $object->setVarsFromFetchObj($obj);
666 if ($mode ==
'kanban') {
668 print
'<tr class="trkanban"><td colspan="'.($savnbfield + 1).
'">';
669 print
'<div class="box-flex-container kanban">';
673 if ($massactionbutton || $massaction) {
675 if (in_array(
$object->id, $arrayofselected)) {
679 print
$object->getKanbanView(
'', array(
'selected' => $selected));
680 if ($i == ($imaxinloop - 1)) {
687 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
690 print
'<td class="nowrap center">';
691 if ($massactionbutton || $massaction) {
693 if (in_array(
$object->id, $arrayofselected)) {
696 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
700 $totalarray[
'nbfield']++;
703 foreach (
$object->fields as $key => $val) {
704 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
705 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
706 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
707 } elseif ($key ==
'status') {
708 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
711 if (in_array($val[
'type'], array(
'timestamp'))) {
712 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
713 } elseif ($key ==
'ref') {
714 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
717 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'])) {
718 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
722 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
723 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
724 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
725 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
728 if ($key ==
'status') {
729 print
$object->getLibStatut(5);
730 } elseif ($key ==
'rowid') {
737 $totalarray[
'nbfield']++;
739 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
741 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
743 if (!isset($totalarray[
'val'])) {
744 $totalarray[
'val'] = array();
746 if (!isset($totalarray[
'val'][
't.'.$key])) {
747 $totalarray[
'val'][
't.'.$key] = 0;
749 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
754 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
757 if (count(
$object->usergroups) >= 4) {
758 $cssforli =
'tdoverflowmax60';
759 } elseif (count(
$object->usergroups) >= 2) {
760 $cssforli =
'tdoverflowmax80';
762 foreach (
$object->usergroups as $id_group) {
764 $g->fetch($id_group);
765 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
768 print
'<td class="minwidth300imp nowraponall">';
769 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
773 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
776 if (count(
$object->resources) >= 4) {
777 $cssforli =
'tdoverflowmax60';
778 } elseif (count(
$object->resources) >= 2) {
779 $cssforli =
'tdoverflowmax80';
781 foreach (
$object->resources as $id_resource) {
783 $r->fetch($id_resource);
784 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
787 print
'<td class="minwidth300imp">';
788 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
793 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
795 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
796 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
797 print $hookmanager->resPrint;
800 print
'<td class="nowrap center">';
801 if ($massactionbutton || $massaction) {
803 if (in_array(
$object->id, $arrayofselected)) {
806 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
810 $totalarray[
'nbfield']++;
821include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
826 foreach ($arrayfields as $key => $val) {
827 if (!empty($val[
'checked'])) {
831 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
837$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
838$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
839print $hookmanager->resPrint;
841print
'</table>'.
"\n";
846if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
847 $hidegeneratedfilelistifempty = 1;
848 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
849 $hidegeneratedfilelistifempty = 0;
852 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
856 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
857 $urlsource .= str_replace(
'&',
'&', $param);
859 $filedir = $diroutputmassaction;
860 $genallowed = $permissiontoread;
861 $delallowed = $permissiontoadd;
863 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...
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.
print_barre_liste($title, $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.
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.
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...
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.