32require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
37require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
38require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
39require_once DOL_DOCUMENT_ROOT .
'/hrm/class/skillrank.class.php';
51$langs->loadLangs(array(
'hrm',
'other',
'products'));
56$action =
GETPOST(
'action',
'aZ09');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$cancel =
GETPOST(
'cancel',
'aZ09');
59$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobcard';
60$backtopage =
GETPOST(
'backtopage',
'alpha');
61$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
67$diroutputmassaction =
$conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
68$hookmanager->initHooks(array(
'jobcard',
'globalcard'));
71$extrafields->fetch_name_optionals_label(
$object->table_element);
73$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
76$search_all =
GETPOST(
"search_all",
'alpha');
78foreach (
$object->fields as $key => $val) {
79 if (
GETPOST(
'search_' . $key,
'alpha')) {
80 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
84if (empty($action) && empty($id) && empty($ref)) {
89include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
92$permissiontoread = $user->hasRight(
'hrm',
'all',
'read');
93$permissiontoadd = $user->hasRight(
'hrm',
'all',
'write');
94$permissiontodelete = $user->hasRight(
'hrm',
'all',
'delete');
95$upload_dir =
$conf->hrm->multidir_output[isset(
$object->entity) ?
$object->entity : 1] .
'/job';
102if (empty(
$conf->hrm->enabled)) {
105if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd)) {
114$parameters = array();
115$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
120if (empty($reshook)) {
125 if (empty($backtopage) || ($cancel && empty($id))) {
126 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
127 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
128 $backtopage = $backurlforlist;
135 $triggermodname =
'HRM_JOB_MODIFY';
139 if ($action !=
'confirm_clone') {
140 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
144 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
147 include DOL_DOCUMENT_ROOT .
'/core/actions_printing.inc.php';
153 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
155 if ($action ==
'set_thirdparty' && $permissiontoadd) {
156 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
158 if ($action ==
'classin' && $permissiontoadd) {
163 $triggersendname =
'HRM_JOB_SENTBYMAIL';
164 $autocopy =
'MAIN_MAIL_AUTOCOPY_JOB_TO';
165 $trackid =
'job' .
$object->id;
166 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
168 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
172 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->hasRight(
'salaries',
'write'))) {
178 $skillRequire =
$object->getSkillRankForJob($originalId);
183 if (
GETPOST(
'clone_label',
'alphanohtml')) {
188 if (
GETPOST(
'clone_skills_required')) {
189 $cloneSkillRequired =
GETPOST(
'clone_skills_required');
194 if (!empty($cloneSkillRequired)) {
196 while ($i < count($skillRequire)) {
198 $skillrank->createFromClone($user, $skillRequire[$i]->rowid, $id);
205 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
227$form =
new Form($db);
231$title = $langs->trans(
"Job");
252if ($action ==
'create') {
253 print
load_fiche_titre($langs->trans(
"NewJobProfile", $langs->transnoentities(
'Job')),
'',
'object_' .
$object->picto);
255 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
256 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
257 print
'<input type="hidden" name="action" value="add">';
259 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
261 if ($backtopageforcancel) {
262 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
267 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
270 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
273 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
275 print
'</table>' .
"\n";
279 print
'<div class="center">';
280 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
282 print
'<input type="' . ($backtopage ?
"submit" :
"button") .
'" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
"Cancel")) .
'"' . ($backtopage ?
'' :
' onclick="history.go(-1)"') .
'>';
291if (($id || $ref) && $action ==
'edit') {
294 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
295 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
296 print
'<input type="hidden" name="action" value="update">';
297 print
'<input type="hidden" name="id" value="' .
$object->id .
'">';
299 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
301 if ($backtopageforcancel) {
302 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
307 print
'<table class="border centpercent tableforfieldedit">' .
"\n";
310 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_edit.tpl.php';
313 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_edit.tpl.php';
319 print
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") .
'">';
320 print
' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
327if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
328 $res =
$object->fetch_optionals();
331 $picto =
'company.png';
337 if ($action ==
'delete') {
338 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'DeleteJob'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
341 if ($action ==
'deleteline') {
342 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&lineid=' . $lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
345 if ($action ==
'clone') {
347 $formquestion = array(
348 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.
$object->label),
349 array(
'type' =>
'checkbox',
'name' =>
'clone_skills_required',
'label' => $langs->trans(
"RequiredSkills"),
'value' =>
'',),
352 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk',
$object->label),
'confirm_clone', $formquestion,
'yes', 1, 280);
356 if ($action ==
'xxx') {
357 $formquestion = array();
368 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
372 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
373 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
374 if (empty($reshook)) {
375 $formconfirm .= $hookmanager->resPrint;
376 } elseif ($reshook > 0) {
377 $formconfirm = $hookmanager->resPrint;
386 $linkback =
'<a href="' .
dol_buildpath(
'/hrm/job_list.php', 1) .
'?restore_lastsearch_values=1' . (!empty($socid) ?
'&socid=' . $socid :
'') .
'">' . $langs->trans(
"BackToList") .
'</a>';
388 $morehtmlref =
'<div class="refid">';
389 $morehtmlref .=
$object->label;
390 $morehtmlref .=
'</div>';
393 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
396 print
'<div class="fichecenter">';
397 print
'<div class="fichehalfleft">';
398 print
'<div class="underbanner clearboth"></div>';
399 print
'<table class="border centpercent tableforfield">'.
"\n";
405 $object->fields[
'label'][
'visible'] = 0;
406 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
409 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
415 print
'<div class="clearboth"></div>';
424 if (!empty(
$object->table_element_line)) {
426 $result =
$object->getLinesArray();
428 print
' <form name="addproduct" id="addproduct" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id . (($action !=
'editline') ?
'' :
'#line_' .
GETPOSTINT(
'lineid')) .
'" method="POST">
429 <input type="hidden" name="token" value="' .
newToken() .
'">
430 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline') .
'">
431 <input type="hidden" name="mode" value="">
432 <input type="hidden" name="page_y" value="">
433 <input type="hidden" name="id" value="' .
$object->id .
'">
436 if (!empty(
$conf->use_javascript_ajax) &&
$object->status == 0) {
437 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
440 print
'<div class="div-table-responsive-no-min">';
441 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
442 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
450 if (
$object->status == 0 && $permissiontoadd && $action !=
'selectlines') {
451 if ($action !=
'editline') {
454 $parameters = array();
455 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
459 if (empty($reshook)) {
460 $object->formAddObjectLine(1, $mysoc, $soc);
465 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
476 if ($action !=
'presend' && $action !=
'editline') {
477 print
'<div class="tabsAction">' .
"\n";
478 $parameters = array();
479 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
484 if (empty($reshook)) {
486 if (
$object->status == $object::STATUS_VALIDATED) {
487 print
dolGetButtonAction($langs->trans(
'SetToDraft'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=confirm_setdraft&confirm=yes&token=' .
newToken(),
'', $permissiontoadd);
490 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=edit&token=' .
newToken(),
'', $permissiontoadd);
492 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=clone&token=' .
newToken(),
'', $permissiontoadd);
495 print
dolGetButtonAction($langs->trans(
'Delete'),
'',
'delete', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=delete&token=' .
newToken(),
'', $permissiontodelete);
497 print
'</div>' .
"\n";
502 if (
GETPOST(
'modelselected')) {
506 if ($action !=
'presend') {
507 print
'<div class="fichecenter"><div class="fichehalfleft">';
508 print
'<a name="builddoc"></a>';
510 $includedocgeneration = 0;
513 if ($includedocgeneration) {
515 $relativepath = $objref .
'/' . $objref .
'.pdf';
516 $filedir =
$conf->hrm->dir_output .
'/' .
$object->element .
'/' . $objref;
517 $urlsource = $_SERVER[
"PHP_SELF"] .
"?id=" .
$object->id;
518 $genallowed = $user->hasRight(
'hrm',
'job',
'read');
519 $delallowed = $user->hasRight(
'hrm',
'job',
'write');
520 print $formfile->showdocuments(
'hrm:Job',
$object->element .
'/' . $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
524 $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'job'), 1);
525 $linktoelem = $tmparray[
'linktoelem'];
526 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
527 print $htmltoenteralink;
529 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
531 print
'</div><div class="fichehalfright">';
535 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/job_agenda.php?id='.
$object->id);
538 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formactions.class.php';
540 $somethingshown = $formactions->showactions($object,
$object->element .
'@' .
$object->module, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
542 print
'</div></div>';
547 $defaulttopic =
'InformationMessage';
548 $diroutput =
$conf->hrm->dir_output;
549 $trackid =
'job' .
$object->id;
551 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.