27require_once
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment_recruitmentjobposition.lib.php';
44$langs->loadLangs(array(
"recruitment",
"other"));
49$action =
GETPOST(
'action',
'aZ09');
50$confirm =
GETPOST(
'confirm',
'alpha');
51$cancel =
GETPOST(
'cancel',
'aZ09');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'recruitmentjobpositioncard';
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
60$diroutputmassaction =
$conf->recruitment->dir_output.
'/temp/massgeneration/'.$user->id;
61$hookmanager->initHooks(array(
'recruitmentjobpositioncard',
'globalcard'));
64$extrafields->fetch_name_optionals_label(
$object->table_element);
66$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
69$search_all =
GETPOST(
"search_all",
'alpha');
71foreach (
$object->fields as $key => $val) {
72 if (
GETPOST(
'search_'.$key,
'alpha')) {
73 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
77if (empty($action) && empty($id) && empty($ref)) {
82include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
85$permissiontoread = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read');
86$permissiontoadd = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
87$permissiontodelete = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
88$permissionnote = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
89$permissiondellink = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
90$upload_dir =
$conf->recruitment->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
92$usercanclose = $permissiontoadd;
97$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
98$result =
restrictedArea($user,
'recruitment',
$object->id,
'recruitment_recruitmentjobposition',
'recruitmentjobposition',
'',
'rowid', $isdraft);
105$parameters = array();
106$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
111if (empty($reshook)) {
114 $backurlforlist =
dol_buildpath(
'/recruitment/recruitmentjobposition_list.php', 1);
116 if (empty($backtopage) || ($cancel && empty($id))) {
117 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
118 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
119 $backtopage = $backurlforlist;
121 $backtopage =
dol_buildpath(
'/recruitment/recruitmentjobposition_card.php', 1).
'?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
125 $triggermodname =
'RECRUITMENT_RECRUITMENTJOBPOSITION_MODIFY';
128 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
131 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
134 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
140 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
142 if ($action ==
'set_thirdparty' && $permissiontoadd) {
143 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
145 if ($action ==
'classin' && $permissiontoadd) {
148 if ($action ==
'confirm_closeas' && $usercanclose && !
GETPOST(
'cancel',
'alpha')) {
150 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CloseAs")),
null,
'errors');
154 if (
$object->status == $object::STATUS_VALIDATED) {
173 $triggersendname =
'RECRUITMENTJOBPOSITION_SENTBYMAIL';
174 $autocopy =
'MAIN_MAIL_AUTOCOPY_RECRUITMENTJOBPOSITION_TO';
175 $trackid =
'recruitmentjobposition'.$object->id;
176 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
186$form =
new Form($db);
190$title =
$object->ref.
" - ".$langs->trans(
'Card');
195if ($action ==
'create') {
196 print
load_fiche_titre($langs->trans(
"NewPositionToBeFilled"),
'',
'object_'.$object->picto);
198 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
199 print
'<input type="hidden" name="token" value="'.newToken().
'">';
200 print
'<input type="hidden" name="action" value="add">';
202 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
204 if ($backtopageforcancel) {
205 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
209 if (!GETPOSTISSET(
'fk_user_recruiter')) {
210 $_POST[
'fk_user_recruiter'] = $user->id;
215 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
218 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
221 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
223 print
'</table>'.
"\n";
227 print $form->buttonsSaveCancel(
"Create");
235if (($id || $ref) && $action ==
'edit') {
236 print
load_fiche_titre($langs->trans(
"PositionToBeFilled"),
'',
'object_'.$object->picto);
238 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
239 print
'<input type="hidden" name="token" value="'.newToken().
'">';
240 print
'<input type="hidden" name="action" value="update">';
241 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
243 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
245 if ($backtopageforcancel) {
246 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
251 print
'<table class="border centpercent tableforfieldedit">'.
"\n";
254 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_edit.tpl.php';
257 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_edit.tpl.php';
263 print $form->buttonsSaveCancel();
269if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
276 if ($action ==
'delete') {
277 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'DeleteRecruitmentJobPosition'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
280 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);
289 if ($action ==
'closeas') {
292 $formquestion = array(
293 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))),
294 array(
'type' =>
'text',
'name' =>
'note_private',
'label' => $langs->trans(
"Note"),
'value' =>
'')
306 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'Close'), $text,
'confirm_closeas', $formquestion,
'', 1, 250);
310 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
311 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
312 if (empty($reshook)) {
313 $formconfirm .= $hookmanager->resPrint;
314 } elseif ($reshook > 0) {
315 $formconfirm = $hookmanager->resPrint;
324 $linkback =
'<a href="'.dol_buildpath(
'/recruitment/recruitmentjobposition_list.php', 1).
'?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
326 $morehtmlref =
'<div class="refidno">';
335 if (isModEnabled(
'project')) {
336 $langs->load(
"projects");
337 $morehtmlref .= $langs->trans(
'Project').
' ';
338 if ($permissiontoadd) {
339 if ($action !=
'classify') {
340 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a>';
342 $morehtmlref .=
' : ';
343 if ($action ==
'classify') {
345 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
346 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
347 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
348 $morehtmlref .= $formproject->select_projects(
$object->socid,
$object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
349 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
350 $morehtmlref .=
'</form>';
352 $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');
355 if (!empty(
$object->fk_project)) {
357 $proj->fetch(
$object->fk_project);
358 $morehtmlref .=
': '.$proj->getNomUrl();
364 $morehtmlref .=
'</div>';
367 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
370 print
'<div class="fichecenter">';
371 print
'<div class="fichehalfleft">';
372 print
'<div class="underbanner clearboth"></div>';
373 print
'<table class="border centpercent tableforfield">'.
"\n";
376 $keyforbreak =
'description';
377 unset(
$object->fields[
'fk_project']);
379 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_view.tpl.php';
382 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
388 print
'<div class="clearboth"></div>';
395 if ($action !=
'presend' && $action !=
'editline') {
396 print
'<div class="tabsAction">'.
"\n";
397 $parameters = array();
398 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
403 if (empty($reshook)) {
405 if (empty($user->socid)) {
406 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=presend&mode=init&token='.
newToken().
'#formmailbeforetitle');
410 if (
$object->status == $object::STATUS_VALIDATED ||
$object->status == $object::STATUS_RECRUITED) {
411 if ($permissiontoadd) {
412 print
dolGetButtonAction(
'', $langs->trans(
'SetToDraft'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_setdraft&confirm=yes&token='.
newToken(),
'', $permissiontoadd);
417 print
dolGetButtonAction(
'', $langs->trans(
'Modify'),
'default', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'', $permissiontoadd);
420 if (
$object->status == $object::STATUS_DRAFT) {
421 if ($permissiontoadd) {
423 print
dolGetButtonAction(
'', $langs->trans(
'Validate'),
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=confirm_validate&confirm=yes&token='.
newToken(),
'', $permissiontoadd);
425 $langs->load(
"errors");
426 print
dolGetButtonAction($langs->trans(
"ErrorAddAtLeastOneLineFirst"), $langs->trans(
"Validate"),
'default',
'#',
'', 0);
432 if (
$object->status == $object::STATUS_VALIDATED) {
434 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=closeas&token='.
newToken().(!
getDolGlobalString(
'MAIN_JUMP_TAG') ?
'' :
'#close').
'"';
435 print
'>'.$langs->trans(
'Close').
'</a>';
437 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotEnoughPermissions")).
'">'.$langs->trans(
'Close').
'</a>';
442 if ($permissiontoadd) {
443 print
dolGetButtonAction($langs->trans(
"ToClone"),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.(!empty(
$object->socid) ?
'&socid='.$object->socid :
"").
'&action=clone&object=recruitmentjobposition',
'clone', $permissiontoadd);
455 if ($permissiontoadd) {
456 if (
$object->status == $object::STATUS_CANCELED) {
457 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=confirm_reopen&confirm=yes&token='.
newToken().
'">'.$langs->trans(
"Re-Open").
'</a>'.
"\n";
463 print
dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken(),
'delete', $permissiontodelete, $params);
470 if (
GETPOST(
'modelselected')) {
474 if ($action !=
'presend') {
475 print
'<div class="fichecenter"><div class="fichehalfleft">';
476 print
'<a name="builddoc"></a>';
478 $includedocgeneration = 1;
481 if ($includedocgeneration) {
483 $relativepath = $objref.
'/'.$objref.
'.pdf';
484 $filedir =
$conf->recruitment->dir_output.
'/'.
$object->element.
'/'.$objref;
485 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
486 $genallowed = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read');
487 $delallowed = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'write');
488 print $formfile->showdocuments(
'recruitment:RecruitmentJobPosition',
$object->element.
'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
492 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'recruitmentjobposition'), 1);
493 $linktoelem = $tmparray[
'linktoelem'];
494 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
495 print $htmltoenteralink;
497 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
501 print
'<br><!-- Link to go on public job page -->'.
"\n";
503 $langs->loadLangs(array(
'recruitment'));
505 $out =
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
"PublicUrl").
'</span><br>';
508 $out .=
'<div class="urllink"><input type="text" id="recruitmentjobpositionurl" class="quatrevingtpercent" value="'.$url.
'">';
509 $out .=
'<a href="'.$url.
'" target="_blank" rel="noopener noreferrer">'.
img_picto(
'',
'globe').
'</a></div>';
515 print
'</div><div class="fichehalfright">';
519 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/recruitment/recruitmentjobposition_agenda.php?id='.
$object->id);
522 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
524 $somethingshown = $formactions->showactions($object,
$object->element.
'@recruitment', (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
526 print
'</div></div>';
530 if (
GETPOST(
'modelselected')) {
535 $modelmail =
'recruitmentjobposition';
536 $defaulttopic =
'InformationMessage';
537 $diroutput =
$conf->recruitment->dir_output;
538 $trackid =
'recruitmentjobposition'.$object->id;
540 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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 a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.