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_');
97$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
100foreach (
$object->fields as $key => $val) {
101 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
102 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
110$groups =
GETPOST(
'groups',
'array:int');
111$resources =
GETPOST(
'resources',
'array:int');
114$fieldstosearchall = array();
115foreach (
$object->fields as $key => $val) {
116 if (!empty($val[
'searchall'])) {
117 $fieldstosearchall[
't.'.$key] = $val[
'label'];
122$arrayfields = array();
123foreach (
$object->fields as $key => $val) {
125 if (!empty($val[
'visible'])) {
126 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
127 $arrayfields[
't.'.$key] = array(
128 'label' => $val[
'label'],
129 'checked' => (($visible < 0) ?
'0' :
'1'),
130 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
131 'position' => $val[
'position'],
132 'help' => isset($val[
'help']) ? $val[
'help'] :
''
137$arrayfields[
'wug.fk_usergroup'] = array(
138 'label' => $langs->trans(
'UserGroups'),
139 'checked' => (($visible < 0) ?
'0' :
'1'),
140 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
142 'help' => empty($val[
'help']) ?
'' : $val[
'help'],
143 'csslist' =>
'minwidth100'
157include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
163$permissiontoread = $user->hasRight(
'workstation',
'workstation',
'read');
164$permissiontoadd = $user->hasRight(
'workstation',
'workstation',
'write');
165$permissiontodelete = $user->hasRight(
'workstation',
'workstation',
'delete');
176if (
GETPOST(
'cancel',
'alpha')) {
180if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
184$parameters = array();
185$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
190if (empty($reshook)) {
192 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
195 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
196 foreach (
$object->fields as $key => $val) {
198 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
199 $search[$key.
'_dtstart'] =
'';
200 $search[$key.
'_dtend'] =
'';
203 $groups = $resources = array();
205 $search_array_options = array();
207 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
208 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
213 $objectclass =
'Workstation';
214 $objectlabel =
'Workstation';
215 $uploaddir =
$conf->workstation->dir_output;
216 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
225$form =
new Form($db);
230$title = $langs->trans(
"Workstations");
231$help_url =
'EN:Module_Workstation';
240$sql .=
$object->getFieldList(
't');
242if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
243 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
245 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
250$parameters = array();
251$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
252$sql .= $hookmanager->resPrint;
253$sql = preg_replace(
'/,\s*$/',
'', $sql);
257$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
258if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
259 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
261if (!empty($groups)) {
262 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
264if (!empty($resources)) {
265 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
269$parameters = array();
270$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
271$sql .= $hookmanager->resPrint;
272if (
$object->ismultientitymanaged == 1) {
273 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
275 $sql .=
" WHERE 1 = 1";
277foreach ($search as $key => $val) {
278 if (array_key_exists($key,
$object->fields)) {
279 if ($key ==
'status' && $search[$key] == -1) {
283 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
284 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
289 if ($search[$key] !=
'') {
290 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
293 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
294 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
295 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
296 if (preg_match(
'/_dtstart$/', $key)) {
297 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
299 if (preg_match(
'/_dtend$/', $key)) {
300 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
307 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
313if (!empty($groups)) {
314 $sql .=
' AND wug.fk_usergroup IN('.$db->sanitize(implode(
',', $groups)).
')';
318if (!empty($resources)) {
319 $sql .=
' AND wr.fk_resource IN('.$db->sanitize(implode(
',', $resources)).
')';
322include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
324$parameters = array();
325$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
326$sql .= $hookmanager->resPrint;
329foreach (
$object->fields as $key => $val) {
330 $sql .=
"t.".$db->escape($key).
", ";
333if (! empty($extrafields->attributes[
$object->table_element][
'label'])) {
334 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
336 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
', ' :
'');
340$parameters = array();
341$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
342$sql .= $hookmanager->resPrint;
343$sql = preg_replace(
'/,\s*$/',
'', $sql);
346$nbtotalofrecords =
'';
349 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
350 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
352 $resql = $db->query($sqlforcount);
354 $objforcount = $db->fetch_object($resql);
355 $nbtotalofrecords = $objforcount->nbtotalofrecords;
360 if (($page * $limit) > $nbtotalofrecords) {
368$sql .= $db->order($sortfield, $sortorder);
370 $sql .= $db->plimit($limit + 1, $offset);
373$resql = $db->query($sql);
379$num = $db->num_rows($resql);
383if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
384 $obj = $db->fetch_object($resql);
386 header(
"Location: ".DOL_URL_ROOT.
'/workstation/workstation_card.php?id='.((
int) $id));
394llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
396$arrayofselected = is_array($toselect) ? $toselect : array();
400 $param .=
'&mode='.urlencode($mode);
402if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
403 $param .=
'&contextpage='.urlencode($contextpage);
405if ($limit > 0 && $limit !=
$conf->liste_limit) {
406 $param .=
'&limit='.((int) $limit);
408if ($optioncss !=
'') {
409 $param .=
'&optioncss='.urlencode($optioncss);
411foreach ($search as $key => $val) {
412 if (is_array($search[$key])) {
413 foreach ($search[$key] as $skey) {
415 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
418 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
419 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
420 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
421 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
422 } elseif ($search[$key] !=
'') {
423 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
427include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
429$parameters = array(
'param' => &$param);
430$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
431$param .= $hookmanager->resPrint;
434$arrayofmassactions = array(
440if (!empty($permissiontodelete)) {
441 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
443if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
444 $arrayofmassactions = array();
446$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
448print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
449if ($optioncss !=
'') {
450 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
452print
'<input type="hidden" name="token" value="'.newToken().
'">';
453print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
454print
'<input type="hidden" name="action" value="list">';
455print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
456print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
457print
'<input type="hidden" name="page" value="'.$page.
'">';
458print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
459print
'<input type="hidden" name="page_y" value="">';
460print
'<input type="hidden" name="mode" value="'.$mode.
'">';
463$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'));
464$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'));
466$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/workstation/workstation_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
468print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
471$topicmail =
"SendWorkstationRef";
472$modelmail =
"workstation";
474$trackid =
'xxxx'.$object->id;
475include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
479 foreach ($fieldstosearchall as $key => $val) {
480 $fieldstosearchall[$key] = $langs->trans($val);
481 $setupstring .= $key.
"=".$val.
";";
483 print
'<!-- Search done like if WORKSTATION_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
484 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
492$parameters = array();
493$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
494if (empty($reshook)) {
495 $moreforfilter .= $hookmanager->resPrint;
497 $moreforfilter = $hookmanager->resPrint;
500if (!empty($moreforfilter)) {
501 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
502 print $moreforfilter;
506$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
507$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
508$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
509$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
511print
'<div class="div-table-responsive">';
512print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
518print
'<tr class="liste_titre_filter">';
521 print
'<td class="liste_titre center maxwidthsearch">';
522 $searchpicto = $form->showFilterButtons(
'left');
526foreach (
$object->fields as $key => $val) {
527 $searchkey = empty($search[$key]) ?
'' : $search[$key];
528 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
529 if ($key ==
'status') {
530 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
531 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
532 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
533 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
534 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
535 } 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'])) {
536 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
538 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
539 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
540 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
541 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);
542 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
543 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
544 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
545 print
'<div class="nowrap">';
546 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
548 print
'<div class="nowrap">';
549 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
551 } elseif ($key ==
'lang') {
552 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
554 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
556 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
563if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
564 print
'<td class="liste_titre minwidth100">';
565 print $form->select_dolgroups($groups,
'groups', 1,
'', 0,
'', array(), (string)
$conf->entity,
true);
570if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
571 print
'<td class="liste_titre">';
572 print $formresource->select_resource_list($resources,
'resources',
'', 0, 0, 0, array(), (string)
$conf->entity, 1, 0,
'',
true);
577include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
580$parameters = array(
'arrayfields' => $arrayfields);
581$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
582print $hookmanager->resPrint;
585 print
'<td class="liste_titre center maxwidthsearch">';
586 $searchpicto = $form->showFilterButtons();
597print
'<tr class="liste_titre">';
600 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
603foreach (
$object->fields as $key => $val) {
604 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
605 if ($key ==
'status') {
606 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
607 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
608 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
609 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
610 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
611 } 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'])) {
612 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
614 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
615 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
616 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";
622if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
624 print
getTitleFieldOfList($arrayfields[
'wug.fk_usergroup'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
628if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
629 print
getTitleFieldOfList($arrayfields[
'wr.fk_resource'][
'label'], 0, $_SERVER[
'PHP_SELF'],
'',
'', $param,
'', $sortfield, $sortorder,
'') .
"\n";
633include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
635$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
636$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
637print $hookmanager->resPrint;
640 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
647$needToFetchEachLine = 0;
648if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
649 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
650 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
651 $needToFetchEachLine++;
663$imaxinloop = ($limit ? min($num, $limit) : $num);
664while ($i < $imaxinloop) {
665 $obj = $db->fetch_object($resql);
671 $object->setVarsFromFetchObj($obj);
676 if ($mode ==
'kanban') {
678 print
'<tr class="trkanban"><td colspan="'.($savnbfield + 1).
'">';
679 print
'<div class="box-flex-container kanban">';
683 if ($massactionbutton || $massaction) {
685 if (in_array(
$object->id, $arrayofselected)) {
689 print
$object->getKanbanView(
'', array(
'selected' => $selected));
690 if ($i == ($imaxinloop - 1)) {
697 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
700 print
'<td class="nowrap center">';
701 if ($massactionbutton || $massaction) {
703 if (in_array(
$object->id, $arrayofselected)) {
706 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
713 foreach (
$object->fields as $key => $val) {
714 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
715 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
716 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
717 } elseif ($key ==
'status') {
718 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
721 if (in_array($val[
'type'], array(
'timestamp'))) {
722 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
723 } elseif ($key ==
'ref') {
724 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
727 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'])) {
728 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
732 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
733 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
734 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
735 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
738 if ($key ==
'status') {
739 print
$object->getLibStatut(5);
740 } elseif ($key ==
'rowid') {
741 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
749 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
753 if (!isset($totalarray[
'val'])) {
756 if (!isset($totalarray[
'val'][
't.'.$key])) {
764 if (!empty($arrayfields[
'wug.fk_usergroup'][
'checked'])) {
767 if (count(
$object->usergroups) >= 4) {
768 $cssforli =
'tdoverflowmax60';
769 } elseif (count(
$object->usergroups) >= 2) {
770 $cssforli =
'tdoverflowmax80';
772 foreach (
$object->usergroups as $id_group) {
774 $g->fetch($id_group);
775 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $g->getNomUrl(1,
'', 0,
'categtextwhite') .
'</li>';
778 print
'<td class="minwidth300imp nowraponall">';
779 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
783 if (!empty($arrayfields[
'wr.fk_resource'][
'checked'])) {
786 if (count(
$object->resources) >= 4) {
787 $cssforli =
'tdoverflowmax60';
788 } elseif (count(
$object->resources) >= 2) {
789 $cssforli =
'tdoverflowmax80';
791 foreach (
$object->resources as $id_resource) {
793 $r->fetch($id_resource);
794 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ?
' '.$cssforli :
'').
'" style="background: #bbb">' . $r->getNomUrl(1,
'',
'', 0,
'categtextwhite') .
'</li>';
797 print
'<td class="minwidth300imp">';
798 print
'<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
803 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
806 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
807 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
808 print $hookmanager->resPrint;
812 print
'<td class="nowrap center">';
813 if ($massactionbutton || $massaction) {
815 if (in_array(
$object->id, $arrayofselected)) {
818 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
833include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
838 foreach ($arrayfields as $key => $val) {
839 if (!empty($val[
'checked'])) {
843 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
849$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
850$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
851print $hookmanager->resPrint;
853print
'</table>'.
"\n";
858if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
859 $hidegeneratedfilelistifempty = 1;
860 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
861 $hidegeneratedfilelistifempty = 0;
864 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
868 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
869 $urlsource .= str_replace(
'&',
'&', $param);
871 $filedir = $diroutputmassaction;
872 $genallowed = $permissiontoread;
873 $delallowed = $permissiontoadd;
875 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage user groups.
static getAllResourcesOfWorkstation($fk_workstation)
Function used to get an array with all resources linked to a workstation.
static getAllGroupsOfWorkstation($fk_workstation)
Function used to get an array with all usergroups linked to a workstation.
dol_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, $allowothertags=array())
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.