29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
31 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
33 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/position.class.php';
34 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
35 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_position.lib.php';
36 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
37 require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
38 require_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');
53 $fk_job =
GETPOST(
'fk_job',
'int');
56 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
57 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
64 $offset = $limit * $page;
65 $pageprev = $page - 1;
66 $pagenext = $page + 1;
71 $fk_job =
GETPOST(
'fk_job',
'int');
72 $fk_user =
GETPOST(
'fk_user',
'int');
76 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
77 $backtopage =
GETPOST(
'backtopage',
'alpha');
78 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
79 $fk_job =
GETPOST(
'fk_job',
'int');
82 $object =
new Job($db);
87 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
89 $hookmanager->initHooks(array(
'jobpositionlist',
'globalcard'));
93 $extrafields->fetch_name_optionals_label($objectposition->table_element);
96 $search_array_options = $extrafields->getOptionalsFromPost($objectposition->table_element,
'',
'search_');
100 reset($objectposition->fields);
101 $sortfield =
"t." . key($objectposition->fields);
108 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
110 foreach ($objectposition->fields as $key => $val) {
111 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
112 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
114 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
115 $search[$key .
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_' . $key .
'_dtstartmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtstartday',
'int'),
GETPOST(
'search_' . $key .
'_dtstartyear',
'int'));
116 $search[$key .
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_' . $key .
'_dtendmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtendday',
'int'),
GETPOST(
'search_' . $key .
'_dtendyear',
'int'));
121 $fieldstosearchall = array();
122 foreach ($objectposition->fields as $key => $val) {
123 if (!empty($val[
'searchall'])) {
124 $fieldstosearchall[
't.' . $key] = $val[
'label'];
129 $arrayfields = array();
130 foreach ($objectposition->fields as $key => $val) {
132 if (!empty($val[
'visible'])) {
133 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
134 $arrayfields[
't.' . $key] = array(
135 'label' => $val[
'label'],
136 'checked' => (($visible < 0) ? 0 : 1),
137 'enabled' => ($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
138 'position' => $val[
'position'],
139 'help' => isset($val[
'help']) ? $val[
'help'] :
''
144 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
146 $objectposition->fields =
dol_sort_array($objectposition->fields,
'position');
153 include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
156 $permissiontoread = $user->rights->hrm->all->read;
157 $permissiontoadd = $user->rights->hrm->all->write;
158 $permissiontodelete = $user->rights->hrm->all->delete;
159 $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] .
'/position';
167 if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd))
accessforbidden();
174 $parameters = array();
175 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
180 if (empty($reshook)) {
183 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
186 if (empty($backtopage) || ($cancel && $fk_job <= 0)) {
187 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
188 if ($fk_job == -1 && (($action !=
'add' && $action !=
'create') || $cancel)) {
189 $backtopage = $backurlforlist;
192 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?fk_job=' . ($fk_job > 0 ? $fk_job :
'__ID__');
194 $backtopage =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=__ID__';
200 $triggermodname =
'HRM_POSITION_MODIFY';
207 include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
211 foreach ($object->fields as $key => $val) {
213 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
214 $search[$key .
'_dtstart'] =
'';
215 $search[$key .
'_dtend'] =
'';
219 $search_array_options = array();
221 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
222 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
227 $objectclass =
'Position';
228 $objectlabel =
'Position';
229 $uploaddir = $conf->hrm->dir_output;
230 include DOL_DOCUMENT_ROOT .
'/core/actions_massactions.inc.php';
232 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
240 $title = $langs->trans(
"Position");
247 if ($action ==
'create') {
250 $extrafields->fetch_name_optionals_label($object->table_element);
251 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")),
'',
'object_' . $object->picto);
253 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
254 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
255 print
'<input type="hidden" name="action" value="add">';
257 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
260 if ($backtopageforcancel) {
261 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
266 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
269 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
272 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
274 print
'</table>' .
"\n";
278 print
'<div class="center">';
280 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
282 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)"') .
'>';
290 if ($job->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
292 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
294 if ($backtopageforcancel) {
295 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
300 $res = $object->fetch_optionals();
304 print
dol_get_fiche_head($head,
'position', $langs->trans(
"Workstation"), -1, $object->picto);
308 $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>';
310 $morehtmlref =
'<div class="refid">';
311 $morehtmlref.= $object->label;
312 $morehtmlref .=
'</div>';
314 dol_banner_tab($object,
'fk_job', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
317 print
'<div class="fichecenter">';
318 print
'<div class="fichehalfleft">';
319 print
'<div class="underbanner clearboth"></div>';
320 print
'<table class="border centpercent tableforfield">' .
"\n";
326 $object->fields[
'label'][
'visible']=0;
327 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
330 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
336 print
'<div class="clearboth"></div>';
343 $object = $objectposition;
348 $title = $langs->trans(
"Positions");
356 $sql .= $object->getFieldList(
't');
358 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
359 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
360 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
364 $parameters = array();
365 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
366 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
367 $sql = preg_replace(
'/,\s*$/',
'', $sql);
368 $sql .=
" FROM " . MAIN_DB_PREFIX . $object->table_element .
" as t";
369 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
370 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
373 $parameters = array();
374 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
375 $sql .= $hookmanager->resPrint;
376 if ($object->ismultientitymanaged == 1) {
377 $sql .=
" WHERE t.entity IN (" .
getEntity($object->element) .
")";
379 $sql .=
" WHERE 1 = 1";
381 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
383 foreach ($search as $key => $val) {
384 if (array_key_exists($key, $object->fields)) {
385 if ($key ==
'status' && $search[$key] == -1) {
388 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
389 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
390 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
395 if ($search[$key] !=
'') {
396 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
399 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
400 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
401 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
402 if (preg_match(
'/_dtstart$/', $key)) {
403 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
405 if (preg_match(
'/_dtend$/', $key)) {
406 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
413 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
417 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
419 $parameters = array();
420 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
421 $sql .= $hookmanager->resPrint;
423 $sql .= $db->order($sortfield, $sortorder);
427 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
428 $resql = $db->query($sql);
440 $sql .= $db->plimit($limit + 1, $offset);
443 $resql = $db->query($sql);
449 $num = $db->num_rows(
$resql);
453 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
454 $obj = $db->fetch_object(
$resql);
456 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
460 $arrayofselected = is_array($toselect) ? $toselect : array();
462 $param =
'fk_job=' . $fk_job;
463 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
464 $param .=
'&contextpage=' . urlencode($contextpage);
466 if ($limit > 0 && $limit != $conf->liste_limit) {
467 $param .=
'&limit=' . urlencode($limit);
469 foreach ($search as $key => $val) {
470 if (is_array($search[$key]) && count($search[$key])) {
471 foreach ($search[$key] as $skey) {
472 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
475 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
478 if ($optioncss !=
'') {
479 $param .=
'&optioncss=' . urlencode($optioncss);
482 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
484 $parameters = array();
485 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
486 $param .= $hookmanager->resPrint;
489 $arrayofmassactions = array(
495 if ($permissiontodelete) {
496 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
498 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
499 $arrayofmassactions = array();
501 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
503 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
504 if ($optioncss !=
'') {
505 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
507 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
508 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
509 print
'<input type="hidden" name="action" value="list">';
510 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
511 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
512 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
513 print
'<input type="hidden" name="page" value="' . $page .
'">';
514 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
516 $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);
518 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_' . $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
521 $topicmail =
"SendPositionRef";
522 $modelmail =
"position";
524 $trackid =
'xxxx' . $object->id;
525 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
528 foreach ($fieldstosearchall as $key => $val) {
529 $fieldstosearchall[$key] = $langs->trans($val);
531 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) .
'</div>';
539 $parameters = array();
540 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
541 if (empty($reshook)) {
542 $moreforfilter .= $hookmanager->resPrint;
544 $moreforfilter = $hookmanager->resPrint;
547 if (!empty($moreforfilter)) {
548 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
549 print $moreforfilter;
553 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
554 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
555 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
557 print
'<div class="div-table-responsive">';
558 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
562 print
'<tr class="liste_titre">';
563 foreach ($object->fields as $key => $val) {
564 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
565 if ($key ==
'status') {
566 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
567 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
568 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
569 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
570 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
571 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
572 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
574 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
575 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
576 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
577 print
$form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
578 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
579 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
580 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
581 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
582 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
583 print
'<div class="nowrap">';
584 print
$form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
586 print
'<div class="nowrap">';
587 print
$form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
594 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
597 $parameters = array(
'arrayfields' => $arrayfields);
598 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
599 print $hookmanager->resPrint;
601 print
'<td class="liste_titre maxwidthsearch">';
602 $searchpicto =
$form->showFilterButtons();
605 print
'</tr>' .
"\n";
610 print
'<tr class="liste_titre">';
611 foreach ($object->fields as $key => $val) {
612 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
613 if ($key ==
'status') {
614 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
615 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
616 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
617 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
618 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
619 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
620 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
622 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
623 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
627 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
629 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
630 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
631 print $hookmanager->resPrint;
633 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
634 print
'</tr>' .
"\n";
637 $needToFetchEachLine = 0;
638 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
639 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
640 if (preg_match(
'/\$object/', $val)) {
641 $needToFetchEachLine++;
650 $totalarray = array();
651 $totalarray[
'nbfield'] = 0;
652 while ($i < ($limit ? min($num, $limit) : $num)) {
653 $obj = $db->fetch_object(
$resql);
659 $object->setVarsFromFetchObj($obj);
662 print
'<tr class="oddeven">';
663 foreach ($object->fields as $key => $val) {
664 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
665 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
666 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
667 } elseif ($key ==
'status') {
668 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
671 if (in_array($val[
'type'], array(
'timestamp'))) {
672 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
673 } elseif ($key ==
'ref') {
674 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
677 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
678 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
682 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
683 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
684 if ($key ==
'status') {
685 print $object->getLibStatut(5);
686 } elseif ($key ==
'rowid') {
687 print $object->getNomUrl(1);
689 print $object->showOutputField($val, $key, $object->$key,
'');
693 $totalarray[
'nbfield']++;
695 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
697 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
699 if (!isset($totalarray[
'val'])) {
700 $totalarray[
'val'] = array();
702 if (!isset($totalarray[
'val'][
't.' . $key])) {
703 $totalarray[
'val'][
't.' . $key] = 0;
705 $totalarray[
'val'][
't.' . $key] += $object->$key;
710 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
712 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
713 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
714 print $hookmanager->resPrint;
716 print
'<td class="nowrap center">';
717 if ($massactionbutton || $massaction) {
719 if (in_array($object->id, $arrayofselected)) {
722 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
726 $totalarray[
'nbfield']++;
729 print
'</tr>' .
"\n";
735 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
740 foreach ($arrayfields as $key => $val) {
741 if (!empty($val[
'checked'])) {
745 print
'<tr><td colspan="' . $colspan .
'" class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</td></tr>';
751 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
752 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
753 print $hookmanager->resPrint;
755 print
'</table>' .
"\n";
756 print
'</div>' .
"\n";
758 print
'</form>' .
"\n";
761 $hidegeneratedfilelistifempty = 1;
762 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
763 $hidegeneratedfilelistifempty = 0;
766 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
770 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
771 $urlsource .= str_replace(
'&',
'&', $param);
773 $filedir = $diroutputmassaction;
774 $genallowed = $permissiontoread;
775 $delallowed = $permissiontoadd;
777 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
791 global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
793 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
794 $massaction =
GETPOST(
'massaction',
'alpha');
795 $show_files =
GETPOST(
'show_files',
'int');
796 $confirm =
GETPOST(
'confirm',
'alpha');
797 $cancel =
GETPOST(
'cancel',
'alpha');
798 $toselect =
GETPOST(
'toselect',
'array');
799 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positionlist';
800 $optioncss =
GETPOST(
'optioncss',
'aZ');
802 $fk_job =
GETPOST(
'fk_job',
'int');
805 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
806 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
807 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
809 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
813 $offset = $limit * $page;
814 $pageprev = $page - 1;
815 $pagenext = $page + 1;
821 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
822 $hookmanager->initHooks(array(
'positiontablist'));
825 $extrafields->fetch_name_optionals_label($object->table_element);
828 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
832 reset($object->fields);
833 $sortfield =
"t." . key($object->fields);
840 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
842 foreach ($object->fields as $key => $val) {
843 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
844 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
846 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
847 $search[$key .
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_' . $key .
'_dtstartmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtstartday',
'int'),
GETPOST(
'search_' . $key .
'_dtstartyear',
'int'));
848 $search[$key .
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_' . $key .
'_dtendmonth',
'int'),
GETPOST(
'search_' . $key .
'_dtendday',
'int'),
GETPOST(
'search_' . $key .
'_dtendyear',
'int'));
853 $fieldstosearchall = array();
854 foreach ($object->fields as $key => $val) {
855 if (!empty($val[
'searchall'])) {
856 $fieldstosearchall[
't.' . $key] = $val[
'label'];
861 $arrayfields = array();
862 foreach ($object->fields as $key => $val) {
864 if (!empty($val[
'visible'])) {
865 $visible = (int)
dol_eval($val[
'visible'], 1, 1,
'1');
866 $arrayfields[
't.' . $key] = array(
867 'label' => $val[
'label'],
868 'checked' => (($visible < 0) ? 0 : 1),
869 'enabled' => ($visible != 3 &&
dol_eval($val[
'enabled'], 1, 1,
'1')),
870 'position' => $val[
'position'],
871 'help' => isset($val[
'help']) ? $val[
'help'] :
''
876 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
882 if (empty($conf->hrm->enabled)) {
899 $sql .= $object->getFieldList(
't');
901 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
902 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
903 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
907 $parameters = array();
908 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
909 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
910 $sql = preg_replace(
'/,\s*$/',
'', $sql);
911 $sql .=
" FROM " . MAIN_DB_PREFIX . $object->table_element .
" as t";
912 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
913 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
916 $parameters = array();
917 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
918 $sql .= $hookmanager->resPrint;
919 if ($object->ismultientitymanaged == 1) {
920 $sql .=
" WHERE t.entity IN (" .
getEntity($object->element) .
")";
922 $sql .=
" WHERE 1 = 1";
924 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
926 foreach ($search as $key => $val) {
927 if (array_key_exists($key, $object->fields)) {
928 if ($key ==
'status' && $search[$key] == -1) {
931 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
932 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
933 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
938 if ($search[$key] !=
'') {
939 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
942 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
943 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
944 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
945 if (preg_match(
'/_dtstart$/', $key)) {
946 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
948 if (preg_match(
'/_dtend$/', $key)) {
949 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
956 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
960 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
962 $parameters = array();
963 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
964 $sql .= $hookmanager->resPrint;
984 $sql .= $db->order($sortfield, $sortorder);
988 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
989 $resql = $db->query($sql);
1001 $sql .= $db->plimit($limit + 1, $offset);
1004 $resql = $db->query($sql);
1010 $num = $db->num_rows(
$resql);
1014 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
1015 $obj = $db->fetch_object(
$resql);
1017 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
1021 $arrayofselected = is_array($toselect) ? $toselect : array();
1023 $param =
'fk_job=' . $fk_job;
1024 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1025 $param .=
'&contextpage=' . urlencode($contextpage);
1027 if ($limit > 0 && $limit != $conf->liste_limit) {
1028 $param .=
'&limit=' . urlencode($limit);
1030 foreach ($search as $key => $val) {
1031 if (is_array($search[$key]) && count($search[$key])) {
1032 foreach ($search[$key] as $skey) {
1033 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
1036 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
1039 if ($optioncss !=
'') {
1040 $param .=
'&optioncss=' . urlencode($optioncss);
1043 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
1045 $parameters = array();
1046 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
1047 $param .= $hookmanager->resPrint;
1050 $arrayofmassactions = array(
1056 if ($permissiontodelete) {
1057 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
1059 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
1060 $arrayofmassactions = array();
1062 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
1064 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
1065 if ($optioncss !=
'') {
1066 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
1068 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
1069 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1070 print
'<input type="hidden" name="action" value="list">';
1071 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
1072 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
1073 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
1074 print
'<input type="hidden" name="page" value="' . $page .
'">';
1075 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
1077 $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);
1079 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_' . $object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
1082 $topicmail =
"SendPositionRef";
1083 $modelmail =
"position";
1085 $trackid =
'xxxx' . $object->id;
1086 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
1089 foreach ($fieldstosearchall as $key => $val) {
1090 $fieldstosearchall[$key] = $langs->trans($val);
1092 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) .
'</div>';
1095 $moreforfilter =
'';
1100 $parameters = array();
1101 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
1102 if (empty($reshook)) {
1103 $moreforfilter .= $hookmanager->resPrint;
1105 $moreforfilter = $hookmanager->resPrint;
1108 if (!empty($moreforfilter)) {
1109 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1110 print $moreforfilter;
1114 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1115 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
1116 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
1118 print
'<div class="div-table-responsive">';
1119 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
1124 print
'<tr class="liste_titre">';
1125 foreach ($object->fields as $key => $val) {
1126 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1127 if ($key ==
'status') {
1128 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1129 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1130 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1131 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
1132 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1133 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
1134 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
1136 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
1137 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
1138 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
1139 print
$form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
1140 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
1141 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
1142 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
1143 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
1144 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
1145 print
'<div class="nowrap">';
1146 print
$form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1148 print
'<div class="nowrap">';
1149 print
$form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1156 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
1159 $parameters = array(
'arrayfields' => $arrayfields);
1160 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
1161 print $hookmanager->resPrint;
1163 print
'<td class="liste_titre maxwidthsearch">';
1164 $searchpicto =
$form->showFilterButtons();
1167 print
'</tr>' .
"\n";
1172 print
'<tr class="liste_titre">';
1173 foreach ($object->fields as $key => $val) {
1174 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1175 if ($key ==
'status') {
1176 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1177 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1178 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1179 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
1180 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1181 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
1182 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
1184 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
1185 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
1189 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
1191 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
1192 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1193 print $hookmanager->resPrint;
1195 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
1196 print
'</tr>' .
"\n";
1199 $needToFetchEachLine = 0;
1200 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
1201 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
1202 if (preg_match(
'/\$object/', $val)) {
1203 $needToFetchEachLine++;
1212 $totalarray = array();
1213 $totalarray[
'nbfield'] = 0;
1214 while ($i < ($limit ? min($num, $limit) : $num)) {
1215 $obj = $db->fetch_object(
$resql);
1221 $object->setVarsFromFetchObj($obj);
1224 print
'<tr class="oddeven">';
1225 foreach ($object->fields as $key => $val) {
1226 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1227 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1228 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1229 } elseif ($key ==
'status') {
1230 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
1233 if (in_array($val[
'type'], array(
'timestamp'))) {
1234 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1235 } elseif ($key ==
'ref') {
1236 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
1239 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
1240 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
1244 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
1245 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
1246 if ($key ==
'status') {
1247 print $object->getLibStatut(5);
1248 } elseif ($key ==
'rowid') {
1249 print $object->getNomUrl(1);
1251 print $object->showOutputField($val, $key, $object->$key,
'');
1255 $totalarray[
'nbfield']++;
1257 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1259 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
1261 if (!isset($totalarray[
'val'])) {
1262 $totalarray[
'val'] = array();
1264 if (!isset($totalarray[
'val'][
't.' . $key])) {
1265 $totalarray[
'val'][
't.' . $key] = 0;
1267 $totalarray[
'val'][
't.' . $key] += $object->$key;
1272 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
1274 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1275 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1276 print $hookmanager->resPrint;
1278 print
'<td class="nowrap center">';
1279 if ($massactionbutton || $massaction) {
1281 if (in_array($object->id, $arrayofselected)) {
1284 print
'<input id="cb' . $object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
1288 $totalarray[
'nbfield']++;
1291 print
'</tr>' .
"\n";
1297 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
1302 foreach ($arrayfields as $key => $val) {
1303 if (!empty($val[
'checked'])) {
1307 print
'<tr><td colspan="' . $colspan .
'" class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</td></tr>';
1313 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1314 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
1315 print $hookmanager->resPrint;
1317 print
'</table>' .
"\n";
1318 print
'</div>' .
"\n";
1320 print
'</form>' .
"\n";
1323 $hidegeneratedfilelistifempty = 1;
1324 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1325 $hidegeneratedfilelistifempty = 0;
1328 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
1332 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
1333 $urlsource .= str_replace(
'&',
'&', $param);
1335 $filedir = $diroutputmassaction;
1336 $genallowed = $permissiontoread;
1337 $delallowed = $permissiontoadd;
1339 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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($action=='create') if($job->id > 0 &&(empty($action)||($action !='edit' && $action !='create'))) 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.