44 require_once
'../main.inc.php';
45 require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment_recruitmentjobposition.lib.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
50 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
57 $langs->loadLangs(array(
"recruitment",
"other"));
62 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
63 $massaction =
GETPOST(
'massaction',
'alpha');
64 $show_files =
GETPOST(
'show_files',
'int');
65 $confirm =
GETPOST(
'confirm',
'alpha');
66 $cancel =
GETPOST(
'cancel',
'alpha');
67 $toselect =
GETPOST(
'toselect',
'array');
68 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : ((empty($id) && empty($ref)) ?
'recruitmentcandidaturelist' :
'recruitmentjobposition_candidature');
69 $backtopage =
GETPOST(
'backtopage',
'alpha');
70 $optioncss =
GETPOST(
'optioncss',
'aZ');
74 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
75 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
76 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
78 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
82 $offset = $limit * $page;
83 $pageprev = $page - 1;
84 $pagenext = $page + 1;
89 $diroutputmassaction = $conf->recruitment->dir_output.
'/temp/massgeneration/'.$user->id;
90 $hookmanager->initHooks(array(
'recruitmentcandidaturelist'));
93 $extrafields->fetch_name_optionals_label($object->table_element);
96 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
100 $sortfield =
"t.date_creation";
107 $search_all =
GETPOST(
'search_all',
'alphanohtml');
109 foreach ($object->fields as $key => $val) {
110 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
111 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
113 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
114 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
115 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
120 $fieldstosearchall = array();
121 foreach ($object->fields as $key => $val) {
122 if (!empty($val[
'searchall'])) {
123 $fieldstosearchall[
't.'.$key] = $val[
'label'];
128 $arrayfields = array();
129 foreach ($object->fields as $key => $val) {
131 if (!empty($val[
'visible'])) {
132 $visible = (int)
dol_eval($val[
'visible'], 1);
133 $arrayfields[
't.'.$key] = array(
134 'label'=>$val[
'label'],
135 'checked'=>(($visible < 0) ? 0 : 1),
136 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
137 'position'=>$val[
'position'],
138 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
143 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
147 if ($id > 0 || !empty($ref)) {
148 $jobposition->fetch($id, $ref);
149 $id = $jobposition->id;
155 $permissiontoread = $user->rights->recruitment->recruitmentjobposition->read;
156 $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write;
157 $permissiontodelete = $user->rights->recruitment->recruitmentjobposition->delete;
163 if ($jobposition->id > 0) {
164 $isdraft = (($jobposition->status == $jobposition::STATUS_DRAFT) ? 1 : 0);
165 $result =
restrictedArea($user,
'recruitment', $jobposition->id,
'recruitment_recruitmentjobposition',
'recruitmentjobposition',
'',
'rowid', $isdraft);
167 $result =
restrictedArea($user,
'recruitment', 0,
'recruitment_recruitmentcandidature',
'recruitmentjobposition');
176 if (
GETPOST(
'cancel',
'alpha')) {
180 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
184 $parameters = array();
185 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
190 if (empty($reshook)) {
192 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
195 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
196 foreach ($object->fields as $key => $val) {
198 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
199 $search[$key.
'_dtstart'] =
'';
200 $search[$key.
'_dtend'] =
'';
204 $search_array_options = array();
206 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
207 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
212 $objectclass =
'RecruitmentCandidature';
213 $objectlabel =
'RecruitmentCandidature';
214 $uploaddir = $conf->recruitment->dir_output;
215 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
230 $title = $langs->trans(
'RecruitmentCandidatures');
238 $sql .= $object->getFieldList(
't');
240 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
241 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
242 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
246 $parameters = array();
247 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
248 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
249 $sql = preg_replace(
'/,\s*$/',
'', $sql);
250 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
251 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
252 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
255 $parameters = array();
256 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
257 $sql .= $hookmanager->resPrint;
258 if ($object->ismultientitymanaged == 1) {
259 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
261 $sql .=
" WHERE 1 = 1";
263 foreach ($search as $key => $val) {
264 if (array_key_exists($key, $object->fields)) {
265 if ($key ==
'status' && $search[$key] == -1) {
268 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
269 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
270 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
275 if ($search[$key] !=
'') {
276 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
279 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
280 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
281 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
282 if (preg_match(
'/_dtstart$/', $key)) {
283 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
285 if (preg_match(
'/_dtend$/', $key)) {
286 $sql .=
" AND t.".$db->escape($columnName).
" <= '" . $db->idate($search[$key]).
"'";
293 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
296 $sql .=
" AND t.fk_recruitmentjobposition = ".((int) $id);
300 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
302 $parameters = array();
303 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
304 $sql .= $hookmanager->resPrint;
325 $nbtotalofrecords =
'';
326 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
328 $sqlforcount = preg_replace(
'/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
329 $resql = $db->query($sqlforcount);
331 $objforcount = $db->fetch_object(
$resql);
332 $nbtotalofrecords = $objforcount->nbtotalofrecords;
337 if (($page * $limit) > $nbtotalofrecords) {
345 $sql .= $db->order($sortfield, $sortorder);
347 $sql .= $db->plimit($limit + 1, $offset);
350 $resql = $db->query($sql);
356 $num = $db->num_rows(
$resql);
360 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
361 $obj = $db->fetch_object(
$resql);
363 header(
"Location: ".DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_card.php?id='.$id);
376 if ($jobposition->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
377 $savobject = $object;
379 $object = $jobposition;
381 $res = $object->fetch_optionals();
384 print
dol_get_fiche_head($head,
'candidatures', $langs->trans(
"RecruitmentCandidatures"), -1, $object->picto);
389 if ($action ==
'delete') {
390 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteRecruitmentJobPosition'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
393 if ($action ==
'deleteline') {
394 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
397 if ($action ==
'clone') {
399 $formquestion = array();
400 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
404 if ($action ==
'xxx') {
405 $formquestion = array();
416 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
420 $parameters = array(
'formConfirm' =>
$formconfirm,
'lineid' => $lineid);
421 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
422 if (empty($reshook)) {
424 } elseif ($reshook > 0) {
434 $linkback =
'<a href="'.dol_buildpath(
'/recruitment/recruitmentjobposition_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
436 $morehtmlref =
'<div class="refidno">';
445 if (!empty($conf->project->enabled)) {
446 $langs->load(
"projects");
447 $morehtmlref .= $langs->trans(
'Project').
' ';
448 if ($permissiontoadd) {
449 if ($action !=
'classify') {
450 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a>';
452 $morehtmlref .=
' : ';
453 if ($action ==
'classify') {
455 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
456 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
457 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
458 $morehtmlref .= $formproject->select_projects(0, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
459 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
460 $morehtmlref .=
'</form>';
462 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
465 if (!empty($object->fk_project)) {
467 $proj->fetch($object->fk_project);
468 $morehtmlref .=
': '.$proj->getNomUrl();
474 $morehtmlref .=
'</div>';
477 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
480 print
'<div class="fichecenter">';
481 print
'<div class="fichehalfleft">';
482 print
'<div class="underbanner clearboth"></div>';
483 print
'<table class="border centpercent tableforfield">'.
"\n";
486 $keyforbreak =
'description';
487 unset($object->fields[
'fk_project']);
489 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
492 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
498 print
'<div class="clearboth"></div>';
504 $object = $savobject;
508 $arrayofselected = is_array($toselect) ? $toselect : array();
512 $param .=
'&id='.urlencode($id);
515 $param .=
'&mode='.urlencode($mode);
517 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
518 $param .=
'&contextpage='.urlencode($contextpage);
520 if ($limit > 0 && $limit != $conf->liste_limit) {
521 $param .=
'&limit='.urlencode($limit);
523 foreach ($search as $key => $val) {
524 if (is_array($search[$key]) && count($search[$key])) {
525 foreach ($search[$key] as $skey) {
527 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
530 } elseif ($search[$key] !=
'') {
531 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
534 if ($optioncss !=
'') {
535 $param .=
'&optioncss='.urlencode($optioncss);
538 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
540 $parameters = array();
541 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
542 $param .= $hookmanager->resPrint;
545 $arrayofmassactions = array(
546 'validate'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate"),
551 if (!empty($permissiontodelete)) {
552 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
554 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
555 $arrayofmassactions = array();
557 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
559 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
560 if ($optioncss !=
'') {
561 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
563 print
'<input type="hidden" name="token" value="'.newToken().
'">';
564 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
565 print
'<input type="hidden" name="action" value="list">';
566 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
567 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
568 print
'<input type="hidden" name="page" value="'.$page.
'">';
569 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
570 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
571 print
'<input type="hidden" name="id" value="'.$id.
'">';
575 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
576 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
578 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/recruitment/recruitmentcandidature_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.((
int) $id)),
'', $permissiontoadd);
580 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
583 $topicmail =
"SendRecruitmentCandidatureRef";
584 $modelmail =
"recruitmentcandidature";
586 $trackid =
'recruitmentapplication'.$object->id;
587 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
591 foreach ($fieldstosearchall as $key => $val) {
592 $fieldstosearchall[$key] = $langs->trans($val);
593 $setupstring .= $key.
"=".$val.
";";
595 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
596 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
604 $parameters = array();
605 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
606 if (empty($reshook)) {
607 $moreforfilter .= $hookmanager->resPrint;
609 $moreforfilter = $hookmanager->resPrint;
612 if (!empty($moreforfilter)) {
613 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
614 print $moreforfilter;
618 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
619 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
620 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
622 print
'<div class="div-table-responsive">';
623 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
628 print
'<tr class="liste_titre">';
630 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
631 print
'<td class="liste_titre maxwidthsearch">';
632 $searchpicto =
$form->showFilterButtons(
'left');
636 foreach ($object->fields as $key => $val) {
637 $searchkey = empty($search[$key]) ?
'' : $search[$key];
638 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
639 if ($key ==
'status') {
640 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
641 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
642 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
643 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
644 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
645 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
646 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
648 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
649 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
650 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
651 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
652 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
653 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
654 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
655 print
'<div class="nowrap">';
656 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
658 print
'<div class="nowrap">';
659 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
661 } elseif ($key ==
'lang') {
662 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
664 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
666 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
672 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
675 $parameters = array(
'arrayfields'=>$arrayfields);
676 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
677 print $hookmanager->resPrint;
679 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
680 print
'<td class="liste_titre maxwidthsearch">';
681 $searchpicto =
$form->showFilterButtons();
687 $totalarray = array();
688 $totalarray[
'nbfield'] = 0;
692 print
'<tr class="liste_titre">';
693 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
694 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
696 foreach ($object->fields as $key => $val) {
697 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
698 if ($key ==
'status') {
699 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
700 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
701 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
702 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
703 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
704 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
705 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
707 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
708 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
709 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
710 $totalarray[
'nbfield']++;
714 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
716 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
717 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
718 print $hookmanager->resPrint;
720 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
721 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
723 $totalarray[
'nbfield']++;
728 $needToFetchEachLine = 0;
729 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
730 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
731 if (preg_match(
'/\$object/', $val)) {
732 $needToFetchEachLine++;
741 $savnbfield = $totalarray[
'nbfield'];
742 $totalarray = array();
743 $totalarray[
'nbfield'] = 0;
744 $imaxinloop = ($limit ? min($num, $limit) : $num);
745 while ($i < $imaxinloop) {
746 $obj = $db->fetch_object(
$resql);
752 $object->setVarsFromFetchObj($obj);
754 if ($mode ==
'kanban') {
756 print
'<tr><td colspan="'.$savnbfield.
'">';
757 print
'<div class="box-flex-container">';
760 print $object->getKanbanView(
'');
761 if ($i == ($imaxinloop - 1)) {
768 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
770 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
771 print
'<td class="nowrap center">';
772 if ($massactionbutton || $massaction) {
774 if (in_array($object->id, $arrayofselected)) {
777 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
781 foreach ($object->fields as $key => $val) {
782 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
783 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
784 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
785 } elseif ($key ==
'status') {
786 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
789 if (in_array($val[
'type'], array(
'timestamp'))) {
790 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
791 } elseif ($key ==
'ref') {
792 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
795 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
796 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
800 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
801 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'');
802 if (preg_match(
'/tdoverflow/', $cssforfield)) {
803 print
' title="'.dol_escape_htmltag($object->$key).
'"';
806 if ($key ==
'status') {
807 print $object->getLibStatut(5);
808 } elseif ($key ==
'rowid') {
809 print $object->showOutputField($val, $key, $object->id,
'');
811 print $object->showOutputField($val, $key, $object->$key,
'');
815 $totalarray[
'nbfield']++;
817 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
819 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
821 if (!isset($totalarray[
'val'])) {
822 $totalarray[
'val'] = array();
824 if (!isset($totalarray[
'val'][
't.'.$key])) {
825 $totalarray[
'val'][
't.'.$key] = 0;
827 $totalarray[
'val'][
't.'.$key] += $object->$key;
832 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
834 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
835 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
836 print $hookmanager->resPrint;
838 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
839 print
'<td class="nowrap center">';
840 if ($massactionbutton || $massaction) {
842 if (in_array($object->id, $arrayofselected)) {
845 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
850 $totalarray[
'nbfield']++;
860 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
865 foreach ($arrayfields as $key => $val) {
866 if (!empty($val[
'checked'])) {
870 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
876 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
877 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
878 print $hookmanager->resPrint;
880 print
'</table>'.
"\n";
883 print
'</form>'.
"\n";
885 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
886 $hidegeneratedfilelistifempty = 1;
887 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
888 $hidegeneratedfilelistifempty = 0;
891 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
895 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
896 $urlsource .= str_replace(
'&',
'&', $param);
898 $filedir = $diroutputmassaction;
899 $genallowed = $permissiontoread;
900 $delallowed = $permissiontoadd;
902 print $formfile->showdocuments(
'massfilesarea_recruitment',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);