47 if (!$res && !empty(
$_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) $res = @include
$_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
49 $tmp = empty(
$_SERVER[
'SCRIPT_FILENAME']) ?
'' :
$_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
50 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
51 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
52 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
54 if (!$res && file_exists(
"../main.inc.php")) $res = @include
"../main.inc.php";
55 if (!$res && file_exists(
"../../main.inc.php")) $res = @include
"../../main.inc.php";
56 if (!$res && file_exists(
"../../../main.inc.php")) $res = @include
"../../../main.inc.php";
57 if (!$res) die(
"Include of main fails");
59 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
60 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
64 dol_include_once(
'/recruitment/lib/recruitment_recruitmentjobposition.lib.php');
67 $langs->loadLangs(array(
"recruitment",
"other"));
72 $action =
GETPOST(
'action',
'aZ09');
73 $confirm =
GETPOST(
'confirm',
'alpha');
74 $cancel =
GETPOST(
'cancel',
'aZ09');
75 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'recruitmentjobpositioncard';
76 $backtopage =
GETPOST(
'backtopage',
'alpha');
77 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
83 $diroutputmassaction = $conf->recruitment->dir_output.
'/temp/massgeneration/'.$user->id;
84 $hookmanager->initHooks(array(
'recruitmentjobpositioncard',
'globalcard'));
87 $extrafields->fetch_name_optionals_label($object->table_element);
89 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
92 $search_all =
GETPOST(
"search_all",
'alpha');
94 foreach ($object->fields as $key => $val)
96 if (
GETPOST(
'search_'.$key,
'alpha')) $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
99 if (empty($action) && empty($id) && empty($ref)) $action =
'view';
102 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
105 $permissiontoread = $user->rights->recruitment->recruitmentjobposition->read;
106 $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write;
107 $permissiontodelete = $user->rights->recruitment->recruitmentjobposition->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
108 $permissionnote = $user->rights->recruitment->recruitmentjobposition->write;
109 $permissiondellink = $user->rights->recruitment->recruitmentjobposition->write;
110 $upload_dir = $conf->recruitment->multidir_output[isset($object->entity) ? $object->entity : 1];
125 $parameters = array();
126 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
127 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
133 $backurlforlist =
dol_buildpath(
'/recruitment/recruitmentjobposition_list.php', 1);
135 if (empty($backtopage) || ($cancel && empty($id))) {
136 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
137 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) $backtopage = $backurlforlist;
138 else $backtopage =
dol_buildpath(
'/recruitment/recruitmentjobposition_card.php', 1).
'?id='.($id > 0 ? $id :
'__ID__');
141 $triggermodname =
'RECRUITMENT_RECRUITMENTJOBPOSITION_MODIFY';
144 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
147 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
150 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
156 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
158 if ($action ==
'set_thirdparty' && $permissiontoadd)
160 $object->setValueFrom(
'fk_soc',
GETPOST(
'fk_soc',
'int'),
'',
'',
'date',
'', $user,
'RECRUITMENTJOBPOSITION_MODIFY');
162 if ($action ==
'classin' && $permissiontoadd)
164 $object->setProject(
GETPOST(
'projectid',
'int'));
168 $triggersendname =
'RECRUITMENTJOBPOSITION_SENTBYMAIL';
169 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECRUITMENTJOBPOSITION_TO';
170 $trackid =
'recruitmentjobposition'.$object->id;
171 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
183 $form =
new Form($db);
187 $title = $langs->trans(
"PositionToBeFilled");
192 if ($action ==
'create')
196 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
197 print '<input type="hidden" name="token" value="'.newToken().
'">';
198 print '<input type="hidden" name="action" value="add">';
199 if ($backtopage)
print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
200 if ($backtopageforcancel)
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
203 if (!
GETPOSTISSET(
'fk_user_recruiter')) $_POST[
'fk_user_recruiter'] = $user->id;
207 print '<table class="border centpercent tableforfieldcreate">'.
"\n";
210 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
213 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
215 print '</table>'.
"\n";
219 print '<div class="center">';
220 print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans(
"Create")).
'">';
222 print '<input type="'.($backtopage ?
"submit" :
"button").
'" class="button button-cancel" name="cancel" value="'.
dol_escape_htmltag($langs->trans(
"Cancel")).
'"'.($backtopage ?
'' :
' onclick="javascript:history.go(-1)"').
'>';
231 if (($id || $ref) && $action ==
'edit')
235 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
236 print '<input type="hidden" name="token" value="'.newToken().
'">';
237 print '<input type="hidden" name="action" value="update">';
238 print '<input type="hidden" name="id" value="'.$object->id.
'">';
239 if ($backtopage)
print '<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
240 if ($backtopageforcancel)
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
244 print '<table class="border centpercent tableforfieldedit">'.
"\n";
247 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
250 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
256 print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans(
"Save").
'">';
257 print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
264 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create')))
266 $res = $object->fetch_optionals();
274 if ($action ==
'delete')
276 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'DeleteRecruitmentJobPosition'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
279 if ($action ==
'deleteline')
281 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
284 if ($action ==
'clone') {
286 $formquestion = array();
287 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
291 if ($action ==
'xxx')
293 $formquestion = array();
304 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
308 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
309 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
310 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
311 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
319 $linkback = '<a href="'.
dol_buildpath('/recruitment/recruitmentjobposition_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
321 $morehtmlref = '<div class="refidno">';
330 if (!empty($conf->projet->enabled))
332 $langs->load(
"projects");
333 $morehtmlref .= $langs->trans(
'Project').
' ';
334 if ($permissiontoadd)
336 if ($action !=
'classify') $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a>';
337 $morehtmlref .=
' : ';
338 if ($action ==
'classify') {
340 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
341 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
342 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
343 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
344 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
345 $morehtmlref .=
'</form>';
347 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
350 if (!empty($object->fk_project)) {
352 $proj->fetch($object->fk_project);
353 $morehtmlref .=
': '.$proj->getNomUrl();
359 $morehtmlref .=
'</div>';
362 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
365 print '<div class="fichecenter">';
366 print '<div class="fichehalfleft">';
367 print '<div class="underbanner clearboth"></div>';
368 print '<table class="border centpercent tableforfield">'.
"\n";
371 $keyforbreak =
'description';
372 unset($object->fields[
'fk_project']);
374 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
377 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
383 print '<div class="clearboth"></div>';
392 if (!empty($object->table_element_line))
395 $result = $object->getLinesArray();
397 print ' <form name="addproduct" id="addproduct" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.(($action !=
'editline') ?
'#addline' :
'#line_'.
GETPOST(
'lineid',
'int')).
'" method="POST">
398 <input type="hidden" name="token" value="' .
newToken().
'">
399 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline').
'">
400 <input type="hidden" name="mode" value="">
401 <input type="hidden" name="id" value="' . $object->id.
'">
404 if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
405 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
408 print '<div class="div-table-responsive-no-min">';
409 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline'))
411 print '<table id="tablelines" class="noborder noshadow" width="100%">';
414 if (!empty($object->lines))
416 $object->printObjectLines($action, $mysoc, null,
GETPOST(
'lineid',
'int'), 1);
420 if ($object->status == 0 && $permissiontoadd && $action !=
'selectlines')
422 if ($action !=
'editline')
425 $object->formAddObjectLine(1, $mysoc, $soc);
427 $parameters = array();
428 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
432 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline'))
441 print '<br>'.$langs->trans(
"FeatureNotYetAvailable");
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
recruitmentjobpositionPrepareHead($object)
Prepare array of tabs for RecruitmentJobPosition.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
Class for RecruitmentJobPosition.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...