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;
494$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
495$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
496$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
497$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
499print
'<div class="div-table-responsive">';
500print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
506print
'<tr class="liste_titre_filter">';
509 print
'<td class="liste_titre center maxwidthsearch">';
510 $searchpicto = $form->showFilterButtons(
'left');
514foreach (
$object->fields as $key => $val) {
515 $searchkey = empty($search[$key]) ?
'' : $search[$key];
516 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
517 if ($key ==
'status') {
518 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
519 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
520 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
521 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
522 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
523 } 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'])) {
524 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
526 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
527 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
528 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
529 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);
530 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
531 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
532 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
533 print
'<div class="nowrap">';
534 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
536 print
'<div class="nowrap">';
537 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
539 } elseif ($key ==
'lang') {
540 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
542 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
544 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
551if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
552 print
'<td class="liste_titre minwidth100">';
553 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'',
'', $conf->entity,
true);
558if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
559 print
'<td class="liste_titre">';
560 print $formresource->select_resource_list($resources,
'resources', [],
'', 0,
'',
'', $conf->entity,
true, 0,
'',
true);
565include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
568$parameters = array(
'arrayfields' => $arrayfields);
569$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
570print $hookmanager->resPrint;
573 print
'<td class="liste_titre center maxwidthsearch">';
574 $searchpicto = $form->showFilterButtons();
580$totalarray = array();
581$totalarray[
'nbfield'] = 0;
585print
'<tr class="liste_titre">';
588 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
589 $totalarray[
'nbfield']++;
591foreach (
$object->fields as $key => $val) {
592 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
593 if ($key ==
'status') {
594 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
595 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
596 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
597 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
598 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
599 } 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'])) {
600 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
602 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
603 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
604 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";
605 $totalarray[
'nbfield']++;
610if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
611 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
615if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
616 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
620include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
622$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
623$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
624print $hookmanager->resPrint;
627 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
628 $totalarray[
'nbfield']++;
634$needToFetchEachLine = 0;
635if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
636 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
637 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
638 $needToFetchEachLine++;
647$savnbfield = $totalarray[
'nbfield'];
648$totalarray = array();
649$totalarray[
'nbfield'] = 0;
650$imaxinloop = ($limit ? min($num, $limit) : $num);
651while ($i < $imaxinloop) {
652 $obj = $db->fetch_object($resql);
658 $object->setVarsFromFetchObj($obj);
663 if ($mode ==
'kanban') {
665 print
'<tr class="trkanban"><td colspan="'.($savnbfield + 1).
'">';
666 print
'<div class="box-flex-container kanban">';
670 if ($massactionbutton || $massaction) {
672 if (in_array(
$object->id, $arrayofselected)) {
676 print
$object->getKanbanView(
'', array(
'selected' => $selected));
677 if ($i == ($imaxinloop - 1)) {
684 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
687 print
'<td class="nowrap center">';
688 if ($massactionbutton || $massaction) {
690 if (in_array(
$object->id, $arrayofselected)) {
693 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
697 $totalarray[
'nbfield']++;
700 foreach (
$object->fields as $key => $val) {
701 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
702 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
703 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
704 } elseif ($key ==
'status') {
705 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
708 if (in_array($val[
'type'], array(
'timestamp'))) {
709 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
710 } elseif ($key ==
'ref') {
711 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
714 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'])) {
715 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
719 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
720 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
721 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
722 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
725 if ($key ==
'status') {
726 print
$object->getLibStatut(5);
727 } elseif ($key ==
'rowid') {
734 $totalarray[
'nbfield']++;
736 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
738 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
740 if (!isset($totalarray[
'val'])) {
741 $totalarray[
'val'] = array();
743 if (!isset($totalarray[
'val'][
't.'.$key])) {
744 $totalarray[
'val'][
't.'.$key] = 0;
746 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
751 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
754 if (count(
$object->usergroups) >= 4) {
755 $cssforli =
'tdoverflowmax60';
756 } elseif (count(
$object->usergroups) >= 2) {
757 $cssforli =
'tdoverflowmax80';
759 foreach (
$object->usergroups as $id_group) {
761 $g->fetch($id_group);
762 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
765 print
'<td class="minwidth300imp nowraponall">';
766 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
770 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
773 if (count(
$object->resources) >= 4) {
774 $cssforli =
'tdoverflowmax60';
775 } elseif (count(
$object->resources) >= 2) {
776 $cssforli =
'tdoverflowmax80';
778 foreach (
$object->resources as $id_resource) {
780 $r->fetch($id_resource);
781 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
784 print
'<td class="minwidth300imp">';
785 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
790 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
792 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
793 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
794 print $hookmanager->resPrint;
797 print
'<td class="nowrap center">';
798 if ($massactionbutton || $massaction) {
800 if (in_array(
$object->id, $arrayofselected)) {
803 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
807 $totalarray[
'nbfield']++;
818include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
823 foreach ($arrayfields as $key => $val) {
824 if (!empty($val[
'checked'])) {
828 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
834$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
835$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
836print $hookmanager->resPrint;
838print
'</table>'.
"\n";
843if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
844 $hidegeneratedfilelistifempty = 1;
845 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
846 $hidegeneratedfilelistifempty = 0;
849 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
853 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
854 $urlsource .= str_replace(
'&',
'&', $param);
856 $filedir = $diroutputmassaction;
857 $genallowed = $permissiontoread;
858 $delallowed = $permissiontoadd;
860 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()
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 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.