51 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
52 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"] .
"/main.inc.php";
55 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
56 $tmp2 = realpath(__FILE__);
57 $i = strlen($tmp) - 1;
58 $j = strlen($tmp2) - 1;
59 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
63 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) .
"/main.inc.php")) {
64 $res = @include substr($tmp, 0, ($i + 1)) .
"/main.inc.php";
66 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) .
"/main.inc.php")) {
67 $res = @include dirname(substr($tmp, 0, ($i + 1))) .
"/main.inc.php";
70 if (!$res && file_exists(
"../main.inc.php")) {
71 $res = @include
"../main.inc.php";
73 if (!$res && file_exists(
"../../main.inc.php")) {
74 $res = @include
"../../main.inc.php";
76 if (!$res && file_exists(
"../../../main.inc.php")) {
77 $res = @include
"../../../main.inc.php";
80 die(
"Include of main fails");
83 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
84 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
85 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
86 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/position.class.php';
87 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
88 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_position.lib.php';
89 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
91 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
92 $backtopage =
GETPOST(
'backtopage',
'alpha');
93 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
94 $fk_job =
GETPOST(
'fk_job',
'int');
98 $fk_job =
GETPOST(
'fk_job',
'int');
99 $fk_user =
GETPOST(
'fk_user',
'int');
103 $ref =
GETPOST(
'ref',
'alpha');
104 $confirm =
GETPOST(
'confirm',
'alpha');
105 $cancel =
GETPOST(
'cancel',
'aZ09');
106 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positioncard';
109 $object =
new Job($db);
113 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
114 $hookmanager->initHooks(array(
'positiontab',
'globalcard'));
117 $extrafields->fetch_name_optionals_label($object->table_element);
119 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
122 $search_all =
GETPOST(
"search_all",
'alpha');
124 foreach ($object->fields as $key => $val) {
125 if (
GETPOST(
'search_' . $key,
'alpha')) {
126 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
131 include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
133 $permissiontoread = $user->rights->hrm->all->read;
134 $permissiontoadd = $user->rights->hrm->all->write;
135 $permissiontodelete = $user->rights->hrm->all->delete;
136 $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] .
'/position';
144 if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd))
accessforbidden();
151 $parameters = array();
152 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
157 if (empty($reshook)) {
160 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
163 if (empty($backtopage) || ($cancel && $fk_job <= 0)) {
164 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
165 if ($fk_job == -1 && (($action !=
'add' && $action !=
'create') || $cancel)) {
166 $backtopage = $backurlforlist;
169 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?fk_job=' . ($fk_job > 0 ? $fk_job :
'__ID__');
171 $backtopage =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=__ID__';
177 $triggermodname =
'hrm_POSITION_MODIFY';
182 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
186 $langs->loadLangs(array(
"hrm",
"other",
'products'));
188 $title = $langs->trans(
"Position");
192 if ($job->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
207 global $conf, $langs, $db, $extrafields, $hookmanager, $action, $backtopage, $backtopageforcancel, $permissiontoadd;
220 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
222 if ($backtopageforcancel) {
223 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
228 $res = $object->fetch_optionals();
231 print
dol_get_fiche_head($head,
'position', $langs->trans(
"Workstation"), -1, $object->picto);
235 $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>';
237 $morehtmlref =
'<div class="refid">';
238 $morehtmlref.= $object->label;
239 $morehtmlref .=
'</div>';
241 dol_banner_tab($object,
'fk_job', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
244 print
'<div class="fichecenter">';
245 print
'<div class="fichehalfleft">';
246 print
'<div class="underbanner clearboth"></div>';
247 print
'<table class="border centpercent tableforfield">' .
"\n";
253 $object->fields[
'label'][
'visible']=0;
254 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
257 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
263 print
'<div class="clearboth"></div>';
276 global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
278 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
279 require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
280 require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
283 require_once __DIR__ .
'/class/position.class.php';
288 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
289 $massaction =
GETPOST(
'massaction',
'alpha');
290 $show_files =
GETPOST(
'show_files',
'int');
291 $confirm =
GETPOST(
'confirm',
'alpha');
292 $cancel =
GETPOST(
'cancel',
'alpha');
293 $toselect =
GETPOST(
'toselect',
'array');
294 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positionlist';
295 $optioncss =
GETPOST(
'optioncss',
'aZ');
297 $fk_job =
GETPOST(
'fk_job',
'int');
300 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
301 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
302 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
304 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
308 $offset = $limit * $page;
309 $pageprev = $page - 1;
310 $pagenext = $page + 1;
316 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
317 $hookmanager->initHooks(array(
'positiontablist'));
320 $extrafields->fetch_name_optionals_label($object->table_element);
323 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
327 reset($object->fields);
328 $sortfield =
"t." . key($object->fields);
335 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
337 foreach ($object->fields as $key => $val) {
338 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
339 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
341 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
342 $search[$key .
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_' . $key .
'_dtstartmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtstartday',
'int'),
GETPOST(
'search_' . $key .
'_dtstartyear',
'int'));
343 $search[$key .
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_' . $key .
'_dtendmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtendday',
'int'),
GETPOST(
'search_' . $key .
'_dtendyear',
'int'));
348 $fieldstosearchall = array();
349 foreach ($object->fields as $key => $val) {
350 if (!empty($val[
'searchall'])) {
351 $fieldstosearchall[
't.' . $key] = $val[
'label'];
356 $arrayfields = array();
357 foreach ($object->fields as $key => $val) {
359 if (!empty($val[
'visible'])) {
360 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
361 $arrayfields[
't.' . $key] = array(
362 'label' => $val[
'label'],
363 'checked' => (($visible < 0) ? 0 : 1),
364 'enabled' => ($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
365 'position' => $val[
'position'],
366 'help' => isset($val[
'help']) ? $val[
'help'] :
''
371 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
377 if (empty($conf->hrm->enabled)) {
395 if (
GETPOST(
'cancel',
'alpha')) {
399 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
403 $parameters = array();
404 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
409 if (empty($reshook)) {
411 include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
414 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
415 foreach ($object->fields as $key => $val) {
417 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
418 $search[$key .
'_dtstart'] =
'';
419 $search[$key .
'_dtend'] =
'';
423 $search_array_options = array();
425 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
426 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
431 $objectclass =
'Position';
432 $objectlabel =
'Position';
433 $uploaddir = $conf->hrm->dir_output;
434 include DOL_DOCUMENT_ROOT .
'/core/actions_massactions.inc.php';
448 $title = $langs->trans(
'ListOf', $langs->transnoentitiesnoconv(
"Positions"));
456 $sql .= $object->getFieldList(
't');
458 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
459 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
460 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
464 $parameters = array();
465 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
466 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
467 $sql = preg_replace(
'/,\s*$/',
'', $sql);
468 $sql .=
" FROM " . MAIN_DB_PREFIX . $object->table_element .
" as t";
469 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
470 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
473 $parameters = array();
474 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
475 $sql .= $hookmanager->resPrint;
476 if ($object->ismultientitymanaged == 1) {
477 $sql .=
" WHERE t.entity IN (" .
getEntity($object->element) .
")";
479 $sql .=
" WHERE 1 = 1";
481 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
483 foreach ($search as $key => $val) {
484 if (array_key_exists($key, $object->fields)) {
485 if ($key ==
'status' && $search[$key] == -1) {
488 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
489 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
490 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
495 if ($search[$key] !=
'') {
496 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
499 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
500 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
501 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
502 if (preg_match(
'/_dtstart$/', $key)) {
503 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
505 if (preg_match(
'/_dtend$/', $key)) {
506 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
513 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
517 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
519 $parameters = array();
520 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
521 $sql .= $hookmanager->resPrint;
541 $sql .= $db->order($sortfield, $sortorder);
544 $nbtotalofrecords =
'';
545 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
546 $resql = $db->query($sql);
547 $nbtotalofrecords = $db->num_rows(
$resql);
548 if (($page * $limit) > $nbtotalofrecords) {
554 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
555 $num = $nbtotalofrecords;
558 $sql .= $db->plimit($limit + 1, $offset);
561 $resql = $db->query($sql);
567 $num = $db->num_rows(
$resql);
571 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
572 $obj = $db->fetch_object(
$resql);
574 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
578 $arrayofselected = is_array($toselect) ? $toselect : array();
580 $param =
'fk_job=' . $fk_job;
581 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
582 $param .=
'&contextpage=' . urlencode($contextpage);
584 if ($limit > 0 && $limit != $conf->liste_limit) {
585 $param .=
'&limit=' . urlencode($limit);
587 foreach ($search as $key => $val) {
588 if (is_array($search[$key]) && count($search[$key])) {
589 foreach ($search[$key] as $skey) {
590 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
593 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
596 if ($optioncss !=
'') {
597 $param .=
'&optioncss=' . urlencode($optioncss);
600 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
602 $parameters = array();
603 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
604 $param .= $hookmanager->resPrint;
607 $arrayofmassactions = array(
613 if ($permissiontodelete) {
614 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
616 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
617 $arrayofmassactions = array();
619 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
621 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
622 if ($optioncss !=
'') {
623 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
625 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
626 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
627 print
'<input type="hidden" name="action" value="list">';
628 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
629 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
630 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
631 print
'<input type="hidden" name="page" value="' . $page .
'">';
632 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
634 $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);
636 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_' . $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
639 $topicmail =
"SendPositionRef";
640 $modelmail =
"position";
642 $trackid =
'xxxx' . $object->id;
643 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
646 foreach ($fieldstosearchall as $key => $val) {
647 $fieldstosearchall[$key] = $langs->trans($val);
649 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) .
'</div>';
657 $parameters = array();
658 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
659 if (empty($reshook)) {
660 $moreforfilter .= $hookmanager->resPrint;
662 $moreforfilter = $hookmanager->resPrint;
665 if (!empty($moreforfilter)) {
666 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
667 print $moreforfilter;
671 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
672 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
673 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
675 print
'<div class="div-table-responsive">';
676 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
681 print
'<tr class="liste_titre">';
682 foreach ($object->fields as $key => $val) {
683 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
684 if ($key ==
'status') {
685 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
686 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
687 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
688 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
689 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
690 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
691 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
693 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
694 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
695 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
696 print
$form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
697 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
698 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
699 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
700 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
701 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
702 print
'<div class="nowrap">';
703 print
$form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
705 print
'<div class="nowrap">';
706 print
$form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
713 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
716 $parameters = array(
'arrayfields' => $arrayfields);
717 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
718 print $hookmanager->resPrint;
720 print
'<td class="liste_titre maxwidthsearch">';
721 $searchpicto =
$form->showFilterButtons();
724 print
'</tr>' .
"\n";
729 print
'<tr class="liste_titre">';
730 foreach ($object->fields as $key => $val) {
731 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
732 if ($key ==
'status') {
733 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
734 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
735 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
736 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
737 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
738 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
739 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
741 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
742 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
746 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
748 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
749 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
750 print $hookmanager->resPrint;
752 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
753 print
'</tr>' .
"\n";
756 $needToFetchEachLine = 0;
757 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
758 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
759 if (preg_match(
'/\$object/', $val)) {
760 $needToFetchEachLine++;
769 $totalarray = array();
770 $totalarray[
'nbfield'] = 0;
771 while ($i < ($limit ? min($num, $limit) : $num)) {
772 $obj = $db->fetch_object(
$resql);
778 $object->setVarsFromFetchObj($obj);
781 print
'<tr class="oddeven">';
782 foreach ($object->fields as $key => $val) {
783 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
784 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
785 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
786 } elseif ($key ==
'status') {
787 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
790 if (in_array($val[
'type'], array(
'timestamp'))) {
791 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
792 } elseif ($key ==
'ref') {
793 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
796 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
797 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
801 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
802 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
803 if ($key ==
'status') {
804 print $object->getLibStatut(5);
805 } elseif ($key ==
'rowid') {
806 print $object->getNomUrl(1);
808 print $object->showOutputField($val, $key, $object->$key,
'');
812 $totalarray[
'nbfield']++;
814 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
816 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
818 if (!isset($totalarray[
'val'])) {
819 $totalarray[
'val'] = array();
821 if (!isset($totalarray[
'val'][
't.' . $key])) {
822 $totalarray[
'val'][
't.' . $key] = 0;
824 $totalarray[
'val'][
't.' . $key] += $object->$key;
829 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
831 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
832 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
833 print $hookmanager->resPrint;
835 print
'<td class="nowrap center">';
836 if ($massactionbutton || $massaction) {
838 if (in_array($object->id, $arrayofselected)) {
841 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
845 $totalarray[
'nbfield']++;
848 print
'</tr>' .
"\n";
854 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
859 foreach ($arrayfields as $key => $val) {
860 if (!empty($val[
'checked'])) {
864 print
'<tr><td colspan="' . $colspan .
'" class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</td></tr>';
870 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
871 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
872 print $hookmanager->resPrint;
874 print
'</table>' .
"\n";
875 print
'</div>' .
"\n";
877 print
'</form>' .
"\n";
879 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
880 $hidegeneratedfilelistifempty = 1;
881 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
882 $hidegeneratedfilelistifempty = 0;
885 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
889 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
890 $urlsource .= str_replace(
'&',
'&', $param);
892 $filedir = $diroutputmassaction;
893 $genallowed = $permissiontoread;
894 $delallowed = $permissiontoadd;
896 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
901 if ($action ==
'create') {
903 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")),
'',
'object_' . $object->picto);
905 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
906 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
907 print
'<input type="hidden" name="action" value="add">';
909 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
912 if ($backtopageforcancel) {
913 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
918 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
921 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
924 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
926 print
'</table>' .
"\n";
930 print
'<div class="center">';
932 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
934 print
'<input type="' . ($backtopage ?
"submit" :
"button") .
'" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
"Cancel")) .
'"' . ($backtopage ?
'' :
' onclick="javascript:history.go(-1)"') .
'>';