49 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
50 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"] .
"/main.inc.php";
53 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
54 $tmp2 = realpath(__FILE__);
55 $i = strlen($tmp) - 1;
56 $j = strlen($tmp2) - 1;
57 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
61 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) .
"/main.inc.php")) {
62 $res = @include substr($tmp, 0, ($i + 1)) .
"/main.inc.php";
64 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) .
"/main.inc.php")) {
65 $res = @include dirname(substr($tmp, 0, ($i + 1))) .
"/main.inc.php";
68 if (!$res && file_exists(
"../main.inc.php")) {
69 $res = @include
"../main.inc.php";
71 if (!$res && file_exists(
"../../main.inc.php")) {
72 $res = @include
"../../main.inc.php";
74 if (!$res && file_exists(
"../../../main.inc.php")) {
75 $res = @include
"../../../main.inc.php";
78 die(
"Include of main fails");
81 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
82 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
83 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
84 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/position.class.php';
85 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
86 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_position.lib.php';
87 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
92 $fk_job =
GETPOST(
'fk_job',
'int');
93 $fk_user =
GETPOST(
'fk_user',
'int');
98 $confirm =
GETPOST(
'confirm',
'alpha');
99 $cancel =
GETPOST(
'cancel',
'aZ09');
100 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positioncard';
102 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
103 $backtopage =
GETPOST(
'backtopage',
'alpha');
104 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
105 $fk_job =
GETPOST(
'fk_job',
'int');
108 $object =
new Job($db);
112 $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';
134 $permissiontoread = $user->rights->hrm->all->read;
135 $permissiontoadd = $user->rights->hrm->all->write;
136 $permissiontodelete = $user->rights->hrm->all->delete;
137 $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] .
'/position';
145 if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd))
accessforbidden();
152 $parameters = array();
153 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
158 if (empty($reshook)) {
161 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
164 if (empty($backtopage) || ($cancel && $fk_job <= 0)) {
165 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
166 if ($fk_job == -1 && (($action !=
'add' && $action !=
'create') || $cancel)) {
167 $backtopage = $backurlforlist;
170 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?fk_job=' . ($fk_job > 0 ? $fk_job :
'__ID__');
172 $backtopage =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=__ID__';
178 $triggermodname =
'hrm_POSITION_MODIFY';
183 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
187 $langs->loadLangs(array(
"hrm",
"other",
'products'));
189 $title = $langs->trans(
"Position");
193 if ($job->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
208 global $conf, $langs, $db, $extrafields, $hookmanager, $action, $backtopage, $backtopageforcancel, $permissiontoadd;
221 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
223 if ($backtopageforcancel) {
224 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
229 $res = $object->fetch_optionals();
232 print
dol_get_fiche_head($head,
'position', $langs->trans(
"Workstation"), -1, $object->picto);
236 $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>';
238 $morehtmlref =
'<div class="refid">';
239 $morehtmlref.= $object->label;
240 $morehtmlref .=
'</div>';
242 dol_banner_tab($object,
'fk_job', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
245 print
'<div class="fichecenter">';
246 print
'<div class="fichehalfleft">';
247 print
'<div class="underbanner clearboth"></div>';
248 print
'<table class="border centpercent tableforfield">' .
"\n";
254 $object->fields[
'label'][
'visible']=0;
255 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
258 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
264 print
'<div class="clearboth"></div>';
277 global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
279 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
280 require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
281 require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
284 require_once __DIR__ .
'/class/position.class.php';
289 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
290 $massaction =
GETPOST(
'massaction',
'alpha');
291 $show_files =
GETPOST(
'show_files',
'int');
292 $confirm =
GETPOST(
'confirm',
'alpha');
293 $cancel =
GETPOST(
'cancel',
'alpha');
294 $toselect =
GETPOST(
'toselect',
'array');
295 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positionlist';
296 $optioncss =
GETPOST(
'optioncss',
'aZ');
298 $fk_job =
GETPOST(
'fk_job',
'int');
301 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
302 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
303 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
305 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
309 $offset = $limit * $page;
310 $pageprev = $page - 1;
311 $pagenext = $page + 1;
317 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
318 $hookmanager->initHooks(array(
'positiontablist'));
321 $extrafields->fetch_name_optionals_label($object->table_element);
324 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
328 reset($object->fields);
329 $sortfield =
"t." . key($object->fields);
336 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
338 foreach ($object->fields as $key => $val) {
339 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
340 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
342 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
343 $search[$key .
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_' . $key .
'_dtstartmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtstartday',
'int'),
GETPOST(
'search_' . $key .
'_dtstartyear',
'int'));
344 $search[$key .
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_' . $key .
'_dtendmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtendday',
'int'),
GETPOST(
'search_' . $key .
'_dtendyear',
'int'));
349 $fieldstosearchall = array();
350 foreach ($object->fields as $key => $val) {
351 if (!empty($val[
'searchall'])) {
352 $fieldstosearchall[
't.' . $key] = $val[
'label'];
357 $arrayfields = array();
358 foreach ($object->fields as $key => $val) {
360 if (!empty($val[
'visible'])) {
361 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
362 $arrayfields[
't.' . $key] = array(
363 'label' => $val[
'label'],
364 'checked' => (($visible < 0) ? 0 : 1),
365 'enabled' => ($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
366 'position' => $val[
'position'],
367 'help' => isset($val[
'help']) ? $val[
'help'] :
''
372 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
378 if (empty($conf->hrm->enabled)) {
396 if (
GETPOST(
'cancel',
'alpha')) {
400 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
404 $parameters = array();
405 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
410 if (empty($reshook)) {
412 include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
415 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
416 foreach ($object->fields as $key => $val) {
418 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
419 $search[$key .
'_dtstart'] =
'';
420 $search[$key .
'_dtend'] =
'';
424 $search_array_options = array();
426 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
427 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
432 $objectclass =
'Position';
433 $objectlabel =
'Position';
434 $uploaddir = $conf->hrm->dir_output;
435 include DOL_DOCUMENT_ROOT .
'/core/actions_massactions.inc.php';
449 $title = $langs->trans(
'ListOf', $langs->transnoentitiesnoconv(
"Positions"));
457 $sql .= $object->getFieldList(
't');
459 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
460 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
461 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
465 $parameters = array();
466 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
467 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
468 $sql = preg_replace(
'/,\s*$/',
'', $sql);
469 $sql .=
" FROM " . MAIN_DB_PREFIX . $object->table_element .
" as t";
470 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
471 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
474 $parameters = array();
475 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
476 $sql .= $hookmanager->resPrint;
477 if ($object->ismultientitymanaged == 1) {
478 $sql .=
" WHERE t.entity IN (" .
getEntity($object->element) .
")";
480 $sql .=
" WHERE 1 = 1";
482 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
484 foreach ($search as $key => $val) {
485 if (array_key_exists($key, $object->fields)) {
486 if ($key ==
'status' && $search[$key] == -1) {
489 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
490 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
491 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
496 if ($search[$key] !=
'') {
497 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
500 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
501 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
502 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
503 if (preg_match(
'/_dtstart$/', $key)) {
504 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
506 if (preg_match(
'/_dtend$/', $key)) {
507 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
514 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
518 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
520 $parameters = array();
521 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
522 $sql .= $hookmanager->resPrint;
542 $sql .= $db->order($sortfield, $sortorder);
546 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
547 $resql = $db->query($sql);
559 $sql .= $db->plimit($limit + 1, $offset);
562 $resql = $db->query($sql);
568 $num = $db->num_rows(
$resql);
572 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
573 $obj = $db->fetch_object(
$resql);
575 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
579 $arrayofselected = is_array($toselect) ? $toselect : array();
581 $param =
'fk_job=' . $fk_job;
582 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
583 $param .=
'&contextpage=' . urlencode($contextpage);
585 if ($limit > 0 && $limit != $conf->liste_limit) {
586 $param .=
'&limit=' . urlencode($limit);
588 foreach ($search as $key => $val) {
589 if (is_array($search[$key]) && count($search[$key])) {
590 foreach ($search[$key] as $skey) {
591 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
594 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
597 if ($optioncss !=
'') {
598 $param .=
'&optioncss=' . urlencode($optioncss);
601 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
603 $parameters = array();
604 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
605 $param .= $hookmanager->resPrint;
608 $arrayofmassactions = array(
614 if ($permissiontodelete) {
615 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
617 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
618 $arrayofmassactions = array();
620 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
622 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
623 if ($optioncss !=
'') {
624 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
626 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
627 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
628 print
'<input type="hidden" name="action" value="list">';
629 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
630 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
631 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
632 print
'<input type="hidden" name="page" value="' . $page .
'">';
633 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
635 $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);
637 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_' . $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
640 $topicmail =
"SendPositionRef";
641 $modelmail =
"position";
643 $trackid =
'xxxx' . $object->id;
644 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
647 foreach ($fieldstosearchall as $key => $val) {
648 $fieldstosearchall[$key] = $langs->trans($val);
650 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) .
'</div>';
658 $parameters = array();
659 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
660 if (empty($reshook)) {
661 $moreforfilter .= $hookmanager->resPrint;
663 $moreforfilter = $hookmanager->resPrint;
666 if (!empty($moreforfilter)) {
667 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
668 print $moreforfilter;
672 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
673 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
674 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
676 print
'<div class="div-table-responsive">';
677 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
682 print
'<tr class="liste_titre">';
683 foreach ($object->fields as $key => $val) {
684 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
685 if ($key ==
'status') {
686 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
687 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
688 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
689 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
690 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
691 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
692 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
694 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
695 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
696 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
697 print
$form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
698 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
699 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
700 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
701 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
702 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
703 print
'<div class="nowrap">';
704 print
$form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
706 print
'<div class="nowrap">';
707 print
$form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
714 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
717 $parameters = array(
'arrayfields' => $arrayfields);
718 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
719 print $hookmanager->resPrint;
721 print
'<td class="liste_titre maxwidthsearch">';
722 $searchpicto =
$form->showFilterButtons();
725 print
'</tr>' .
"\n";
730 print
'<tr class="liste_titre">';
731 foreach ($object->fields as $key => $val) {
732 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
733 if ($key ==
'status') {
734 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
735 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
736 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
737 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
738 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
739 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
740 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
742 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
743 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
747 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
749 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
750 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
751 print $hookmanager->resPrint;
753 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
754 print
'</tr>' .
"\n";
757 $needToFetchEachLine = 0;
758 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
759 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
760 if (preg_match(
'/\$object/', $val)) {
761 $needToFetchEachLine++;
770 $totalarray = array();
771 $totalarray[
'nbfield'] = 0;
772 while ($i < ($limit ? min($num, $limit) : $num)) {
773 $obj = $db->fetch_object(
$resql);
779 $object->setVarsFromFetchObj($obj);
782 print
'<tr class="oddeven">';
783 foreach ($object->fields as $key => $val) {
784 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
785 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
786 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
787 } elseif ($key ==
'status') {
788 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
791 if (in_array($val[
'type'], array(
'timestamp'))) {
792 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
793 } elseif ($key ==
'ref') {
794 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
797 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
798 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
802 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
803 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
804 if ($key ==
'status') {
805 print $object->getLibStatut(5);
806 } elseif ($key ==
'rowid') {
807 print $object->getNomUrl(1);
809 print $object->showOutputField($val, $key, $object->$key,
'');
813 $totalarray[
'nbfield']++;
815 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
817 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
819 if (!isset($totalarray[
'val'])) {
820 $totalarray[
'val'] = array();
822 if (!isset($totalarray[
'val'][
't.' . $key])) {
823 $totalarray[
'val'][
't.' . $key] = 0;
825 $totalarray[
'val'][
't.' . $key] += $object->$key;
830 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
832 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
833 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
834 print $hookmanager->resPrint;
836 print
'<td class="nowrap center">';
837 if ($massactionbutton || $massaction) {
839 if (in_array($object->id, $arrayofselected)) {
842 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
846 $totalarray[
'nbfield']++;
849 print
'</tr>' .
"\n";
855 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
860 foreach ($arrayfields as $key => $val) {
861 if (!empty($val[
'checked'])) {
865 print
'<tr><td colspan="' . $colspan .
'" class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</td></tr>';
871 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
872 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
873 print $hookmanager->resPrint;
875 print
'</table>' .
"\n";
876 print
'</div>' .
"\n";
878 print
'</form>' .
"\n";
881 $hidegeneratedfilelistifempty = 1;
882 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
883 $hidegeneratedfilelistifempty = 0;
886 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
890 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
891 $urlsource .= str_replace(
'&',
'&', $param);
893 $filedir = $diroutputmassaction;
894 $genallowed = $permissiontoread;
895 $delallowed = $permissiontoadd;
897 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
902 if ($action ==
'create') {
905 $extrafields->fetch_name_optionals_label($object->table_element);
906 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")),
'',
'object_' . $object->picto);
908 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
909 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
910 print
'<input type="hidden" name="action" value="add">';
912 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
915 if ($backtopageforcancel) {
916 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
921 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
924 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
927 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
929 print
'</table>' .
"\n";
933 print
'<div class="center">';
935 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
937 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)"') .
'>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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='')
Show tabs of a record.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
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...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
jobPrepareHead($object)
Prepare array of tabs for Job.
if($job->id > 0 &&(empty($action)||($action !='edit' && $action !='create'))) DisplayJob($object)
Show the top of the page including informations of a job.
DisplayPositionList()
Show a list of positions for the current job.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.