25require_once
'../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment_recruitmentjobposition.lib.php';
34$langs->loadLangs(array(
"recruitment",
"other"));
39$action =
GETPOST(
'action',
'aZ09');
40$confirm =
GETPOST(
'confirm',
'alpha');
41$cancel =
GETPOST(
'cancel',
'aZ09');
42$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'recruitmentjobpositioncard';
43$backtopage =
GETPOST(
'backtopage',
'alpha');
44$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
50$diroutputmassaction = $conf->recruitment->dir_output.
'/temp/massgeneration/'.$user->id;
51$hookmanager->initHooks(array(
'recruitmentjobpositioncard',
'globalcard'));
54$extrafields->fetch_name_optionals_label(
$object->table_element);
56$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
59$search_all =
GETPOST(
"search_all",
'alpha');
61foreach (
$object->fields as $key => $val) {
62 if (
GETPOST(
'search_'.$key,
'alpha')) {
63 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
67if (empty($action) && empty($id) && empty($ref)) {
72include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
75$permissiontoread = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read');
76$permissiontoadd = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
77$permissiontodelete = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
78$permissionnote = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
79$permissiondellink = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
80$upload_dir = $conf->recruitment->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
82$usercanclose = $permissiontoadd;
87$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
88$result =
restrictedArea($user,
'recruitment',
$object->id,
'recruitment_recruitmentjobposition',
'recruitmentjobposition',
'',
'rowid', $isdraft);
96$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
101if (empty($reshook)) {
104 $backurlforlist =
dol_buildpath(
'/recruitment/recruitmentjobposition_list.php', 1);
106 if (empty($backtopage) || ($cancel && empty($id))) {
107 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
108 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
109 $backtopage = $backurlforlist;
111 $backtopage =
dol_buildpath(
'/recruitment/recruitmentjobposition_card.php', 1).
'?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
115 $triggermodname =
'RECRUITMENT_RECRUITMENTJOBPOSITION_MODIFY';
118 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
121 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
124 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
130 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
132 if ($action ==
'set_thirdparty' && $permissiontoadd) {
133 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
'',
'date',
'', $user, $triggermodname);
135 if ($action ==
'classin' && $permissiontoadd) {
138 if ($action ==
'confirm_closeas' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
140 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CloseAs")),
null,
'errors');
144 if (
$object->status == $object::STATUS_VALIDATED) {
163 $triggersendname =
'RECRUITMENTJOBPOSITION_SENTBYMAIL';
164 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECRUITMENTJOBPOSITION_TO';
165 $trackid =
'recruitmentjobposition'.$object->id;
166 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
176$form =
new Form($db);
180$title =
$object->ref.
" - ".$langs->trans(
'Card');
185if ($action ==
'create') {
186 print
load_fiche_titre($langs->trans(
"NewPositionToBeFilled"),
'',
'object_'.$object->picto);
188 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
189 print
'<input type="hidden" name="token" value="'.newToken().
'">';
190 print
'<input type="hidden" name="action" value="add">';
192 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
194 if ($backtopageforcancel) {
195 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
199 if (!GETPOSTISSET(
'fk_user_recruiter')) {
200 $_POST[
'fk_user_recruiter'] = $user->id;
205 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
208 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
211 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
213 print
'</table>'.
"\n";
217 print $form->buttonsSaveCancel(
"Create");
225if (($id || $ref) && $action ==
'edit') {
226 print
load_fiche_titre($langs->trans(
"PositionToBeFilled"),
'',
'object_'.$object->picto);
228 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
229 print
'<input type="hidden" name="token" value="'.newToken().
'">';
230 print
'<input type="hidden" name="action" value="update">';
231 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
233 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
235 if ($backtopageforcancel) {
236 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
241 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
244 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
247 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
253 print $form->buttonsSaveCancel();
259if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
266 if ($action ==
'delete') {
267 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteRecruitmentJobPosition'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
270 if ($action ==
'deleteline') {
271 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&lineid='.$lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
274 if ($action ==
'clone') {
276 $formquestion = array();
277 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1);
279 if ($action ==
'closeas') {
282 $formquestion = array(
283 array(
'type' =>
'select',
'name' =>
'status',
'label' =>
'<span class="fieldrequired">'.$langs->trans(
"CloseAs").
'</span>',
'values' => array(3=>
$object->LibStatut($object::STATUS_RECRUITED), 9=>
$object->LibStatut($object::STATUS_CANCELED))),
284 array(
'type' =>
'text',
'name' =>
'note_private',
'label' => $langs->trans(
"Note"),
'value' =>
'')
296 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Close'), $text,
'confirm_closeas', $formquestion,
'', 1, 250);
300 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
301 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
302 if (empty($reshook)) {
303 $formconfirm .= $hookmanager->resPrint;
304 } elseif ($reshook > 0) {
305 $formconfirm = $hookmanager->resPrint;
314 $linkback =
'<a href="'.dol_buildpath(
'/recruitment/recruitmentjobposition_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
316 $morehtmlref =
'<div class="refidno">';
325 if (isModEnabled(
'project')) {
326 $langs->load(
"projects");
327 $morehtmlref .= $langs->trans(
'Project').
' ';
328 if ($permissiontoadd) {
329 if ($action !=
'classify') {
330 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a>';
332 $morehtmlref .=
' : ';
333 if ($action ==
'classify') {
335 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
336 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
337 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
338 $morehtmlref .= $formproject->select_projects(
$object->socid,
$object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
339 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
340 $morehtmlref .=
'</form>';
342 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, !empty(
$object->socid) ?
$object->socid : 0,
$object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
345 if (!empty(
$object->fk_project)) {
347 $proj->fetch(
$object->fk_project);
348 $morehtmlref .=
': '.$proj->getNomUrl();
354 $morehtmlref .=
'</div>';
357 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
360 print
'<div class="fichecenter">';
361 print
'<div class="fichehalfleft">';
362 print
'<div class="underbanner clearboth"></div>';
363 print
'<table class="border centpercent tableforfield">'.
"\n";
366 $keyforbreak =
'description';
367 unset(
$object->fields[
'fk_project']);
369 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
372 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
378 print
'<div class="clearboth"></div>';
385 if ($action !=
'presend' && $action !=
'editline') {
386 print
'<div class="tabsAction">'.
"\n";
387 $parameters = array();
388 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
393 if (empty($reshook)) {
395 if (empty($user->socid)) {
396 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=presend&mode=init&token='.
newToken().
'#formmailbeforetitle');
400 if (
$object->status == $object::STATUS_VALIDATED ||
$object->status == $object::STATUS_RECRUITED) {
401 if ($permissiontoadd) {
402 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_setdraft&confirm=yes&token='.
newToken(),
'', $permissiontoadd);
407 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
410 if (
$object->status == $object::STATUS_DRAFT) {
411 if ($permissiontoadd) {
413 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_validate&confirm=yes&token='.
newToken(),
'', $permissiontoadd);
415 $langs->load(
"errors");
416 print
dolGetButtonAction($langs->trans(
"ErrorAddAtLeastOneLineFirst"), $langs->trans(
"Validate"),
'default',
'#',
'', 0);
422 if (
$object->status == $object::STATUS_VALIDATED) {
424 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=closeas&token='.
newToken().(!
getDolGlobalString(
'MAIN_JUMP_TAG') ?
'' :
'#close').
'"';
425 print
'>'.$langs->trans(
'Close').
'</a>';
427 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Close').
'</a>';
432 if ($permissiontoadd) {
433 print
dolGetButtonAction($langs->trans(
"ToClone"),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.(!empty(
$object->socid) ?
'&socid='.$object->socid :
"").
'&action=clone&object=recruitmentjobposition',
'clone', $permissiontoadd);
445 if ($permissiontoadd) {
446 if (
$object->status == $object::STATUS_CANCELED) {
447 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_reopen&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"Re-Open").
'</a>'.
"\n";
453 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete, $params);
460 if (
GETPOST(
'modelselected')) {
464 if ($action !=
'presend') {
465 print
'<div class="fichecenter"><div class="fichehalfleft">';
466 print
'<a name="builddoc"></a>';
468 $includedocgeneration = 1;
471 if ($includedocgeneration) {
473 $relativepath = $objref.
'/'.$objref.
'.pdf';
474 $filedir = $conf->recruitment->dir_output.
'/'.
$object->element.
'/'.$objref;
475 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
476 $genallowed = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read');
477 $delallowed = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
478 print $formfile->showdocuments(
'recruitment:RecruitmentJobPosition',
$object->element.
'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
482 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'recruitmentjobposition'));
483 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
487 print
'<br><!-- Link to go on public job page -->'.
"\n";
489 $langs->loadLangs(array(
'recruitment'));
491 $out =
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"PublicUrl").
'</span><br>';
494 $out .=
'<div class="urllink"><input type="text" id="recruitmentjobpositionurl" class="quatrevingtpercent" value="'.$url.
'">';
495 $out .=
'<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe').
'</a></div>';
501 print
'</div><div class="fichehalfright">';
505 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/recruitment/recruitmentjobposition_agenda.php?id='.
$object->id);
508 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
510 $somethingshown = $formactions->showactions($object,
$object->element.
'@recruitment', (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
512 print
'</div></div>';
516 if (
GETPOST(
'modelselected')) {
521 $modelmail =
'recruitmentjobposition';
522 $defaulttopic =
'InformationMessage';
523 $diroutput = $conf->recruitment->dir_output;
524 $trackid =
'recruitmentjobposition'.$object->id;
526 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
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()
Empty header.
Class to manage projects.
Class for RecruitmentJobPosition.
const STATUS_DRAFT
Draft status.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
getPublicJobPositionUrl($mode, $ref='', $localorexternal=0)
Return string with full Url.
recruitmentjobpositionPrepareHead($object)
Prepare array of tabs for RecruitmentJobPosition.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.