29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
33require_once DOL_DOCUMENT_ROOT .
'/hrm/class/position.class.php';
34require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_position.lib.php';
36require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
37require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
42$langs->loadLangs(array(
"hrm",
"other",
'products'));
44$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
45$massaction =
GETPOST(
'massaction',
'alpha');
46$show_files =
GETPOST(
'show_files',
'int');
47$confirm =
GETPOST(
'confirm',
'alpha');
48$cancel =
GETPOST(
'cancel',
'alpha');
49$toselect =
GETPOST(
'toselect',
'array');
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobpositionlist';
51$optioncss =
GETPOST(
'optioncss',
'aZ');
52$backtopage =
GETPOST(
'backtopage',
'alpha');
53$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
58$fk_user =
GETPOST(
'fk_user',
'int');
64$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
68if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
72$offset = $limit * $page;
78$object =
new Job($db);
81$diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
82$hookmanager->initHooks(array(
'jobpositioncard',
'globalcard'));
86$extrafields->fetch_name_optionals_label($objectposition->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost($objectposition->table_element,
'',
'search_');
93 reset($objectposition->fields);
94 $sortfield =
"t." . key($objectposition->fields);
101$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
103foreach ($objectposition->fields as $key => $val) {
104 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
105 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
107 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
108 $search[$key .
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_' . $key .
'_dtstartmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtstartday',
'int'),
GETPOST(
'search_' . $key .
'_dtstartyear',
'int'));
109 $search[$key .
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_' . $key .
'_dtendmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtendday',
'int'),
GETPOST(
'search_' . $key .
'_dtendyear',
'int'));
114$fieldstosearchall = array();
115foreach ($objectposition->fields as $key => $val) {
116 if (!empty($val[
'searchall'])) {
117 $fieldstosearchall[
't.' . $key] = $val[
'label'];
122$arrayfields = array();
123foreach ($objectposition->fields as $key => $val) {
125 if (!empty($val[
'visible'])) {
126 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
127 $arrayfields[
't.' . $key] = array(
128 'label' => $val[
'label'],
129 'checked' => (($visible < 0) ? 0 : 1),
130 'enabled' => ($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
131 'position' => $val[
'position'],
132 'help' => isset($val[
'help']) ? $val[
'help'] :
''
137include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
139$objectposition->fields =
dol_sort_array($objectposition->fields,
'position');
146include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
149$permissiontoread = $user->rights->hrm->all->read;
150$permissiontoadd = $user->rights->hrm->all->write;
151$permissiontodelete = $user->rights->hrm->all->delete;
152$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] .
'/position';
159if (!isModEnabled(
'hrm')) {
162if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd)) {
171$parameters = array();
172$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
176if (empty($reshook)) {
179 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
180 $idBacktoPage =
GETPOST(
'fk_job',
'aZ09');
181 if ($idBacktoPage > 0) {
182 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $idBacktoPage;
184 if (empty($backtopage) || ($cancel && empty($id))) {
185 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
186 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
187 $backtopage = $backurlforlist;
190 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?fk_job=' . ($fk_job > 0 ? $fk_job :
'__ID__');
192 $backtopage =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=__ID__';
198 $triggermodname =
'HRM_POSITION_MODIFY';
205 include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
208 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
209 foreach ($object->fields as $key => $val) {
211 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
212 $search[$key .
'_dtstart'] =
'';
213 $search[$key .
'_dtend'] =
'';
217 $search_array_options = array();
219 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
220 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
225 $objectclass =
'Position';
226 $objectlabel =
'Position';
227 $uploaddir = $conf->hrm->dir_output;
228 include DOL_DOCUMENT_ROOT .
'/core/actions_massactions.inc.php';
230 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
239$title = $langs->trans(
"Position");
246if ($action ==
'create') {
249 $extrafields->fetch_name_optionals_label($object->table_element);
250 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")),
'',
'object_' . $object->picto);
252 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
253 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
254 print
'<input type="hidden" name="action" value="add">';
256 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
258 if ($backtopageforcancel) {
259 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
264 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
267 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
270 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
272 print
'</table>' .
"\n";
276 print $form->buttonsSaveCancel(
"Create");
282if ($job->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
284 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
286 if ($backtopageforcancel) {
287 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
292 $res = $object->fetch_optionals();
296 print
dol_get_fiche_head($head,
'position', $langs->trans(
"Workstation"), -1, $object->picto);
300 $linkback =
'<a href="' .
dol_buildpath(
'/hrm/position_list.php', 1) .
'?restore_lastsearch_values=1' . (!empty($fk_job) ?
'&fk_job=' . $fk_job :
'') .
'">' . $langs->trans(
"BackToList") .
'</a>';
302 $morehtmlref =
'<div class="refid">';
303 $morehtmlref.= $object->label;
304 $morehtmlref .=
'</div>';
306 dol_banner_tab($object,
'fk_job', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
309 print
'<div class="fichecenter">';
310 print
'<div class="fichehalfleft">';
311 print
'<div class="underbanner clearboth"></div>';
312 print
'<table class="border centpercent tableforfield">' .
"\n";
318 $object->fields[
'label'][
'visible']=0;
319 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
322 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
328 print
'<div class="clearboth"></div>';
335 $object = $objectposition;
340 $title = $langs->trans(
"Positions");
348 $sql .= $object->getFieldList(
't');
350 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
351 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
352 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
356 $parameters = array();
357 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
358 $sql .= $hookmanager->resPrint;
359 $sql = preg_replace(
'/,\s*$/',
'', $sql);
360 $sql .=
" FROM " . MAIN_DB_PREFIX . $object->table_element .
" as t";
361 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
362 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
365 $parameters = array();
366 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
367 $sql .= $hookmanager->resPrint;
368 if ($object->ismultientitymanaged == 1) {
369 $sql .=
" WHERE t.entity IN (" .
getEntity($object->element) .
")";
371 $sql .=
" WHERE 1 = 1";
373 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
375 foreach ($search as $key => $val) {
376 if (array_key_exists($key, $object->fields)) {
377 if ($key ==
'status' && $search[$key] == -1) {
380 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
381 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
382 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
387 if ($search[$key] !=
'') {
388 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
391 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
392 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
393 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
394 if (preg_match(
'/_dtstart$/', $key)) {
395 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
397 if (preg_match(
'/_dtend$/', $key)) {
398 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
405 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
409 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
411 $parameters = array();
412 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
413 $sql .= $hookmanager->resPrint;
415 $sql .= $db->order($sortfield, $sortorder);
418 $nbtotalofrecords =
'';
420 $resql = $db->query($sql);
421 $nbtotalofrecords = $db->num_rows($resql);
422 if (($page * $limit) > $nbtotalofrecords) {
428 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
429 $num = $nbtotalofrecords;
432 $sql .= $db->plimit($limit + 1, $offset);
435 $resql = $db->query($sql);
441 $num = $db->num_rows($resql);
445 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
446 $obj = $db->fetch_object($resql);
448 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
452 $arrayofselected = is_array($toselect) ? $toselect : array();
454 $param =
'fk_job=' . $fk_job;
455 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
456 $param .=
'&contextpage=' . urlencode($contextpage);
458 if ($limit > 0 && $limit != $conf->liste_limit) {
459 $param .=
'&limit='.((int) $limit);
461 foreach ($search as $key => $val) {
462 if (is_array($search[$key]) && count($search[$key])) {
463 foreach ($search[$key] as $skey) {
464 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
467 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
470 if ($optioncss !=
'') {
471 $param .=
'&optioncss=' . urlencode($optioncss);
474 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
476 $parameters = array();
477 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
478 $param .= $hookmanager->resPrint;
481 $arrayofmassactions = array(
487 if ($permissiontodelete) {
488 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
490 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
491 $arrayofmassactions = array();
493 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
495 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
496 if ($optioncss !=
'') {
497 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
499 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
500 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
501 print
'<input type="hidden" name="action" value="list">';
502 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
503 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
504 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
505 print
'<input type="hidden" name="page" value="' . $page .
'">';
506 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
508 $newcardbutton =
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/hrm/position.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']).
'&fk_job='.((
int) $fk_job),
'', $permissiontoadd);
510 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_' . $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
513 $topicmail =
"SendPositionRef";
514 $modelmail =
"position";
516 $trackid =
'xxxx' . $object->id;
517 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
520 foreach ($fieldstosearchall as $key => $val) {
521 $fieldstosearchall[$key] = $langs->trans($val);
523 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) .
'</div>';
531 $parameters = array();
532 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
533 if (empty($reshook)) {
534 $moreforfilter .= $hookmanager->resPrint;
536 $moreforfilter = $hookmanager->resPrint;
539 if (!empty($moreforfilter)) {
540 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
541 print $moreforfilter;
545 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
546 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
547 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
549 print
'<div class="div-table-responsive">';
550 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
554 print
'<tr class="liste_titre">';
555 foreach ($object->fields as $key => $val) {
556 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
557 if ($key ==
'status') {
558 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
559 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
560 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
561 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
562 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
563 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
564 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
566 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
567 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
568 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
569 print $form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
570 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
571 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
572 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
573 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
574 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
575 print
'<div class="nowrap">';
576 print $form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
578 print
'<div class="nowrap">';
579 print $form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
586 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
589 $parameters = array(
'arrayfields' => $arrayfields);
590 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
591 print $hookmanager->resPrint;
593 print
'<td class="liste_titre maxwidthsearch">';
594 $searchpicto = $form->showFilterButtons();
597 print
'</tr>' .
"\n";
602 print
'<tr class="liste_titre">';
603 foreach ($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')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
612 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
614 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
615 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
619 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
621 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
622 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
623 print $hookmanager->resPrint;
625 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
626 print
'</tr>' .
"\n";
629 $needToFetchEachLine = 0;
630 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
631 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
632 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
633 $needToFetchEachLine++;
642 $totalarray = array();
643 $totalarray[
'nbfield'] = 0;
644 while ($i < ($limit ? min($num, $limit) : $num)) {
645 $obj = $db->fetch_object($resql);
651 $object->setVarsFromFetchObj($obj);
654 print
'<tr class="oddeven">';
655 foreach ($object->fields as $key => $val) {
656 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
657 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
658 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
659 } elseif ($key ==
'status') {
660 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
663 if (in_array($val[
'type'], array(
'timestamp'))) {
664 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
665 } elseif ($key ==
'ref') {
666 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
669 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
670 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
674 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
675 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
676 if ($key ==
'status') {
677 print $object->getLibStatut(5);
678 } elseif ($key ==
'rowid') {
679 print $object->getNomUrl(1);
681 print $object->showOutputField($val, $key, $object->$key,
'');
685 $totalarray[
'nbfield']++;
687 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
689 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
691 if (!isset($totalarray[
'val'])) {
692 $totalarray[
'val'] = array();
694 if (!isset($totalarray[
'val'][
't.' . $key])) {
695 $totalarray[
'val'][
't.' . $key] = 0;
697 $totalarray[
'val'][
't.' . $key] += $object->$key;
702 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
704 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
705 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
706 print $hookmanager->resPrint;
708 print
'<td class="nowrap center">';
709 if ($massactionbutton || $massaction) {
711 if (in_array($object->id, $arrayofselected)) {
714 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
718 $totalarray[
'nbfield']++;
721 print
'</tr>' .
"\n";
727 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
732 foreach ($arrayfields as $key => $val) {
733 if (!empty($val[
'checked'])) {
737 print
'<tr><td colspan="' . $colspan .
'"><span class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</span></td></tr>';
743 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
744 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
745 print $hookmanager->resPrint;
747 print
'</table>' .
"\n";
748 print
'</div>' .
"\n";
750 print
'</form>' .
"\n";
752 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
753 $hidegeneratedfilelistifempty = 1;
754 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
755 $hidegeneratedfilelistifempty = 0;
758 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
762 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
763 $urlsource .= str_replace(
'&',
'&', $param);
765 $filedir = $diroutputmassaction;
766 $genallowed = $permissiontoread;
767 $delallowed = $permissiontoadd;
769 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
783 global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
785 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
786 $massaction =
GETPOST(
'massaction',
'alpha');
787 $show_files =
GETPOST(
'show_files',
'int');
788 $confirm =
GETPOST(
'confirm',
'alpha');
789 $cancel =
GETPOST(
'cancel',
'alpha');
790 $toselect =
GETPOST(
'toselect',
'array');
791 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positionlist';
792 $optioncss =
GETPOST(
'optioncss',
'aZ');
794 $fk_job =
GETPOST(
'fk_job',
'int');
797 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
798 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
799 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
800 $page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
801 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
805 $offset = $limit * $page;
806 $pageprev = $page - 1;
807 $pagenext = $page + 1;
813 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
814 $hookmanager->initHooks(array(
'positiontablist'));
817 $extrafields->fetch_name_optionals_label($object->table_element);
820 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
824 reset($object->fields);
825 $sortfield =
"t." . key($object->fields);
832 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
834 foreach ($object->fields as $key => $val) {
835 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
836 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
838 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
839 $search[$key .
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_' . $key .
'_dtstartmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtstartday',
'int'),
GETPOST(
'search_' . $key .
'_dtstartyear',
'int'));
840 $search[$key .
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_' . $key .
'_dtendmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtendday',
'int'),
GETPOST(
'search_' . $key .
'_dtendyear',
'int'));
845 $fieldstosearchall = array();
846 foreach ($object->fields as $key => $val) {
847 if (!empty($val[
'searchall'])) {
848 $fieldstosearchall[
't.' . $key] = $val[
'label'];
853 $arrayfields = array();
854 foreach ($object->fields as $key => $val) {
856 if (!empty($val[
'visible'])) {
857 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
858 $arrayfields[
't.' . $key] = array(
859 'label' => $val[
'label'],
860 'checked' => (($visible < 0) ? 0 : 1),
861 'enabled' => ($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
862 'position' => $val[
'position'],
863 'help' => isset($val[
'help']) ? $val[
'help'] :
''
868 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
874 if (empty($conf->hrm->enabled)) {
891 $sql .= $object->getFieldList(
't');
893 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
894 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
895 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
899 $parameters = array();
900 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
901 $sql .= $hookmanager->resPrint;
902 $sql = preg_replace(
'/,\s*$/',
'', $sql);
903 $sql .=
" FROM " . MAIN_DB_PREFIX . $object->table_element .
" as t";
904 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
905 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
908 $parameters = array();
909 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
910 $sql .= $hookmanager->resPrint;
911 if ($object->ismultientitymanaged == 1) {
912 $sql .=
" WHERE t.entity IN (" .
getEntity($object->element) .
")";
914 $sql .=
" WHERE 1 = 1";
916 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
918 foreach ($search as $key => $val) {
919 if (array_key_exists($key, $object->fields)) {
920 if ($key ==
'status' && $search[$key] == -1) {
923 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
924 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
925 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
930 if ($search[$key] !=
'') {
931 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
934 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
935 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
936 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
937 if (preg_match(
'/_dtstart$/', $key)) {
938 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
940 if (preg_match(
'/_dtend$/', $key)) {
941 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
948 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
952 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
954 $parameters = array();
955 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
956 $sql .= $hookmanager->resPrint;
976 $sql .= $db->order($sortfield, $sortorder);
979 $nbtotalofrecords =
'';
981 $resql = $db->query($sql);
982 $nbtotalofrecords = $db->num_rows($resql);
983 if (($page * $limit) > $nbtotalofrecords) {
989 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
990 $num = $nbtotalofrecords;
993 $sql .= $db->plimit($limit + 1, $offset);
996 $resql = $db->query($sql);
1002 $num = $db->num_rows($resql);
1006 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
1007 $obj = $db->fetch_object($resql);
1009 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
1013 $arrayofselected = is_array($toselect) ? $toselect : array();
1015 $param =
'fk_job='.$fk_job;
1016 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1017 $param .=
'&contextpage='.urlencode($contextpage);
1019 if ($limit > 0 && $limit != $conf->liste_limit) {
1020 $param .=
'&limit='.((int) $limit);
1022 foreach ($search as $key => $val) {
1023 if (is_array($search[$key]) && count($search[$key])) {
1024 foreach ($search[$key] as $skey) {
1025 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
1028 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
1031 if ($optioncss !=
'') {
1032 $param .=
'&optioncss='.urlencode($optioncss);
1035 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
1037 $parameters = array();
1038 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
1039 $param .= $hookmanager->resPrint;
1042 $arrayofmassactions = array(
1048 if ($permissiontodelete) {
1049 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
1051 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1052 $arrayofmassactions = array();
1054 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1056 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
1057 if ($optioncss !=
'') {
1058 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
1060 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
1061 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1062 print
'<input type="hidden" name="action" value="list">';
1063 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
1064 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
1065 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
1066 print
'<input type="hidden" name="page" value="' . $page .
'">';
1067 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
1069 $newcardbutton =
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/hrm/position.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']).
'&fk_job='.((
int) $fk_job),
'', $permissiontoadd);
1071 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_' . $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
1074 $topicmail =
"SendPositionRef";
1075 $modelmail =
"position";
1077 $trackid =
'xxxx' . $object->id;
1078 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
1081 foreach ($fieldstosearchall as $key => $val) {
1082 $fieldstosearchall[$key] = $langs->trans($val);
1084 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) .
'</div>';
1087 $moreforfilter =
'';
1092 $parameters = array();
1093 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
1094 if (empty($reshook)) {
1095 $moreforfilter .= $hookmanager->resPrint;
1097 $moreforfilter = $hookmanager->resPrint;
1100 if (!empty($moreforfilter)) {
1101 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1102 print $moreforfilter;
1106 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1107 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
1108 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1110 print
'<div class="div-table-responsive">';
1111 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
1116 print
'<tr class="liste_titre">';
1117 foreach ($object->fields as $key => $val) {
1118 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1119 if ($key ==
'status') {
1120 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1121 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1122 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1123 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
1124 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1125 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
1126 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
1128 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
1129 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
1130 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
1131 print $form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
1132 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
1133 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
1134 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
1135 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
1136 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
1137 print
'<div class="nowrap">';
1138 print $form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1140 print
'<div class="nowrap">';
1141 print $form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1148 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
1151 $parameters = array(
'arrayfields' => $arrayfields);
1152 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
1153 print $hookmanager->resPrint;
1155 print
'<td class="liste_titre maxwidthsearch">';
1156 $searchpicto = $form->showFilterButtons();
1159 print
'</tr>' .
"\n";
1164 print
'<tr class="liste_titre">';
1165 foreach ($object->fields as $key => $val) {
1166 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1167 if ($key ==
'status') {
1168 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1169 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1170 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1171 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
1172 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1173 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
1174 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
1176 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
1177 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
1181 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
1183 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1184 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1185 print $hookmanager->resPrint;
1187 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
1188 print
'</tr>' .
"\n";
1191 $needToFetchEachLine = 0;
1192 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
1193 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
1194 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
1195 $needToFetchEachLine++;
1204 $totalarray = array();
1205 $totalarray[
'nbfield'] = 0;
1206 while ($i < ($limit ? min($num, $limit) : $num)) {
1207 $obj = $db->fetch_object($resql);
1213 $object->setVarsFromFetchObj($obj);
1216 print
'<tr class="oddeven">';
1217 foreach ($object->fields as $key => $val) {
1218 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1219 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1220 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1221 } elseif ($key ==
'status') {
1222 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1225 if (in_array($val[
'type'], array(
'timestamp'))) {
1226 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1227 } elseif ($key ==
'ref') {
1228 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1231 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
1232 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
1236 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
1237 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
1238 if ($key ==
'status') {
1239 print $object->getLibStatut(5);
1240 } elseif ($key ==
'rowid') {
1241 print $object->getNomUrl(1);
1243 print $object->showOutputField($val, $key, $object->$key,
'');
1247 $totalarray[
'nbfield']++;
1249 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1251 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
1253 if (!isset($totalarray[
'val'])) {
1254 $totalarray[
'val'] = array();
1256 if (!isset($totalarray[
'val'][
't.' . $key])) {
1257 $totalarray[
'val'][
't.' . $key] = 0;
1259 $totalarray[
'val'][
't.' . $key] += $object->$key;
1264 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
1266 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1267 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1268 print $hookmanager->resPrint;
1270 print
'<td class="nowrap center">';
1271 if ($massactionbutton || $massaction) {
1273 if (in_array($object->id, $arrayofselected)) {
1276 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
1280 $totalarray[
'nbfield']++;
1283 print
'</tr>' .
"\n";
1289 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
1294 foreach ($arrayfields as $key => $val) {
1295 if (!empty($val[
'checked'])) {
1299 print
'<tr><td colspan="' . $colspan .
'"><span class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</span></td></tr>';
1305 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1306 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
1307 print $hookmanager->resPrint;
1309 print
'</table>' .
"\n";
1310 print
'</div>' .
"\n";
1312 print
'</form>' .
"\n";
1314 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1315 $hidegeneratedfilelistifempty = 1;
1316 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1317 $hidegeneratedfilelistifempty = 0;
1320 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
1324 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
1325 $urlsource .= str_replace(
'&',
'&', $param);
1327 $filedir = $diroutputmassaction;
1328 $genallowed = $permissiontoread;
1329 $delallowed = $permissiontoadd;
1331 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_get_fiche_end($notab=0)
Return tab footer of a card.
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 dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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.
print_barre_liste($titre, $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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
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...
jobPrepareHead($object)
Prepare array of tabs for Job.
if($action=='create') if( $job->id > 0 &&(empty( $action)||( $action !='edit' &&$action !='create')) DisplayPositionList)()
Show a list of positions for the current job.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.