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';
36global $conf, $db, $hookmanager, $langs, $user;
39$langs->loadLangs(array(
'mrp',
'other'));
41$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
42$massaction =
GETPOST(
'massaction',
'alpha');
44$confirm =
GETPOST(
'confirm',
'alpha');
45$cancel =
GETPOST(
'cancel',
'alpha');
46$toselect =
GETPOST(
'toselect',
'array');
47$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
48$backtopage =
GETPOST(
'backtopage',
'alpha');
49$optioncss =
GETPOST(
'optioncss',
'aZ');
57$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
64$offset = $limit * $page;
71$diroutputmassaction = $conf->workstation->dir_output.
'/temp/massgeneration/'.$user->id;
72$hookmanager->initHooks(array(
'workstationlist'));
75$extrafields->fetch_name_optionals_label(
$object->table_element);
78$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
83 $sortfield =
"t.".key(
$object->fields);
90$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
93foreach (
$object->fields as $key => $val) {
94 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
95 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
97 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
103$groups =
GETPOST(
'groups',
'array:int');
104$resources =
GETPOST(
'resources',
'array:int');
107$fieldstosearchall = array();
108foreach (
$object->fields as $key => $val) {
109 if (!empty($val[
'searchall'])) {
110 $fieldstosearchall[
't.'.$key] = $val[
'label'];
115$arrayfields = array();
116foreach (
$object->fields as $key => $val) {
118 if (!empty($val[
'visible'])) {
119 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
120 $arrayfields[
't.'.$key] = array(
121 'label' => $val[
'label'],
122 'checked' => (($visible < 0) ? 0 : 1),
123 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
124 'position' => $val[
'position'],
125 'help' => isset($val[
'help']) ? $val[
'help'] :
''
130$arrayfields[
'wug.fk_usergroup'] = array(
131 'label' => $langs->trans(
'UserGroups'),
132 'checked' => (($visible < 0) ? 0 : 1),
133 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
135 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
136 'csslist' =>
'minwidth100'
150include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
154'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
156$permissiontoread = $user->hasRight(
'workstation',
'workstation',
'read');
157$permissiontoadd = $user->hasRight(
'workstation',
'workstation',
'write');
158$permissiontodelete = $user->hasRight(
'workstation',
'workstation',
'delete');
168if (
GETPOST(
'cancel',
'alpha')) {
172if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
176$parameters = array();
177$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
182if (empty($reshook)) {
184 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
187 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
188 foreach (
$object->fields as $key => $val) {
190 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
191 $search[$key.
'_dtstart'] =
'';
192 $search[$key.
'_dtend'] =
'';
195 $groups = $resources = array();
197 $search_array_options = array();
199 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
200 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
205 $objectclass =
'Workstation';
206 $objectlabel =
'Workstation';
207 $uploaddir = $conf->workstation->dir_output;
208 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
217$form =
new Form($db);
222$title = $langs->trans(
"Workstations");
223$help_url =
'EN:Module_Workstation';
231$sql .=
$object->getFieldList(
't');
233if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
234 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
236 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
240$parameters = array();
241$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
242$sql .= $hookmanager->resPrint;
243$sql = preg_replace(
'/,\s*$/',
'', $sql);
247$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
248if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
249 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
251if (!empty($groups)) {
252 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
254if (!empty($resources)) {
255 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
258$parameters = array();
259$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
260$sql .= $hookmanager->resPrint;
261if (
$object->ismultientitymanaged == 1) {
262 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
264 $sql .=
" WHERE 1 = 1";
266foreach ($search as $key => $val) {
267 if (array_key_exists($key,
$object->fields)) {
268 if ($key ==
'status' && $search[$key] == -1) {
272 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
273 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
278 if ($search[$key] !=
'') {
279 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
282 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
283 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
284 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
285 if (preg_match(
'/_dtstart$/', $key)) {
286 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
288 if (preg_match(
'/_dtend$/', $key)) {
289 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
296 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
302if (!empty($groups)) {
303 $sql .=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
307if (!empty($resources)) {
308 $sql .=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
311include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
313$parameters = array();
314$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
315$sql .= $hookmanager->resPrint;
318foreach (
$object->fields as $key => $val) {
319 $sql .=
"t.".$db->escape($key).
", ";
322if (! empty($extrafields->attributes[
$object->table_element][
'label'])) {
323 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
325 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
329$parameters = array();
330$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
331$sql .= $hookmanager->resPrint;
332$sql = preg_replace(
'/,\s*$/',
'', $sql);
335$nbtotalofrecords =
'';
338 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
339 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
341 $resql = $db->query($sqlforcount);
343 $objforcount = $db->fetch_object($resql);
344 $nbtotalofrecords = $objforcount->nbtotalofrecords;
349 if (($page * $limit) > $nbtotalofrecords) {
357$sql .= $db->order($sortfield, $sortorder);
359 $sql .= $db->plimit($limit + 1, $offset);
362$resql = $db->query($sql);
368$num = $db->num_rows($resql);
372if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
373 $obj = $db->fetch_object($resql);
375 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.((
int) $id));
383llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
385$arrayofselected = is_array($toselect) ? $toselect : array();
389 $param .=
'&mode='.urlencode($mode);
391if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
392 $param .=
'&contextpage='.urlencode($contextpage);
394if ($limit > 0 && $limit != $conf->liste_limit) {
395 $param .=
'&limit='.((int) $limit);
397if ($optioncss !=
'') {
398 $param .=
'&optioncss='.urlencode($optioncss);
400foreach ($search as $key => $val) {
401 if (is_array($search[$key])) {
402 foreach ($search[$key] as $skey) {
404 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
407 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
408 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
409 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
410 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
411 } elseif ($search[$key] !=
'') {
412 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
416include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
418$parameters = array(
'param' => &$param);
419$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
420$param .= $hookmanager->resPrint;
423$arrayofmassactions = array(
429if (!empty($permissiontodelete)) {
430 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
432if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
433 $arrayofmassactions = array();
435$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
437print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
438if ($optioncss !=
'') {
439 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
441print
'<input type="hidden" name="token" value="'.newToken().
'">';
442print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
443print
'<input type="hidden" name="action" value="list">';
444print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
445print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
446print
'<input type="hidden" name="page" value="'.$page.
'">';
447print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
448print
'<input type="hidden" name="page_y" value="">';
449print
'<input type="hidden" name="mode" value="'.$mode.
'">';
452$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'));
453$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'));
455$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
457print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
460$topicmail =
"SendWorkstationRef";
461$modelmail =
"workstation";
463$trackid =
'xxxx'.$object->id;
464include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
468 foreach ($fieldstosearchall as $key => $val) {
469 $fieldstosearchall[$key] = $langs->trans($val);
470 $setupstring .= $key.
"=".$val.
";";
472 print
'<!-- Search done like if WORKSTATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
473 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
481$parameters = array();
482$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
483if (empty($reshook)) {
484 $moreforfilter .= $hookmanager->resPrint;
486 $moreforfilter = $hookmanager->resPrint;
489if (!empty($moreforfilter)) {
490 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
491 print $moreforfilter;
495$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
496$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
497$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
498$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
500print
'<div class="div-table-responsive">';
501print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
507print
'<tr class="liste_titre_filter">';
510 print
'<td class="liste_titre center maxwidthsearch">';
511 $searchpicto = $form->showFilterButtons(
'left');
515foreach (
$object->fields as $key => $val) {
516 $searchkey = empty($search[$key]) ?
'' : $search[$key];
517 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
518 if ($key ==
'status') {
519 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
520 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
521 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
522 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
523 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
524 } 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'])) {
525 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
527 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
528 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
529 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
530 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);
531 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
532 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
533 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
534 print
'<div class="nowrap">';
535 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
537 print
'<div class="nowrap">';
538 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
540 } elseif ($key ==
'lang') {
541 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
543 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
545 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
552if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
553 print
'<td class="liste_titre minwidth100">';
554 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'', $conf->entity,
true);
559if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
560 print
'<td class="liste_titre">';
561 print $formresource->select_resource_list($resources,
'resources', [],
'', 0,
'',
'', $conf->entity,
true, 0,
'',
true);
566include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
569$parameters = array(
'arrayfields' => $arrayfields);
570$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
571print $hookmanager->resPrint;
574 print
'<td class="liste_titre center maxwidthsearch">';
575 $searchpicto = $form->showFilterButtons();
581$totalarray = array();
582$totalarray[
'nbfield'] = 0;
586print
'<tr class="liste_titre">';
589 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
590 $totalarray[
'nbfield']++;
592foreach (
$object->fields as $key => $val) {
593 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
594 if ($key ==
'status') {
595 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
596 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
597 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
598 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
599 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
600 } 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'])) {
601 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
603 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
604 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
605 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";
606 $totalarray[
'nbfield']++;
611if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
613 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
617if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
618 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
622include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
624$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
625$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
626print $hookmanager->resPrint;
629 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
630 $totalarray[
'nbfield']++;
636$needToFetchEachLine = 0;
637if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
638 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
639 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
640 $needToFetchEachLine++;
649$savnbfield = $totalarray[
'nbfield'];
650$totalarray = array();
651$totalarray[
'nbfield'] = 0;
652$imaxinloop = ($limit ? min($num, $limit) : $num);
653while ($i < $imaxinloop) {
654 $obj = $db->fetch_object($resql);
660 $object->setVarsFromFetchObj($obj);
665 if ($mode ==
'kanban') {
667 print
'<tr class="trkanban"><td colspan="'.($savnbfield + 1).
'">';
668 print
'<div class="box-flex-container kanban">';
672 if ($massactionbutton || $massaction) {
674 if (in_array(
$object->id, $arrayofselected)) {
678 print
$object->getKanbanView(
'', array(
'selected' => $selected));
679 if ($i == ($imaxinloop - 1)) {
686 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
689 print
'<td class="nowrap center">';
690 if ($massactionbutton || $massaction) {
692 if (in_array(
$object->id, $arrayofselected)) {
695 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
699 $totalarray[
'nbfield']++;
702 foreach (
$object->fields as $key => $val) {
703 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
704 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
705 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
706 } elseif ($key ==
'status') {
707 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
710 if (in_array($val[
'type'], array(
'timestamp'))) {
711 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
712 } elseif ($key ==
'ref') {
713 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
716 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'])) {
717 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
721 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
722 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
723 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
724 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
727 if ($key ==
'status') {
728 print
$object->getLibStatut(5);
729 } elseif ($key ==
'rowid') {
736 $totalarray[
'nbfield']++;
738 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
740 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
742 if (!isset($totalarray[
'val'])) {
743 $totalarray[
'val'] = array();
745 if (!isset($totalarray[
'val'][
't.'.$key])) {
746 $totalarray[
'val'][
't.'.$key] = 0;
748 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
753 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
756 if (count(
$object->usergroups) >= 4) {
757 $cssforli =
'tdoverflowmax60';
758 } elseif (count(
$object->usergroups) >= 2) {
759 $cssforli =
'tdoverflowmax80';
761 foreach (
$object->usergroups as $id_group) {
763 $g->fetch($id_group);
764 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
767 print
'<td class="minwidth300imp nowraponall">';
768 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
772 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
775 if (count(
$object->resources) >= 4) {
776 $cssforli =
'tdoverflowmax60';
777 } elseif (count(
$object->resources) >= 2) {
778 $cssforli =
'tdoverflowmax80';
780 foreach (
$object->resources as $id_resource) {
782 $r->fetch($id_resource);
783 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
786 print
'<td class="minwidth300imp">';
787 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
792 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
794 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
795 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
796 print $hookmanager->resPrint;
799 print
'<td class="nowrap center">';
800 if ($massactionbutton || $massaction) {
802 if (in_array(
$object->id, $arrayofselected)) {
805 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
809 $totalarray[
'nbfield']++;
820include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
825 foreach ($arrayfields as $key => $val) {
826 if (!empty($val[
'checked'])) {
830 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
836$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
837$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
838print $hookmanager->resPrint;
840print
'</table>'.
"\n";
845if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
846 $hidegeneratedfilelistifempty = 1;
847 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
848 $hidegeneratedfilelistifempty = 0;
851 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
855 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
856 $urlsource .= str_replace(
'&',
'&', $param);
858 $filedir = $diroutputmassaction;
859 $genallowed = $permissiontoread;
860 $delallowed = $permissiontoadd;
862 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...
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.