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';
44$langs->loadLangs(array(
"hrm",
"other",
'products'));
46$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
47$massaction =
GETPOST(
'massaction',
'alpha');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobpositionlist';
53$optioncss =
GETPOST(
'optioncss',
'aZ');
54$backtopage =
GETPOST(
'backtopage',
'alpha');
55$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
59$fk_job = (GETPOSTISSET(
'fk_job') ?
GETPOSTINT(
'fk_job') :
$id);
67$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
68$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
70if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
74$offset = $limit * $page;
83$diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
84$hookmanager->initHooks(array(
'jobpositioncard',
'globalcard'));
88$extrafields->fetch_name_optionals_label($objectposition->table_element);
91$search_array_options = $extrafields->getOptionalsFromPost($objectposition->table_element,
'',
'search_');
95 reset($objectposition->fields);
96 $sortfield =
"t." . key($objectposition->fields);
103$search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
105foreach ($objectposition->fields as $key => $val) {
106 if (
GETPOST(
'search_' . $key,
'alpha') !==
'') {
107 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
109 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
116$fieldstosearchall = array();
117foreach ($objectposition->fields as $key => $val) {
118 if (!empty($val[
'searchall'])) {
119 $fieldstosearchall[
't.' . $key] = $val[
'label'];
124$arrayfields = array();
125foreach ($objectposition->fields as $key => $val) {
127 if (!empty($val[
'visible'])) {
128 $visible = (int)
dol_eval((
string) $val[
'visible'], 1, 1,
'1');
129 $arrayfields[
't.' . $key] = array(
130 'label' => $val[
'label'],
131 'checked' => (($visible < 0) ? 0 : 1),
132 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
133 'position' => $val[
'position'],
134 'help' => isset($val[
'help']) ? $val[
'help'] :
''
139include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
141$objectposition->fields =
dol_sort_array($objectposition->fields,
'position');
148include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
151$permissiontoread = $user->hasRight(
'hrm',
'all',
'read');
152$permissiontoadd = $user->hasRight(
'hrm',
'all',
'write');
153$permissiontodelete = $user->hasRight(
'hrm',
'all',
'delete');
154$upload_dir = $conf->hrm->multidir_output[isset(
$object->entity) ?
$object->entity : 1] .
'/position';
161if (!isModEnabled(
'hrm')) {
164if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd)) {
173$parameters = array();
174$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
178if (empty($reshook)) {
181 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
182 $idBacktoPage =
GETPOST(
'fk_job',
'aZ09');
183 if ($idBacktoPage > 0) {
184 $backtopage =
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $idBacktoPage;
186 if (empty($backtopage) || ($cancel && empty($id))) {
187 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
188 if (empty($id) && (($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';
241$title = $langs->trans(
"Position");
250if ($action ==
'create') {
253 $extrafields->fetch_name_optionals_label(
$object->table_element);
254 print
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")),
'',
'object_' .
$object->picto);
256 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
257 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
258 print
'<input type="hidden" name="action" value="add">';
260 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
262 if ($backtopageforcancel) {
263 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
268 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
271 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
274 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
276 print
'</table>' .
"\n";
280 print $form->buttonsSaveCancel(
"Create");
286if ($job->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
288 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
290 if ($backtopageforcancel) {
291 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
296 $res =
$object->fetch_optionals();
304 $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>';
306 $morehtmlref =
'<div class="refid">';
307 $morehtmlref .=
$object->label;
308 $morehtmlref .=
'</div>';
310 dol_banner_tab($object,
'fk_job', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
313 print
'<div class="fichecenter">';
314 print
'<div class="fichehalfleft">';
315 print
'<div class="underbanner clearboth"></div>';
316 print
'<table class="border centpercent tableforfield">' .
"\n";
322 $object->fields[
'label'][
'visible'] = 0;
323 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
326 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
332 print
'<div class="clearboth"></div>';
345 $sql .=
$object->getFieldList(
't');
347 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
348 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
349 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef." . $key .
" as options_" . $key .
', ' :
'');
353 $parameters = array();
354 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
355 $sql .= $hookmanager->resPrint;
356 $sql = preg_replace(
'/,\s*$/',
'', $sql);
357 $sql .=
" FROM " . MAIN_DB_PREFIX .
$object->table_element .
" as t";
358 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
359 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
$object->table_element .
"_extrafields as ef on (t.rowid = ef.fk_object)";
362 $parameters = array();
363 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
364 $sql .= $hookmanager->resPrint;
365 if (
$object->ismultientitymanaged == 1) {
368 $sql .=
" WHERE 1 = 1";
370 $sql .=
" AND t.fk_job = " . ((int) $fk_job) .
" ";
372 foreach ($search as $key => $val) {
373 if (array_key_exists($key,
$object->fields)) {
374 if ($key ==
'status' && $search[$key] == -1) {
378 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
379 if ($search[$key] ==
'-1' || $search[$key] ===
'0') {
384 if ($search[$key] !=
'') {
385 $sql .=
natural_search($key, $search[$key], (($key ==
'status') ? 2 : $mode_search));
388 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
389 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
390 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
391 if (preg_match(
'/_dtstart$/', $key)) {
392 $sql .=
" AND t." . $columnName .
" >= '" . $db->idate($search[$key]) .
"'";
394 if (preg_match(
'/_dtend$/', $key)) {
395 $sql .=
" AND t." . $columnName .
" <= '" . $db->idate($search[$key]) .
"'";
402 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
406 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_sql.tpl.php';
408 $parameters = array();
409 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
410 $sql .= $hookmanager->resPrint;
412 $sql .= $db->order($sortfield, $sortorder);
415 $nbtotalofrecords =
'';
417 $resql = $db->query($sql);
418 $nbtotalofrecords = $db->num_rows($resql);
419 if (($page * $limit) > $nbtotalofrecords) {
425 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
426 $num = $nbtotalofrecords;
429 $sql .= $db->plimit($limit + 1, $offset);
432 $resql = $db->query($sql);
438 $num = $db->num_rows($resql);
442 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
443 $obj = $db->fetch_object($resql);
445 header(
"Location: " .
dol_buildpath(
'/hrm/position.php', 1) .
'?id=' . $id);
449 $arrayofselected = is_array($toselect) ? $toselect : array();
451 $param =
'fk_job=' . $fk_job;
452 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
453 $param .=
'&contextpage=' . urlencode($contextpage);
455 if ($limit > 0 && $limit != $conf->liste_limit) {
456 $param .=
'&limit='.((int) $limit);
458 foreach ($search as $key => $val) {
459 if (is_array($search[$key]) && count($search[$key])) {
460 foreach ($search[$key] as $skey) {
461 $param .=
'&search_' . $key .
'[]=' . urlencode($skey);
464 $param .=
'&search_' . $key .
'=' . urlencode($search[$key]);
467 if ($optioncss !=
'') {
468 $param .=
'&optioncss=' . urlencode($optioncss);
471 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_param.tpl.php';
473 $parameters = array(
'param' => &$param);
474 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
475 $param .= $hookmanager->resPrint;
478 $arrayofmassactions = array(
484 if ($permissiontodelete) {
485 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"') . $langs->trans(
"Delete");
487 if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
488 $arrayofmassactions = array();
490 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
492 print
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] .
'?fk_job=' . $fk_job .
'">' .
"\n";
493 if ($optioncss !=
'') {
494 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
496 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
497 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
498 print
'<input type="hidden" name="action" value="list">';
499 print
'<input type="hidden" name="massaction" value="' . $massaction .
'">';
500 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
501 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
502 print
'<input type="hidden" name="page" value="' . $page .
'">';
503 print
'<input type="hidden" name="contextpage" value="' . $contextpage .
'">';
506 $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);
508 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_' .
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
511 $topicmail =
"SendPositionRef";
512 $modelmail =
"position";
514 $trackid =
'xxxx' .
$object->id;
515 include DOL_DOCUMENT_ROOT .
'/core/tpl/massactions_pre.tpl.php';
518 foreach ($fieldstosearchall as $key => $val) {
519 $fieldstosearchall[$key] = $langs->trans($val);
521 print
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . implode(
', ', $fieldstosearchall) .
'</div>';
529 $parameters = array();
530 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
531 if (empty($reshook)) {
532 $moreforfilter .= $hookmanager->resPrint;
534 $moreforfilter = $hookmanager->resPrint;
537 if (!empty($moreforfilter)) {
538 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
539 print $moreforfilter;
543 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
544 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
545 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
547 print
'<div class="div-table-responsive">';
548 print
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ?
" listwithfilterbefore" :
"") .
'">' .
"\n";
552 print
'<tr class="liste_titre">';
553 foreach (
$object->fields as $key => $val) {
554 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
555 if ($key ==
'status') {
556 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
557 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
558 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
559 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
560 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
561 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
562 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
564 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
565 print
'<td class="liste_titre' . ($cssforfield ?
' ' . $cssforfield :
'') .
'">';
566 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
567 print $form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
568 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
569 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
570 } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
571 print
'<input type="text" class="flat maxwidth75" name="search_' . $key .
'" value="' .
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'') .
'">';
572 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
573 print
'<div class="nowrap">';
574 print $form->selectDate($search[$key .
'_dtstart'] ? $search[$key .
'_dtstart'] :
'',
"search_" . $key .
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
576 print
'<div class="nowrap">';
577 print $form->selectDate($search[$key .
'_dtend'] ? $search[$key .
'_dtend'] :
'',
"search_" . $key .
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
584 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_input.tpl.php';
587 $parameters = array(
'arrayfields' => $arrayfields);
588 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
589 print $hookmanager->resPrint;
591 print
'<td class="liste_titre maxwidthsearch">';
592 $searchpicto = $form->showFilterButtons();
595 print
'</tr>' .
"\n";
600 print
'<tr class="liste_titre">';
601 foreach (
$object->fields as $key => $val) {
602 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
603 if ($key ==
'status') {
604 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
605 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
606 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
607 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
608 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
609 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
610 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
612 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
613 print
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.' . $key,
'', $param, ($cssforfield ?
'class="' . $cssforfield .
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield .
' ' :
'')) .
"\n";
617 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_search_title.tpl.php';
619 $parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
620 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
621 print $hookmanager->resPrint;
623 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ') .
"\n";
624 print
'</tr>' .
"\n";
627 $needToFetchEachLine = 0;
628 if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
629 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
630 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
631 $needToFetchEachLine++;
640 $totalarray = array();
641 $totalarray[
'nbfield'] = 0;
642 while ($i < ($limit ? min($num, $limit) : $num)) {
643 $obj = $db->fetch_object($resql);
649 $object->setVarsFromFetchObj($obj);
652 print
'<tr class="oddeven">';
653 foreach (
$object->fields as $key => $val) {
654 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
655 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
656 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
657 } elseif ($key ==
'status') {
658 $cssforfield .= ($cssforfield ?
' ' :
'') .
'center';
661 if (in_array($val[
'type'], array(
'timestamp'))) {
662 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
663 } elseif ($key ==
'ref') {
664 $cssforfield .= ($cssforfield ?
' ' :
'') .
'nowrap';
667 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
668 $cssforfield .= ($cssforfield ?
' ' :
'') .
'right';
672 if (!empty($arrayfields[
't.' . $key][
'checked'])) {
673 print
'<td' . ($cssforfield ?
' class="' . $cssforfield .
'"' :
'') .
'>';
674 if ($key ==
'status') {
675 print
$object->getLibStatut(5);
676 } elseif ($key ==
'rowid') {
683 $totalarray[
'nbfield']++;
685 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
687 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.' . $key;
689 if (!isset($totalarray[
'val'])) {
690 $totalarray[
'val'] = array();
692 if (!isset($totalarray[
'val'][
't.' . $key])) {
693 $totalarray[
'val'][
't.' . $key] = 0;
695 $totalarray[
'val'][
't.' . $key] +=
$object->$key;
700 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_print_fields.tpl.php';
702 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
703 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
704 print $hookmanager->resPrint;
706 print
'<td class="nowrap center">';
707 if ($massactionbutton || $massaction) {
709 if (in_array(
$object->id, $arrayofselected)) {
712 print
'<input id="cb' .
$object->id .
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' .
$object->id .
'"' . ($selected ?
' checked="checked"' :
'') .
'>';
716 $totalarray[
'nbfield']++;
719 print
'</tr>' .
"\n";
725 include DOL_DOCUMENT_ROOT .
'/core/tpl/list_print_total.tpl.php';
730 foreach ($arrayfields as $key => $val) {
731 if (!empty($val[
'checked'])) {
735 print
'<tr><td colspan="' . $colspan .
'"><span class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</span></td></tr>';
741 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
742 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
743 print $hookmanager->resPrint;
745 print
'</table>' .
"\n";
746 print
'</div>' .
"\n";
748 print
'</form>' .
"\n";
750 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
751 $hidegeneratedfilelistifempty = 1;
752 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
753 $hidegeneratedfilelistifempty = 0;
756 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
760 $urlsource = $_SERVER[
'PHP_SELF'] .
'?sortfield=' . $sortfield .
'&sortorder=' . $sortorder;
761 $urlsource .= str_replace(
'&',
'&', $param);
763 $filedir = $diroutputmassaction;
764 $genallowed = $permissiontoread;
765 $delallowed = $permissiontoadd;
767 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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.