30require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
33require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
34require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_job.lib.php';
37require_once DOL_DOCUMENT_ROOT .
'/hrm/class/skillrank.class.php';
40$langs->loadLangs(array(
'hrm',
'other',
'products'));
45$action =
GETPOST(
'action',
'aZ09');
46$confirm =
GETPOST(
'confirm',
'alpha');
47$cancel =
GETPOST(
'cancel',
'aZ09');
48$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobcard';
49$backtopage =
GETPOST(
'backtopage',
'alpha');
50$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
56$diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
57$hookmanager->initHooks(array(
'jobcard',
'globalcard'));
60$extrafields->fetch_name_optionals_label(
$object->table_element);
62$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
65$search_all =
GETPOST(
"search_all",
'alpha');
67foreach (
$object->fields as $key => $val) {
68 if (
GETPOST(
'search_' . $key,
'alpha')) {
69 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
73if (empty($action) && empty($id) && empty($ref)) {
78include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
81$permissiontoread = $user->hasRight(
'hrm',
'all',
'read');
82$permissiontoadd = $user->hasRight(
'hrm',
'all',
'write');
83$permissiontodelete = $user->hasRight(
'hrm',
'all',
'delete');
84$upload_dir = $conf->hrm->multidir_output[isset(
$object->entity) ?
$object->entity : 1] .
'/job';
91if (empty($conf->hrm->enabled)) {
94if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd)) {
103$parameters = array();
104$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
109if (empty($reshook)) {
114 if (empty($backtopage) || ($cancel && empty($id))) {
115 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
116 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
117 $backtopage = $backurlforlist;
119 $backtopage =
dol_buildpath(
'/hrm/job_card.php', 1) .
'?id=' . ($id > 0 ? $id :
'__ID__');
124 $triggermodname =
'HRM_JOB_MODIFY';
128 if ($action !=
'confirm_clone') {
129 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
133 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
136 include DOL_DOCUMENT_ROOT .
'/core/actions_printing.inc.php';
142 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
144 if ($action ==
'set_thirdparty' && $permissiontoadd) {
145 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
'',
'date',
'', $user, $triggermodname);
147 if ($action ==
'classin' && $permissiontoadd) {
152 $triggersendname =
'HRM_JOB_SENTBYMAIL';
153 $autocopy =
'MAIN_MAIL_AUTOCOPY_JOB_TO';
154 $trackid =
'job' .
$object->id;
155 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
157 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
161 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->hasRight(
'salaries',
'write'))) {
167 $skillRequire =
$object->getSkillRankForJob($originalId);
172 if (
GETPOST(
'clone_label',
'alphanohtml')) {
177 if (
GETPOST(
'clone_skills_required')) {
178 $cloneSkillRequired =
GETPOST(
'clone_skills_required');
183 if (!empty($cloneSkillRequired)) {
185 while ($i < count($skillRequire)) {
187 $skillrank->createFromClone($user, $skillRequire[$i]->
rowid, $id);
194 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
216$form =
new Form($db);
220$title = $langs->trans(
"Job");
241if ($action ==
'create') {
242 print
load_fiche_titre($langs->trans(
"NewJobProfile", $langs->transnoentities(
'Job')),
'',
'object_' .
$object->picto);
244 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
245 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
246 print
'<input type="hidden" name="action" value="add">';
248 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
250 if ($backtopageforcancel) {
251 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
256 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
259 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
262 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
264 print
'</table>' .
"\n";
268 print
'<div class="center">';
269 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
271 print
'<input type="' . ($backtopage ?
"submit" :
"button") .
'" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
"Cancel")) .
'"' . ($backtopage ?
'' :
' onclick="history.go(-1)"') .
'>';
280if (($id || $ref) && $action ==
'edit') {
283 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
284 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
285 print
'<input type="hidden" name="action" value="update">';
286 print
'<input type="hidden" name="id" value="' .
$object->id .
'">';
288 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
290 if ($backtopageforcancel) {
291 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
296 print
'<table class="border centpercent tableforfieldedit">' .
"\n";
299 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_edit.tpl.php';
302 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_edit.tpl.php';
308 print
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") .
'">';
309 print
' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
316if (
$object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
317 $res =
$object->fetch_optionals();
320 $picto =
'company.png';
326 if ($action ==
'delete') {
327 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'DeleteJob'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
330 if ($action ==
'deleteline') {
331 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&lineid=' . $lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
334 if ($action ==
'clone') {
336 $formquestion = array(
337 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.
$object->label),
338 array(
'type' =>
'checkbox',
'name' =>
'clone_skills_required',
'label' => $langs->trans(
"RequiredSkills"),
'value' =>
'',),
341 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk',
$object->label),
'confirm_clone', $formquestion,
'yes', 1, 280);
345 if ($action ==
'xxx') {
346 $formquestion = array();
357 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
361 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
362 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
363 if (empty($reshook)) {
364 $formconfirm .= $hookmanager->resPrint;
365 } elseif ($reshook > 0) {
366 $formconfirm = $hookmanager->resPrint;
375 $linkback =
'<a href="' .
dol_buildpath(
'/hrm/job_list.php', 1) .
'?restore_lastsearch_values=1' . (!empty($socid) ?
'&socid=' . $socid :
'') .
'">' . $langs->trans(
"BackToList") .
'</a>';
377 $morehtmlref =
'<div class="refid">';
379 $morehtmlref .=
'</div>';
382 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
385 print
'<div class="fichecenter">';
386 print
'<div class="fichehalfleft">';
387 print
'<div class="underbanner clearboth"></div>';
388 print
'<table class="border centpercent tableforfield">'.
"\n";
394 $object->fields[
'label'][
'visible']=0;
395 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
398 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
404 print
'<div class="clearboth"></div>';
413 if (!empty(
$object->table_element_line)) {
415 $result =
$object->getLinesArray();
417 print
' <form name="addproduct" id="addproduct" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id . (($action !=
'editline') ?
'' :
'#line_' .
GETPOSTINT(
'lineid')) .
'" method="POST">
418 <input type="hidden" name="token" value="' .
newToken() .
'">
419 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline') .
'">
420 <input type="hidden" name="mode" value="">
421 <input type="hidden" name="page_y" value="">
422 <input type="hidden" name="id" value="' .
$object->id .
'">
425 if (!empty($conf->use_javascript_ajax) &&
$object->status == 0) {
426 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
429 print
'<div class="div-table-responsive-no-min">';
430 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
431 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
439 if (
$object->status == 0 && $permissiontoadd && $action !=
'selectlines') {
440 if ($action !=
'editline') {
443 $parameters = array();
444 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
448 if (empty($reshook)) {
449 $object->formAddObjectLine(1, $mysoc, $soc);
454 if (!empty(
$object->lines) || (
$object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
465 if ($action !=
'presend' && $action !=
'editline') {
466 print
'<div class="tabsAction">' .
"\n";
467 $parameters = array();
468 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
473 if (empty($reshook)) {
475 if (
$object->status == $object::STATUS_VALIDATED) {
476 print
dolGetButtonAction($langs->trans(
'SetToDraft'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=confirm_setdraft&confirm=yes&token=' .
newToken(),
'', $permissiontoadd);
479 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=edit&token=' .
newToken(),
'', $permissiontoadd);
481 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' .
$object->id .
'&action=clone&token=' .
newToken(),
'', $permissiontoadd);
484 print
dolGetButtonAction($langs->trans(
'Delete'),
'',
'delete', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=delete&token=' .
newToken(),
'', $permissiontodelete);
486 print
'</div>' .
"\n";
491 if (
GETPOST(
'modelselected')) {
495 if ($action !=
'presend') {
496 print
'<div class="fichecenter"><div class="fichehalfleft">';
497 print
'<a name="builddoc"></a>';
499 $includedocgeneration = 0;
502 if ($includedocgeneration) {
504 $relativepath = $objref .
'/' . $objref .
'.pdf';
505 $filedir = $conf->hrm->dir_output .
'/' .
$object->element .
'/' . $objref;
506 $urlsource = $_SERVER[
"PHP_SELF"] .
"?id=" .
$object->id;
507 $genallowed = $user->hasRight(
'hrm',
'job',
'read');
508 $delallowed = $user->hasRight(
'hrm',
'job',
'write');
509 print $formfile->showdocuments(
'hrm:Job',
$object->element .
'/' . $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
513 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'job'));
514 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
517 print
'</div><div class="fichehalfright">';
521 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/job_agenda.php?id='.
$object->id);
524 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formactions.class.php';
526 $somethingshown = $formactions->showactions($object,
$object->element .
'@' .
$object->module, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
528 print
'</div></div>';
533 $defaulttopic =
'InformationMessage';
534 $diroutput = $conf->hrm->dir_output;
535 $trackid =
'job' .
$object->id;
537 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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.
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.
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall TAKEPOS_SHOW_SUBPRICE right right right takeposterminal SELECT e rowid