29require 
'../main.inc.php';
 
   30require_once DOL_DOCUMENT_ROOT . 
'/core/class/html.formcompany.class.php';
 
   31require_once DOL_DOCUMENT_ROOT . 
'/core/class/html.formfile.class.php';
 
   32require_once DOL_DOCUMENT_ROOT . 
'/core/class/html.formprojet.class.php';
 
   33require_once DOL_DOCUMENT_ROOT . 
'/hrm/class/position.class.php';
 
   34require_once DOL_DOCUMENT_ROOT . 
'/hrm/class/job.class.php';
 
   35require_once DOL_DOCUMENT_ROOT . 
'/hrm/lib/hrm_position.lib.php';
 
   36require_once DOL_DOCUMENT_ROOT . 
'/hrm/lib/hrm_job.lib.php';
 
   37require_once DOL_DOCUMENT_ROOT . 
'/core/lib/date.lib.php';
 
   38require_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'); 
 
   52$backtopage  = 
GETPOST(
'backtopage', 
'alpha');
 
   53$backtopageforcancel = 
GETPOST(
'backtopageforcancel', 
'alpha');
 
   57$fk_job  = (GETPOSTISSET(
'fk_job') ? 
GETPOST(
'fk_job', 
'int') : $id);
 
   58$fk_user = 
GETPOST(
'fk_user', 
'int');
 
   64$limit       = 
GETPOST(
'limit', 
'int') ? 
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
   65$sortfield   = 
GETPOST(
'sortfield', 
'aZ09comma');
 
   66$sortorder   = 
GETPOST(
'sortorder', 
'aZ09comma');
 
   67$page        = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
   68if (empty($page) || $page < 0 || 
GETPOST(
'button_search', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) {
 
   72$offset     = $limit * $page;
 
   78$object = 
new Job($db);
 
   81$diroutputmassaction = $conf->hrm->dir_output . 
'/temp/massgeneration/' . $user->id;
 
   82$hookmanager->initHooks(array(
'jobpositioncard', 
'globalcard')); 
 
   86$extrafields->fetch_name_optionals_label($objectposition->table_element);
 
   89$search_array_options = $extrafields->getOptionalsFromPost($objectposition->table_element, 
'', 
'search_');
 
   93  reset($objectposition->fields);                    
 
   94  $sortfield = 
"t." . key($objectposition->fields); 
 
  101$search_all = 
GETPOST(
'search_all', 
'alphanohtml') ? 
GETPOST(
'search_all', 
'alphanohtml') : 
GETPOST(
'sall', 
'alphanohtml');
 
  103foreach ($objectposition->fields as $key => $val) {
 
  104  if (
GETPOST(
'search_' . $key, 
'alpha') !== 
'') {
 
  105    $search[$key] = 
GETPOST(
'search_' . $key, 
'alpha');
 
  107  if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
  108    $search[$key . 
'_dtstart'] = 
dol_mktime(0, 0, 0, 
GETPOST(
'search_' . $key . 
'_dtstartmonth', 
'int'), 
GETPOST(
'search_' . $key . 
'_dtstartday', 
'int'), 
GETPOST(
'search_' . $key . 
'_dtstartyear', 
'int'));
 
  109    $search[$key . 
'_dtend'] = 
dol_mktime(23, 59, 59, 
GETPOST(
'search_' . $key . 
'_dtendmonth', 
'int'), 
GETPOST(
'search_' . $key . 
'_dtendday', 
'int'), 
GETPOST(
'search_' . $key . 
'_dtendyear', 
'int'));
 
  114$fieldstosearchall = array();
 
  115foreach ($objectposition->fields as $key => $val) {
 
  116  if (!empty($val[
'searchall'])) {
 
  117    $fieldstosearchall[
't.' . $key] = $val[
'label'];
 
  122$arrayfields = array();
 
  123foreach ($objectposition->fields as $key => $val) {
 
  125  if (!empty($val[
'visible'])) {
 
  126    $visible = (int) 
dol_eval($val[
'visible'], 1, 1, 
'1');
 
  127    $arrayfields[
't.' . $key] = array(
 
  128      'label' => $val[
'label'],
 
  129      'checked' => (($visible < 0) ? 0 : 1),
 
  130      'enabled' => ($visible != 3 && 
dol_eval($val[
'enabled'], 1, 1, 
'1')),
 
  131      'position' => $val[
'position'],
 
  132      'help' => isset($val[
'help']) ? $val[
'help'] : 
'' 
  137include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_list_array_fields.tpl.php';
 
  139$objectposition->fields = 
dol_sort_array($objectposition->fields, 
'position');
 
  146include DOL_DOCUMENT_ROOT . 
'/core/actions_fetchobject.inc.php'; 
 
  149$permissiontoread = $user->rights->hrm->all->read;
 
  150$permissiontoadd = $user->rights->hrm->all->write; 
 
  151$permissiontodelete = $user->rights->hrm->all->delete;
 
  152$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . 
'/position';
 
  159if (!isModEnabled(
'hrm')) {
 
  162if (!$permissiontoread || ($action === 
'create' && !$permissiontoadd)) {
 
  171$parameters = array();
 
  172$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  176if (empty($reshook)) {
 
  179  $backurlforlist = 
dol_buildpath(
'/hrm/position_list.php', 1);
 
  180  $idBacktoPage = 
GETPOST(
'fk_job', 
'aZ09');
 
  181  if ($idBacktoPage > 0) {
 
  182    $backtopage = 
dol_buildpath(
'/hrm/position.php', 1) . 
'?id=' . $idBacktoPage;
 
  184  if (empty($backtopage) || ($cancel && empty($id))) {
 
  185    if (empty($backtopage) || ($cancel && strpos($backtopage, 
'__ID__'))) {
 
  186      if (empty($id) && (($action != 
'add' && $action != 
'create') || $cancel)) {
 
  187        $backtopage = $backurlforlist;
 
  190          $backtopage = 
dol_buildpath(
'/hrm/position.php', 1) . 
'?fk_job=' . ($fk_job > 0 ? $fk_job : 
'__ID__');
 
  192          $backtopage = 
dol_buildpath(
'/hrm/position_card.php', 1) . 
'?id=__ID__';
 
  198  $triggermodname = 
'HRM_POSITION_MODIFY'; 
 
  205  include DOL_DOCUMENT_ROOT . 
'/core/actions_changeselectedfields.inc.php';
 
  208  if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) { 
 
  209    foreach ($object->fields as $key => $val) {
 
  211      if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
  212        $search[$key . 
'_dtstart'] = 
'';
 
  213        $search[$key . 
'_dtend'] = 
'';
 
  217    $search_array_options = array();
 
  219  if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')
 
  220    || 
GETPOST(
'button_search_x', 
'alpha') || 
GETPOST(
'button_search.x', 
'alpha') || 
GETPOST(
'button_search', 
'alpha')) {
 
  225  $objectclass = 
'Position';
 
  226  $objectlabel = 
'Position';
 
  227  $uploaddir = $conf->hrm->dir_output;
 
  228  include DOL_DOCUMENT_ROOT . 
'/core/actions_massactions.inc.php';
 
  230  include DOL_DOCUMENT_ROOT . 
'/core/actions_addupdatedelete.inc.php';
 
  239$title = $langs->trans(
"Position");
 
  248if ($action == 
'create') {
 
  251  $extrafields->fetch_name_optionals_label($object->table_element);
 
  252  print 
load_fiche_titre($langs->trans(
"NewObject", $langs->transnoentitiesnoconv(
"Position")), 
'', 
'object_' . $object->picto);
 
  254  print 
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] . 
'">';
 
  255  print 
'<input type="hidden" name="token" value="' . newToken() . 
'">';
 
  256  print 
'<input type="hidden" name="action" value="add">';
 
  258    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 $form->buttonsSaveCancel(
"Create");
 
  284if ($job->id > 0 && (empty($action) || ($action != 
'edit' && $action != 
'create'))) {
 
  286    print 
'<input type="hidden" name="backtopage" value="' . $backtopage . 
'">';
 
  288  if ($backtopageforcancel) {
 
  289    print 
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . 
'">';
 
  294  $res = $object->fetch_optionals();
 
  298  print 
dol_get_fiche_head($head, 
'position', $langs->trans(
"Workstation"), -1, $object->picto);
 
  302  $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>';
 
  304  $morehtmlref = 
'<div class="refid">';
 
  305  $morehtmlref.= $object->label;
 
  306  $morehtmlref .= 
'</div>';
 
  308  dol_banner_tab($object, 
'fk_job', $linkback, 1, 
'rowid', 
'rowid', $morehtmlref);
 
  311  print 
'<div class="fichecenter">';
 
  312  print 
'<div class="fichehalfleft">';
 
  313  print 
'<div class="underbanner clearboth"></div>';
 
  314  print 
'<table class="border centpercent tableforfield">' . 
"\n";
 
  320  $object->fields[
'label'][
'visible']=0; 
 
  321  include DOL_DOCUMENT_ROOT . 
'/core/tpl/commonfields_view.tpl.php';
 
  324  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_view.tpl.php';
 
  330  print 
'<div class="clearboth"></div>';
 
  337  $object = $objectposition;
 
  343  $sql .= $object->getFieldList(
't');
 
  345  if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
 
  346    foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
 
  347      $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] != 
'separate' ? 
", ef." . $key . 
" as options_" . $key . 
', ' : 
'');
 
  351  $parameters = array();
 
  352  $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object); 
 
  353  $sql .= $hookmanager->resPrint;
 
  354  $sql = preg_replace(
'/,\s*$/', 
'', $sql);
 
  355  $sql .= 
" FROM " . MAIN_DB_PREFIX . $object->table_element . 
" as t";
 
  356  if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
 
  357    $sql .= 
" LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . 
"_extrafields as ef on (t.rowid = ef.fk_object)";
 
  360  $parameters = array();
 
  361  $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object); 
 
  362  $sql .= $hookmanager->resPrint;
 
  363  if ($object->ismultientitymanaged == 1) {
 
  364    $sql .= 
" WHERE t.entity IN (" . 
getEntity($object->element) . 
")";
 
  366    $sql .= 
" WHERE 1 = 1";
 
  368  $sql .= 
" AND t.fk_job =  " . ((int) $fk_job) . 
" ";
 
  370  foreach ($search as $key => $val) {
 
  371    if (array_key_exists($key, $object->fields)) {
 
  372      if ($key == 
'status' && $search[$key] == -1) {
 
  375      $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
 
  376      if ((strpos($object->fields[$key][
'type'], 
'integer:') === 0) || (strpos($object->fields[$key][
'type'], 
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
 
  377        if ($search[$key] == 
'-1' || $search[$key] === 
'0') {
 
  382      if ($search[$key] != 
'') {
 
  383        $sql .= 
natural_search($key, $search[$key], (($key == 
'status') ? 2 : $mode_search));
 
  386      if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] != 
'') {
 
  387        $columnName = preg_replace(
'/(_dtstart|_dtend)$/', 
'', $key);
 
  388        if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
 
  389          if (preg_match(
'/_dtstart$/', $key)) {
 
  390            $sql .= 
" AND t." . $columnName . 
" >= '" . $db->idate($search[$key]) . 
"'";
 
  392          if (preg_match(
'/_dtend$/', $key)) {
 
  393            $sql .= 
" AND t." . $columnName . 
" <= '" . $db->idate($search[$key]) . 
"'";
 
  400    $sql .= 
natural_search(array_keys($fieldstosearchall), $search_all);
 
  404  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_list_search_sql.tpl.php';
 
  406  $parameters = array();
 
  407  $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object); 
 
  408  $sql .= $hookmanager->resPrint;
 
  410  $sql .= $db->order($sortfield, $sortorder);
 
  413  $nbtotalofrecords = 
'';
 
  415    $resql = $db->query($sql);
 
  416    $nbtotalofrecords = $db->num_rows($resql);
 
  417    if (($page * $limit) > $nbtotalofrecords) {    
 
  423  if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
 
  424    $num = $nbtotalofrecords;
 
  427      $sql .= $db->plimit($limit + 1, $offset);
 
  430    $resql = $db->query($sql);
 
  436    $num = $db->num_rows($resql);
 
  440  if ($num == 1 && 
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
 
  441    $obj = $db->fetch_object($resql);
 
  443    header(
"Location: " . 
dol_buildpath(
'/hrm/position.php', 1) . 
'?id=' . $id);
 
  447  $arrayofselected = is_array($toselect) ? $toselect : array();
 
  449  $param = 
'fk_job=' . $fk_job;
 
  450  if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
 
  451    $param .= 
'&contextpage=' . urlencode($contextpage);
 
  453  if ($limit > 0 && $limit != $conf->liste_limit) {
 
  454    $param .= 
'&limit='.((int) $limit);
 
  456  foreach ($search as $key => $val) {
 
  457    if (is_array($search[$key]) && count($search[$key])) {
 
  458      foreach ($search[$key] as $skey) {
 
  459        $param .= 
'&search_' . $key . 
'[]=' . urlencode($skey);
 
  462      $param .= 
'&search_' . $key . 
'=' . urlencode($search[$key]);
 
  465  if ($optioncss != 
'') {
 
  466    $param .= 
'&optioncss=' . urlencode($optioncss);
 
  469  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_list_search_param.tpl.php';
 
  471  $parameters = array(
'param' => &$param);
 
  472  $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object); 
 
  473  $param .= $hookmanager->resPrint;
 
  476  $arrayofmassactions = array(
 
  482  if ($permissiontodelete) {
 
  483    $arrayofmassactions[
'predelete'] = 
img_picto(
'', 
'delete', 
'class="pictofixedwidth"') . $langs->trans(
"Delete");
 
  485  if (
GETPOST(
'nomassaction', 
'int') || in_array($massaction, array(
'presend', 
'predelete'))) {
 
  486    $arrayofmassactions = array();
 
  488  $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
 
  490  print 
'<form method="POST" id="searchFormList" action="' . $_SERVER[
"PHP_SELF"] . 
'?fk_job=' . $fk_job . 
'">' . 
"\n";
 
  491  if ($optioncss != 
'') {
 
  492    print 
'<input type="hidden" name="optioncss" value="' . $optioncss . 
'">';
 
  494  print 
'<input type="hidden" name="token" value="' . newToken() . 
'">';
 
  495  print 
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 
  496  print 
'<input type="hidden" name="action" value="list">';
 
  497  print 
'<input type="hidden" name="massaction" value="' . $massaction . 
'">';
 
  498  print 
'<input type="hidden" name="sortfield" value="' . $sortfield . 
'">';
 
  499  print 
'<input type="hidden" name="sortorder" value="' . $sortorder . 
'">';
 
  500  print 
'<input type="hidden" name="page" value="' . $page . 
'">';
 
  501  print 
'<input type="hidden" name="contextpage" value="' . $contextpage . 
'">';
 
  504  $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);
 
  506  print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 
'object_' . $object->picto, 0, $newcardbutton, 
'', $limit, 0, 0, 1);
 
  509  $topicmail = 
"SendPositionRef";
 
  510  $modelmail = 
"position";
 
  512  $trackid = 
'xxxx' . $object->id;
 
  513  include DOL_DOCUMENT_ROOT . 
'/core/tpl/massactions_pre.tpl.php';
 
  516    foreach ($fieldstosearchall as $key => $val) {
 
  517      $fieldstosearchall[$key] = $langs->trans($val);
 
  519    print 
'<div class="divsearchfieldfilter">' . $langs->trans(
"FilterOnInto", $search_all) . join(
', ', $fieldstosearchall) . 
'</div>';
 
  527  $parameters = array();
 
  528  $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object); 
 
  529  if (empty($reshook)) {
 
  530    $moreforfilter .= $hookmanager->resPrint;
 
  532    $moreforfilter = $hookmanager->resPrint;
 
  535  if (!empty($moreforfilter)) {
 
  536    print 
'<div class="liste_titre liste_titre_bydiv centpercent">';
 
  537    print $moreforfilter;
 
  541  $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
  542  $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage); 
 
  543  $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) : 
'');
 
  545  print 
'<div class="div-table-responsive">'; 
 
  546  print 
'<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? 
" listwithfilterbefore" : 
"") . 
'">' . 
"\n";
 
  550  print 
'<tr class="liste_titre">';
 
  551  foreach ($object->fields as $key => $val) {
 
  552    $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ? 
'' : $val[
'css']) : $val[
'csslist']);
 
  553    if ($key == 
'status') {
 
  554      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'center';
 
  555    } elseif (in_array($val[
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  556      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'center';
 
  557    } elseif (in_array($val[
'type'], array(
'timestamp'))) {
 
  558      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'nowrap';
 
  559    } elseif (in_array($val[
'type'], array(
'double(24,8)', 
'double(6,3)', 
'integer', 
'real', 
'price')) && $val[
'label'] != 
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
 
  560      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'right';
 
  562    if (!empty($arrayfields[
't.' . $key][
'checked'])) {
 
  563      print 
'<td class="liste_titre' . ($cssforfield ? 
' ' . $cssforfield : 
'') . 
'">';
 
  564      if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
 
  565        print $form->selectarray(
'search_' . $key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] : 
''), $val[
'notnull'], 0, 0, 
'', 1, 0, 0, 
'', 
'maxwidth100', 1);
 
  566      } elseif ((strpos($val[
'type'], 
'integer:') === 0) || (strpos($val[
'type'], 
'sellist:') === 0)) {
 
  567        print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : 
''), 
'', 
'', 
'search_', 
'maxwidth125', 1);
 
  568      } elseif (!preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
  569        print 
'<input type="text" class="flat maxwidth75" name="search_' . $key . 
'" value="' . 
dol_escape_htmltag(isset($search[$key]) ? $search[$key] : 
'') . 
'">';
 
  570      } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
  571        print 
'<div class="nowrap">';
 
  572        print $form->selectDate($search[$key . 
'_dtstart'] ? $search[$key . 
'_dtstart'] : 
'', 
"search_" . $key . 
"_dtstart", 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
  574        print 
'<div class="nowrap">';
 
  575        print $form->selectDate($search[$key . 
'_dtend'] ? $search[$key . 
'_dtend'] : 
'', 
"search_" . $key . 
"_dtend", 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
  582  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_list_search_input.tpl.php';
 
  585  $parameters = array(
'arrayfields' => $arrayfields);
 
  586  $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object); 
 
  587  print $hookmanager->resPrint;
 
  589  print 
'<td class="liste_titre maxwidthsearch">';
 
  590  $searchpicto = $form->showFilterButtons();
 
  593  print 
'</tr>' . 
"\n";
 
  598  print 
'<tr class="liste_titre">';
 
  599  foreach ($object->fields as $key => $val) {
 
  600    $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ? 
'' : $val[
'css']) : $val[
'csslist']);
 
  601    if ($key == 
'status') {
 
  602      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'center';
 
  603    } elseif (in_array($val[
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  604      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'center';
 
  605    } elseif (in_array($val[
'type'], array(
'timestamp'))) {
 
  606      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'nowrap';
 
  607    } elseif (in_array($val[
'type'], array(
'double(24,8)', 
'double(6,3)', 
'integer', 
'real', 
'price')) && $val[
'label'] != 
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
 
  608      $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'right';
 
  610    if (!empty($arrayfields[
't.' . $key][
'checked'])) {
 
  611      print 
getTitleFieldOfList($arrayfields[
't.' . $key][
'label'], 0, $_SERVER[
'PHP_SELF'], 
't.' . $key, 
'', $param, ($cssforfield ? 
'class="' . $cssforfield . 
'"' : 
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . 
' ' : 
'')) . 
"\n";
 
  615  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_list_search_title.tpl.php';
 
  617  $parameters = array(
'arrayfields' => $arrayfields, 
'param' => $param, 
'sortfield' => $sortfield, 
'sortorder' => $sortorder);
 
  618  $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object); 
 
  619  print $hookmanager->resPrint;
 
  621  print 
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"], 
'', 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ') . 
"\n";
 
  622  print 
'</tr>' . 
"\n";
 
  625  $needToFetchEachLine = 0;
 
  626  if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
 
  627    foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
 
  628      if (!is_null($val) && preg_match(
'/\$object/', $val)) {
 
  629        $needToFetchEachLine++; 
 
  638  $totalarray = array();
 
  639  $totalarray[
'nbfield'] = 0;
 
  640  while ($i < ($limit ? min($num, $limit) : $num)) {
 
  641    $obj = $db->fetch_object($resql);
 
  647    $object->setVarsFromFetchObj($obj);
 
  650    print 
'<tr class="oddeven">';
 
  651    foreach ($object->fields as $key => $val) {
 
  652      $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ? 
'' : $val[
'css']) : $val[
'csslist']);
 
  653      if (in_array($val[
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  654        $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'center';
 
  655      } elseif ($key == 
'status') {
 
  656        $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'center';
 
  659      if (in_array($val[
'type'], array(
'timestamp'))) {
 
  660        $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'nowrap';
 
  661      } elseif ($key == 
'ref') {
 
  662        $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'nowrap';
 
  665      if (in_array($val[
'type'], array(
'double(24,8)', 
'double(6,3)', 
'integer', 
'real', 
'price')) && !in_array($key, array(
'rowid', 
'status')) && empty($val[
'arrayofkeyval'])) {
 
  666        $cssforfield .= ($cssforfield ? 
' ' : 
'') . 
'right';
 
  670      if (!empty($arrayfields[
't.' . $key][
'checked'])) {
 
  671        print 
'<td' . ($cssforfield ? 
' class="' . $cssforfield . 
'"' : 
'') . 
'>';
 
  672        if ($key == 
'status') {
 
  673          print $object->getLibStatut(5);
 
  674        } elseif ($key == 
'rowid') {
 
  675          print $object->getNomUrl(1);
 
  677          print $object->showOutputField($val, $key, $object->$key, 
'');
 
  681          $totalarray[
'nbfield']++;
 
  683        if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
 
  685            $totalarray[
'pos'][$totalarray[
'nbfield']] = 
't.' . $key;
 
  687          if (!isset($totalarray[
'val'])) {
 
  688            $totalarray[
'val'] = array();
 
  690          if (!isset($totalarray[
'val'][
't.' . $key])) {
 
  691            $totalarray[
'val'][
't.' . $key] = 0;
 
  693          $totalarray[
'val'][
't.' . $key] += $object->$key;
 
  698    include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_list_print_fields.tpl.php';
 
  700    $parameters = array(
'arrayfields' => $arrayfields, 
'object' => $object, 
'obj' => $obj, 
'i' => $i, 
'totalarray' => &$totalarray);
 
  701    $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object); 
 
  702    print $hookmanager->resPrint;
 
  704    print 
'<td class="nowrap center">';
 
  705    if ($massactionbutton || $massaction) { 
 
  707      if (in_array($object->id, $arrayofselected)) {
 
  710      print 
'<input id="cb' . $object->id . 
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . 
'"' . ($selected ? 
' checked="checked"' : 
'') . 
'>';
 
  714      $totalarray[
'nbfield']++;
 
  717    print 
'</tr>' . 
"\n";
 
  723  include DOL_DOCUMENT_ROOT . 
'/core/tpl/list_print_total.tpl.php';
 
  728    foreach ($arrayfields as $key => $val) {
 
  729      if (!empty($val[
'checked'])) {
 
  733    print 
'<tr><td colspan="' . $colspan . 
'"><span class="opacitymedium">' . $langs->trans(
"NoRecordFound") . 
'</span></td></tr>';
 
  739  $parameters = array(
'arrayfields' => $arrayfields, 
'sql' => $sql);
 
  740  $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object); 
 
  741  print $hookmanager->resPrint;
 
  743  print 
'</table>' . 
"\n";
 
  744  print 
'</div>' . 
"\n";
 
  746  print 
'</form>' . 
"\n";
 
  748  if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === 
'' || $nbtotalofrecords)) {
 
  749    $hidegeneratedfilelistifempty = 1;
 
  750    if ($massaction == 
'builddoc' || $action == 
'remove_file' || $show_files) {
 
  751      $hidegeneratedfilelistifempty = 0;
 
  754    require_once DOL_DOCUMENT_ROOT . 
'/core/class/html.formfile.class.php';
 
  758    $urlsource = $_SERVER[
'PHP_SELF'] . 
'?sortfield=' . $sortfield . 
'&sortorder=' . $sortorder;
 
  759    $urlsource .= str_replace(
'&', 
'&', $param);
 
  761    $filedir = $diroutputmassaction;
 
  762    $genallowed = $permissiontoread;
 
  763    $delallowed = $permissiontoadd;
 
  765    print $formfile->showdocuments(
'massfilesarea_hrm', 
'', $filedir, $urlsource, 0, $delallowed, 
'', 1, 1, 0, 48, 1, $param, $title, 
'', 
'', 
'', 
null, $hidegeneratedfilelistifempty);
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
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='', $dragdropfile=0)
Show tabs of a record.
 
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...
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
 
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...
 
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.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
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.
 
getDolGlobalString($key, $default='')
Return 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.