31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
33require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
34require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/hrm/class/position.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
37require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_position.lib.php';
38require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
39require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT .
'/core/lib/company.lib.php';
53$langs->loadLangs(array(
"hrm",
"other",
'products'));
55$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
56$massaction =
GETPOST(
'massaction',
'alpha');
58$confirm =
GETPOST(
'confirm',
'alpha');
59$cancel =
GETPOST(
'cancel',
'alpha');
60$toselect =
GETPOST(
'toselect',
'array');
61$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobpositionlist';
62$optioncss =
GETPOST(
'optioncss',
'aZ');
63$backtopage =
GETPOST(
'backtopage',
'alpha');
64$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
68$fk_job = (GETPOSTISSET(
'fk_job') ?
GETPOSTINT(
'fk_job') :
$id);
76$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
77$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
79if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
83$offset = $limit * $page;
92$diroutputmassaction =
$conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
93$hookmanager->initHooks(array(
'jobpositioncard',
'globalcard'));
97$extrafields->fetch_name_optionals_label($objectposition->table_element);
100$search_array_options = $extrafields->getOptionalsFromPost($objectposition->table_element,
'',
'search_');
104 reset($objectposition->fields);
105 $sortfield =
"t." . key($objectposition->fields);
112$search_all =
GETPOST(
'search_all',
'alphanohtml');
114foreach ($objectposition->fields as $key => $val) {
115 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
116 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
118 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
125$fieldstosearchall = array();
126foreach ($objectposition->fields as $key => $val) {
127 if (!empty($val[
'searchall'])) {
128 $fieldstosearchall[
't.' . $key] = $val[
'label'];
133$arrayfields = array();
134foreach ($objectposition->fields as $key => $val) {
136 if (!empty($val[
'visible'])) {
137 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
138 $arrayfields[
't.' . $key] = array(
139 'label' => $val[
'label'],
140 'checked' => (($visible < 0) ? 0 : 1),
141 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
142 'position' => $val[
'position'],
143 'help' => isset($val[
'help']) ? $val[
'help'] :
''
148include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
150$objectposition->fields =
dol_sort_array($objectposition->fields,
'position');
157include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
160$permissiontoread = $user->hasRight(
'hrm',
'all',
'read');
161$permissiontoadd = $user->hasRight(
'hrm',
'all',
'write');
162$permissiontodelete = $user->hasRight(
'hrm',
'all',
'delete');
163$upload_dir =
$conf->hrm->multidir_output[isset(
$object->entity) ?
$object->entity : 1] .
'/position';
170if (!isModEnabled(
'hrm')) {
173if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd)) {
182$parameters = array();
183$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
187if (empty($reshook)) {
190 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
191 $idBacktoPage =
GETPOST(
'fk_job',
'aZ09');
192 if ($idBacktoPage > 0) {
193 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $idBacktoPage;
195 if (empty($backtopage) || ($cancel && empty($id))) {
196 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
197 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
198 $backtopage = $backurlforlist;
201 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?fk_job=' . ($fk_job > 0 ? $fk_job :
'__ID__');
203 $backtopage =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=__ID__';
209 $triggermodname =
'HRM_POSITION_MODIFY';
216 include DOL_DOCUMENT_ROOT .
'/core/actions_changeselectedfields.inc.php';
219 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
220 foreach (
$object->fields as $key => $val) {
222 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
223 $search[$key .
'_dtstart'] =
'';
224 $search[$key .
'_dtend'] =
'';
228 $search_array_options = array();
230 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
231 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
236 $objectclass =
'Position';
237 $objectlabel =
'Position';
238 $uploaddir =
$conf->hrm->dir_output;
239 include DOL_DOCUMENT_ROOT .
'/core/actions_massactions.inc.php';
241 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
250$title = $langs->trans(
"Position");
259if ($action ==
'create') {
262 $extrafields->fetch_name_optionals_label(
$object->table_element);
263 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")),
'',
'object_' .
$object->picto);
265 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
266 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
267 print
'<input type="hidden" name="action" value="add">';
269 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
271 if ($backtopageforcancel) {
272 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
277 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
280 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
283 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
285 print
'</table>' .
"\n";
289 print $form->buttonsSaveCancel(
"Create");
295if ($job->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
297 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
299 if ($backtopageforcancel) {
300 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
305 $res =
$object->fetch_optionals();
313 $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>';
315 $morehtmlref =
'<div class="refid">';
316 $morehtmlref .=
$object->label;
317 $morehtmlref .=
'</div>';
319 dol_banner_tab($object,
'fk_job', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
322 print
'<div class="fichecenter">';
323 print
'<div class="fichehalfleft">';
324 print
'<div class="underbanner clearboth"></div>';
325 print
'<table class="border centpercent tableforfield">' .
"\n";
331 $object->fields[
'label'][
'visible'] = 0;
332 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
335 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
341 print
'<div class="clearboth"></div>';
354 $sql .=
$object->getFieldList(
't');
356 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
357 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
358 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
362 $parameters = array();
363 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
364 $sql .= $hookmanager->resPrint;
365 $sql = preg_replace(
'/,\s*$/',
'', $sql);
366 $sql .=
" FROM " . MAIN_DB_PREFIX .
$object->table_element .
" as t";
367 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
368 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
$object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
371 $parameters = array();
372 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
373 $sql .= $hookmanager->resPrint;
374 if (
$object->ismultientitymanaged == 1) {
377 $sql .=
" WHERE 1 = 1";
379 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
381 foreach ($search as $key => $val) {
382 if (array_key_exists($key,
$object->fields)) {
383 if ($key ==
'status' && $search[$key] == -1) {
387 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
388 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
393 if ($search[$key] !=
'') {
394 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
397 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
398 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
399 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
400 if (preg_match(
'/_dtstart$/', $key)) {
401 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
403 if (preg_match(
'/_dtend$/', $key)) {
404 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
411 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
415 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
417 $parameters = array();
418 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
419 $sql .= $hookmanager->resPrint;
421 $sql .= $db->order($sortfield, $sortorder);
424 $nbtotalofrecords =
'';
426 $resql = $db->query($sql);
427 $nbtotalofrecords = $db->num_rows($resql);
428 if (($page * $limit) > $nbtotalofrecords) {
434 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
435 $num = $nbtotalofrecords;
438 $sql .= $db->plimit($limit + 1, $offset);
441 $resql = $db->query($sql);
447 $num = $db->num_rows($resql);
451 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
452 $obj = $db->fetch_object($resql);
454 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
458 $arrayofselected = is_array($toselect) ? $toselect : array();
460 $param =
'fk_job=' . $fk_job;
461 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
462 $param .=
'&contextpage=' . urlencode($contextpage);
464 if ($limit > 0 && $limit !=
$conf->liste_limit) {
465 $param .=
'&limit='.((int) $limit);
467 foreach ($search as $key => $val) {
468 if (is_array($search[$key]) && count($search[$key])) {
469 foreach ($search[$key] as $skey) {
470 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
473 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
476 if ($optioncss !=
'') {
477 $param .=
'&optioncss=' . urlencode($optioncss);
480 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
482 $parameters = array(
'param' => &$param);
483 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
484 $param .= $hookmanager->resPrint;
487 $arrayofmassactions = array(
493 if ($permissiontodelete) {
494 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
496 if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
497 $arrayofmassactions = array();
499 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
501 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
502 if ($optioncss !=
'') {
503 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
505 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
506 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
507 print
'<input type="hidden" name="action" value="list">';
508 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
509 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
510 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
511 print
'<input type="hidden" name="page" value="' . $page .
'">';
512 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
515 $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);
517 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_' .
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
520 $topicmail =
"SendPositionRef";
521 $modelmail =
"position";
523 $trackid =
'xxxx' .
$object->id;
524 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
527 foreach ($fieldstosearchall as $key => $val) {
528 $fieldstosearchall[$key] = $langs->trans($val);
530 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . implode(
', ', $fieldstosearchall) .
'</div>';
538 $parameters = array();
539 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
540 if (empty($reshook)) {
541 $moreforfilter .= $hookmanager->resPrint;
543 $moreforfilter = $hookmanager->resPrint;
546 if (!empty($moreforfilter)) {
547 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
548 print $moreforfilter;
552 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
553 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
554 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
556 print
'<div class="div-table-responsive">';
557 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
561 print
'<tr class="liste_titre">';
562 foreach (
$object->fields as $key => $val) {
563 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
564 if ($key ==
'status') {
565 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
566 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
567 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
568 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
569 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
570 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
571 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
573 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
574 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
575 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
576 print $form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
577 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
578 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
579 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
580 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
581 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
582 print
'<div class="nowrap">';
583 print $form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
585 print
'<div class="nowrap">';
586 print $form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
593 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
596 $parameters = array(
'arrayfields' => $arrayfields);
597 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
598 print $hookmanager->resPrint;
600 print
'<td class="liste_titre maxwidthsearch">';
601 $searchpicto = $form->showFilterButtons();
604 print
'</tr>' .
"\n";
609 print
'<tr class="liste_titre">';
610 foreach (
$object->fields as $key => $val) {
611 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
612 if ($key ==
'status') {
613 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
614 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
615 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
616 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
617 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
618 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
619 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
621 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
622 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
626 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
628 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
629 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
630 print $hookmanager->resPrint;
632 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
633 print
'</tr>' .
"\n";
636 $needToFetchEachLine = 0;
637 if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
638 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
639 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
640 $needToFetchEachLine++;
649 $totalarray = array();
650 $totalarray[
'nbfield'] = 0;
651 while ($i < ($limit ? min($num, $limit) : $num)) {
652 $obj = $db->fetch_object($resql);
658 $object->setVarsFromFetchObj($obj);
661 print
'<tr class="oddeven">';
662 foreach (
$object->fields as $key => $val) {
663 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
664 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
665 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
666 } elseif ($key ==
'status') {
667 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
670 if (in_array($val[
'type'], array(
'timestamp'))) {
671 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
672 } elseif ($key ==
'ref') {
673 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
676 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
677 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
681 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
682 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
683 if ($key ==
'status') {
684 print
$object->getLibStatut(5);
685 } elseif ($key ==
'rowid') {
692 $totalarray[
'nbfield']++;
694 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
696 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
698 if (!isset($totalarray[
'val'])) {
699 $totalarray[
'val'] = array();
701 if (!isset($totalarray[
'val'][
't.' . $key])) {
702 $totalarray[
'val'][
't.' . $key] = 0;
704 $totalarray[
'val'][
't.' . $key] +=
$object->$key;
709 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
711 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
712 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
713 print $hookmanager->resPrint;
715 print
'<td class="nowrap center">';
716 if ($massactionbutton || $massaction) {
718 if (in_array(
$object->id, $arrayofselected)) {
721 print
'<input id="cb' .
$object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' .
$object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
725 $totalarray[
'nbfield']++;
728 print
'</tr>' .
"\n";
734 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
739 foreach ($arrayfields as $key => $val) {
740 if (!empty($val[
'checked'])) {
744 print
'<tr><td colspan="' . $colspan .
'"><span class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</span></td></tr>';
750 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
751 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
752 print $hookmanager->resPrint;
754 print
'</table>' .
"\n";
755 print
'</div>' .
"\n";
757 print
'</form>' .
"\n";
759 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
760 $hidegeneratedfilelistifempty = 1;
761 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
762 $hidegeneratedfilelistifempty = 0;
765 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
769 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
770 $urlsource .= str_replace(
'&',
'&', $param);
772 $filedir = $diroutputmassaction;
773 $genallowed = $permissiontoread;
774 $delallowed = $permissiontoadd;
776 print $formfile->showdocuments(
'massfilesarea_hrm',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
jobPrepareHead($object)
Prepare array of tabs for Job.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.