31require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
34require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
37require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
38require_once DOL_DOCUMENT_ROOT .
'/hrm/class/skillrank.class.php';
41$langs->loadLangs(array(
'hrm',
'other',
'products'));
46$action =
GETPOST(
'action',
'aZ09');
47$confirm =
GETPOST(
'confirm',
'alpha');
48$cancel =
GETPOST(
'cancel',
'aZ09');
49$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobcard';
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
57$diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
58$hookmanager->initHooks(array(
'jobcard',
'globalcard'));
61$extrafields->fetch_name_optionals_label(
$object->table_element);
63$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
66$search_all =
GETPOST(
"search_all",
'alpha');
68foreach (
$object->fields as $key => $val) {
69 if (
GETPOST(
'search_' . $key,
'alpha')) {
70 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
74if (empty($action) && empty($id) && empty($ref)) {
79include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
82$permissiontoread = $user->hasRight(
'hrm',
'all',
'read');
83$permissiontoadd = $user->hasRight(
'hrm',
'all',
'write');
84$permissiontodelete = $user->hasRight(
'hrm',
'all',
'delete');
85$upload_dir = $conf->hrm->multidir_output[isset(
$object->entity) ?
$object->entity : 1] .
'/job';
92if (empty($conf->hrm->enabled)) {
95if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd)) {
104$parameters = array();
105$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110if (empty($reshook)) {
115 if (empty($backtopage) || ($cancel && empty($id))) {
116 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
117 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
118 $backtopage = $backurlforlist;
125 $triggermodname =
'HRM_JOB_MODIFY';
129 if ($action !=
'confirm_clone') {
130 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
134 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
137 include DOL_DOCUMENT_ROOT .
'/core/actions_printing.inc.php';
143 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
145 if ($action ==
'set_thirdparty' && $permissiontoadd) {
146 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
148 if ($action ==
'classin' && $permissiontoadd) {
153 $triggersendname =
'HRM_JOB_SENTBYMAIL';
154 $autocopy =
'MAIN_MAIL_AUTOCOPY_JOB_TO';
155 $trackid =
'job' .
$object->id;
156 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
158 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
162 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->hasRight(
'salaries',
'write'))) {
168 $skillRequire =
$object->getSkillRankForJob($originalId);
173 if (
GETPOST(
'clone_label',
'alphanohtml')) {
178 if (
GETPOST(
'clone_skills_required')) {
179 $cloneSkillRequired =
GETPOST(
'clone_skills_required');
184 if (!empty($cloneSkillRequired)) {
186 while ($i < count($skillRequire)) {
188 $skillrank->createFromClone($user, $skillRequire[$i]->rowid, $id);
195 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
217$form =
new Form($db);
221$title = $langs->trans(
"Job");
242if ($action ==
'create') {
243 print
load_fiche_titre($langs->trans(
"NewJobProfile", $langs->transnoentities(
'Job')),
'',
'object_' .
$object->picto);
245 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
246 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
247 print
'<input type="hidden" name="action" value="add">';
249 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
251 if ($backtopageforcancel) {
252 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
257 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
260 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
263 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
265 print
'</table>' .
"\n";
269 print
'<div class="center">';
270 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
272 print
'<input type="' . ($backtopage ?
"submit" :
"button") .
'" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
"Cancel")) .
'"' . ($backtopage ?
'' :
' onclick="history.go(-1)"') .
'>';
281if (($id || $ref) && $action ==
'edit') {
284 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
285 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
286 print
'<input type="hidden" name="action" value="update">';
287 print
'<input type="hidden" name="id" value="' .
$object->id .
'">';
289 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
291 if ($backtopageforcancel) {
292 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
297 print
'<table class="border centpercent tableforfieldedit">' .
"\n";
300 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_edit.tpl.php';
303 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_edit.tpl.php';
309 print
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") .
'">';
310 print
' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
317if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
318 $res =
$object->fetch_optionals();
321 $picto =
'company.png';
327 if ($action ==
'delete') {
328 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'DeleteJob'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
331 if ($action ==
'deleteline') {
332 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&lineid=' . $lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
335 if ($action ==
'clone') {
337 $formquestion = array(
338 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.
$object->label),
339 array(
'type' =>
'checkbox',
'name' =>
'clone_skills_required',
'label' => $langs->trans(
"RequiredSkills"),
'value' =>
'',),
342 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk',
$object->label),
'confirm_clone', $formquestion,
'yes', 1, 280);
346 if ($action ==
'xxx') {
347 $formquestion = array();
358 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
362 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
363 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
364 if (empty($reshook)) {
365 $formconfirm .= $hookmanager->resPrint;
366 } elseif ($reshook > 0) {
367 $formconfirm = $hookmanager->resPrint;
376 $linkback =
'<a href="' .
dol_buildpath(
'/hrm/job_list.php', 1) .
'?restore_lastsearch_values=1' . (!empty($socid) ?
'&socid=' . $socid :
'') .
'">' . $langs->trans(
"BackToList") .
'</a>';
378 $morehtmlref =
'<div class="refid">';
379 $morehtmlref .=
$object->label;
380 $morehtmlref .=
'</div>';
383 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
386 print
'<div class="fichecenter">';
387 print
'<div class="fichehalfleft">';
388 print
'<div class="underbanner clearboth"></div>';
389 print
'<table class="border centpercent tableforfield">'.
"\n";
395 $object->fields[
'label'][
'visible'] = 0;
396 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
399 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
405 print
'<div class="clearboth"></div>';
414 if (!empty(
$object->table_element_line)) {
416 $result =
$object->getLinesArray();
418 print
' <form name="addproduct" id="addproduct" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id . (($action !=
'editline') ?
'' :
'#line_' .
GETPOSTINT(
'lineid')) .
'" method="POST">
419 <input type="hidden" name="token" value="' .
newToken() .
'">
420 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline') .
'">
421 <input type="hidden" name="mode" value="">
422 <input type="hidden" name="page_y" value="">
423 <input type="hidden" name="id" value="' .
$object->id .
'">
426 if (!empty($conf->use_javascript_ajax) &&
$object->status == 0) {
427 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
430 print
'<div class="div-table-responsive-no-min">';
431 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
432 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
440 if (
$object->status == 0 && $permissiontoadd && $action !=
'selectlines') {
441 if ($action !=
'editline') {
444 $parameters = array();
445 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
449 if (empty($reshook)) {
450 $object->formAddObjectLine(1, $mysoc, $soc);
455 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
466 if ($action !=
'presend' && $action !=
'editline') {
467 print
'<div class="tabsAction">' .
"\n";
468 $parameters = array();
469 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
474 if (empty($reshook)) {
476 if (
$object->status == $object::STATUS_VALIDATED) {
477 print
dolGetButtonAction($langs->trans(
'SetToDraft'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=confirm_setdraft&confirm=yes&token=' .
newToken(),
'', $permissiontoadd);
480 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=edit&token=' .
newToken(),
'', $permissiontoadd);
482 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=clone&token=' .
newToken(),
'', $permissiontoadd);
485 print
dolGetButtonAction($langs->trans(
'Delete'),
'',
'delete', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=delete&token=' .
newToken(),
'', $permissiontodelete);
487 print
'</div>' .
"\n";
492 if (
GETPOST(
'modelselected')) {
496 if ($action !=
'presend') {
497 print
'<div class="fichecenter"><div class="fichehalfleft">';
498 print
'<a name="builddoc"></a>';
500 $includedocgeneration = 0;
503 if ($includedocgeneration) {
505 $relativepath = $objref .
'/' . $objref .
'.pdf';
506 $filedir = $conf->hrm->dir_output .
'/' .
$object->element .
'/' . $objref;
507 $urlsource = $_SERVER[
"PHP_SELF"] .
"?id=" .
$object->id;
508 $genallowed = $user->hasRight(
'hrm',
'job',
'read');
509 $delallowed = $user->hasRight(
'hrm',
'job',
'write');
510 print $formfile->showdocuments(
'hrm:Job',
$object->element .
'/' . $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
514 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'job'), 1);
515 $linktoelem = $tmparray[
'linktoelem'];
516 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
517 print $htmltoenteralink;
519 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
521 print
'</div><div class="fichehalfright">';
525 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/job_agenda.php?id='.
$object->id);
528 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formactions.class.php';
530 $somethingshown = $formactions->showactions($object,
$object->element .
'@' .
$object->module, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
532 print
'</div></div>';
537 $defaulttopic =
'InformationMessage';
538 $diroutput = $conf->hrm->dir_output;
539 $trackid =
'job' .
$object->id;
541 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.
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.
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.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.