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');
 
   51$lineid   = 
GETPOST(
'lineid', 
'int');
 
   54$object = 
new Job($db);
 
   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->rights->hrm->all->read;
 
   82$permissiontoadd  = $user->rights->hrm->all->write; 
 
   83$permissiontodelete = $user->rights->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', 
GETPOST(
'fk_soc', 
'int'), 
'', 
'', 
'date', 
'', $user, $triggermodname);
 
  147  if ($action == 
'classin' && $permissiontoadd) {
 
  148    $object->setProject(
GETPOST(
'projectid', 
'int'));
 
  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);
 
  168    if ($object->id > 0) {
 
  169      $object->id = $object->ref = 
null;
 
  171      if (
GETPOST(
'clone_label', 
'alphanohtml')) {
 
  172        $object->label = 
GETPOST(
'clone_label', 
'alphanohtml');
 
  174        $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
 
  176      if (
GETPOST(
'clone_skills_required')) {
 
  177        $cloneSkillRequired = 
GETPOST(
'clone_skills_required');
 
  180      $id = $object->create($user);
 
  182        if (!empty($cloneSkillRequired)) {
 
  184          while ($i < count($skillRequire)) {
 
  186            $skillrank->createFromClone($user, $skillRequire[$i]->
rowid, $id);
 
  193        header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
 
  215$form = 
new Form($db);
 
  219$title = $langs->trans(
"Job");
 
  240if ($action == 
'create') {
 
  241  print 
load_fiche_titre($langs->trans(
"NewJobProfile", $langs->transnoentities(
'Job')), 
'', 
'object_' . $object->picto);
 
  243  print 
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] . 
'">';
 
  244  print 
'<input type="hidden" name="token" value="' . newToken() . 
'">';
 
  245  print 
'<input type="hidden" name="action" value="add">';
 
  247    print 
'<input type="hidden" name="backtopage" value="' . $backtopage . 
'">';
 
  249  if ($backtopageforcancel) {
 
  250    print 
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . 
'">';
 
  255  print 
'<table class="border centpercent tableforfieldcreate">' . 
"\n";
 
  258  include DOL_DOCUMENT_ROOT . 
'/core/tpl/commonfields_add.tpl.php';
 
  261  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_add.tpl.php';
 
  263  print 
'</table>' . 
"\n";
 
  267  print 
'<div class="center">';
 
  268  print 
'<input type="submit" class="button" name="add" value="' . 
dol_escape_htmltag($langs->trans(
"Create")) . 
'">';
 
  270  print 
'<input type="' . ($backtopage ? 
"submit" : 
"button") . 
'" class="button button-cancel" name="cancel" value="' . 
dol_escape_htmltag($langs->trans(
"Cancel")) . 
'"' . ($backtopage ? 
'' : 
' onclick="history.go(-1)"') . 
'>'; 
 
  279if (($id || $ref) && $action == 
'edit') {
 
  280  print 
load_fiche_titre($langs->trans(
"JobProfile"), 
'', 
'object_' . $object->picto);
 
  282  print 
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] . 
'">';
 
  283  print 
'<input type="hidden" name="token" value="' . newToken() . 
'">';
 
  284  print 
'<input type="hidden" name="action" value="update">';
 
  285  print 
'<input type="hidden" name="id" value="' . $object->id . 
'">';
 
  287    print 
'<input type="hidden" name="backtopage" value="' . $backtopage . 
'">';
 
  289  if ($backtopageforcancel) {
 
  290    print 
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . 
'">';
 
  295  print 
'<table class="border centpercent tableforfieldedit">' . 
"\n";
 
  298  include DOL_DOCUMENT_ROOT . 
'/core/tpl/commonfields_edit.tpl.php';
 
  301  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_edit.tpl.php';
 
  307  print 
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") . 
'">';
 
  308  print 
'   <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") . 
'">';
 
  315if ($object->id > 0 && (empty($action) || ($action != 
'edit' && $action != 
'create'))) {
 
  316  $res = $object->fetch_optionals();
 
  319  $picto = 
'company.png';
 
  320  print 
dol_get_fiche_head($head, 
'job_card', $langs->trans(
"Workstation"), -1, $object->picto);
 
  325  if ($action == 
'delete') {
 
  326    $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id, $langs->trans(
'DeleteJob'), $langs->trans(
'ConfirmDeleteObject'), 
'confirm_delete', 
'', 0, 1);
 
  329  if ($action == 
'deleteline') {
 
  330    $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id . 
'&lineid=' . $lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'), 
'confirm_deleteline', 
'', 0, 1);
 
  333  if ($action == 
'clone') {
 
  335    $formquestion = array(
 
  336      array(
'type' => 
'text', 
'name' => 
'clone_label', 
'label' => $langs->trans(
"Label"), 
'value' => $langs->trans(
"CopyOf").
' '.$object->label),
 
  337      array(
'type' => 
'checkbox', 
'name' => 
'clone_skills_required', 
'label' => $langs->trans(
"RequiredSkills"), 
'value' => 
'',),
 
  340    $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk', $object->label), 
'confirm_clone', $formquestion, 
'yes', 1, 280);
 
  344  if ($action == 
'xxx') {
 
  345    $formquestion = array();
 
  356    $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id, $langs->trans(
'XXX'), $text, 
'confirm_xxx', $formquestion, 0, 1, 220);
 
  360  $parameters = array(
'formConfirm' => $formconfirm, 
'lineid' => $lineid);
 
  361  $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action); 
 
  362  if (empty($reshook)) {
 
  363    $formconfirm .= $hookmanager->resPrint;
 
  364  } elseif ($reshook > 0) {
 
  365    $formconfirm = $hookmanager->resPrint;
 
  374  $linkback = 
'<a href="' . 
dol_buildpath(
'/hrm/job_list.php', 1) . 
'?restore_lastsearch_values=1' . (!empty($socid) ? 
'&socid=' . $socid : 
'') . 
'">' . $langs->trans(
"BackToList") . 
'</a>';
 
  376  $morehtmlref = 
'<div class="refid">';
 
  377  $morehtmlref.= $object->label;
 
  378  $morehtmlref .= 
'</div>';
 
  381  dol_banner_tab($object, 
'id', $linkback, 1, 
'rowid', 
'rowid', $morehtmlref);
 
  384  print 
'<div class="fichecenter">';
 
  385  print 
'<div class="fichehalfleft">';
 
  386  print 
'<div class="underbanner clearboth"></div>';
 
  387  print 
'<table class="border centpercent tableforfield">'.
"\n";
 
  393  $object->fields[
'label'][
'visible']=0; 
 
  394  include DOL_DOCUMENT_ROOT . 
'/core/tpl/commonfields_view.tpl.php';
 
  397  include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_view.tpl.php';
 
  403  print 
'<div class="clearboth"></div>';
 
  412  if (!empty($object->table_element_line)) {
 
  414    $result = $object->getLinesArray();
 
  416    print 
' <form name="addproduct" id="addproduct" action="' . $_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id . (($action != 
'editline') ? 
'' : 
'#line_' . 
GETPOST(
'lineid', 
'int')) . 
'" method="POST"> 
  417    <input type="hidden" name="token" value="' . newToken() . 
'"> 
  418    <input type="hidden" name="action" value="' . (($action != 
'editline') ? 
'addline' : 
'updateline') . 
'"> 
  419    <input type="hidden" name="mode" value=""> 
  420    <input type="hidden" name="page_y" value=""> 
  421    <input type="hidden" name="id" value="' . $object->id . 
'"> 
  424    if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
 
  425      include DOL_DOCUMENT_ROOT . 
'/core/tpl/ajaxrow.tpl.php';
 
  428    print 
'<div class="div-table-responsive-no-min">';
 
  429    if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 
'selectlines' && $action != 
'editline')) {
 
  430      print 
'<table id="tablelines" class="noborder noshadow" width="100%">';
 
  433    if (!empty($object->lines)) {
 
  434      $object->printObjectLines($action, $mysoc, 
null, 
GETPOST(
'lineid', 
'int'), 1);
 
  438    if ($object->status == 0 && $permissiontoadd && $action != 
'selectlines') {
 
  439      if ($action != 
'editline') {
 
  442        $parameters = array();
 
  443        $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action); 
 
  447        if (empty($reshook)) {
 
  448          $object->formAddObjectLine(1, $mysoc, $soc);
 
  453    if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 
'selectlines' && $action != 
'editline')) {
 
  464  if ($action != 
'presend' && $action != 
'editline') {
 
  465    print 
'<div class="tabsAction">' . 
"\n";
 
  466    $parameters = array();
 
  467    $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action); 
 
  472    if (empty($reshook)) {
 
  474      if ($object->status == $object::STATUS_VALIDATED) {
 
  475        print 
dolGetButtonAction($langs->trans(
'SetToDraft'), 
'', 
'default', $_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id . 
'&action=confirm_setdraft&confirm=yes&token=' . newToken(), 
'', $permissiontoadd);
 
  478      print 
dolGetButtonAction($langs->trans(
'Modify'), 
'', 
'default', $_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id . 
'&action=edit&token=' . newToken(), 
'', $permissiontoadd);
 
  480      print 
dolGetButtonAction($langs->trans(
'ToClone'), 
'', 
'default', $_SERVER[
"PHP_SELF"] . 
'?id=' . $object->id . 
'&action=clone&token=' . newToken(), 
'', $permissiontoadd);
 
  483      print 
dolGetButtonAction($langs->trans(
'Delete'), 
'', 
'delete', $_SERVER[
'PHP_SELF'] . 
'?id=' . $object->id . 
'&action=delete&token=' . newToken(), 
'', $permissiontodelete);
 
  485    print 
'</div>' . 
"\n";
 
  490  if (
GETPOST(
'modelselected')) {
 
  494  if ($action != 
'presend') {
 
  495    print 
'<div class="fichecenter"><div class="fichehalfleft">';
 
  496    print 
'<a name="builddoc"></a>'; 
 
  498    $includedocgeneration = 0;
 
  501    if ($includedocgeneration) {
 
  503      $relativepath = $objref . 
'/' . $objref . 
'.pdf';
 
  504      $filedir = $conf->hrm->dir_output . 
'/' . $object->element . 
'/' . $objref;
 
  505      $urlsource = $_SERVER[
"PHP_SELF"] . 
"?id=" . $object->id;
 
  506      $genallowed = $user->rights->hrm->job->read; 
 
  507      $delallowed = $user->rights->hrm->job->write; 
 
  508      print $formfile->showdocuments(
'hrm:Job', $object->element . 
'/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, 
'', 
'', 
'', $langs->defaultlang);
 
  512    $linktoelem = $form->showLinkToObjectBlock($object, 
null, array(
'job'));
 
  513    $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
 
  516    print 
'</div><div class="fichehalfright">';
 
  520    $morehtmlcenter = 
dolGetButtonTitle($langs->trans(
'SeeAll'), 
'', 
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/job_agenda.php?id='.$object->id);
 
  523    include_once DOL_DOCUMENT_ROOT . 
'/core/class/html.formactions.class.php';
 
  525    $somethingshown = 
$formactions->showactions($object, $object->element . 
'@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, 
'', $MAXEVENT, 
'', $morehtmlcenter);
 
  527    print 
'</div></div>';
 
  532  $defaulttopic = 
'InformationMessage';
 
  533  $diroutput = $conf->hrm->dir_output;
 
  534  $trackid = 
'job' . $object->id;
 
  536  include DOL_DOCUMENT_ROOT . 
'/core/tpl/card_presend.tpl.php';
 
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $formactions
View.
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
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.
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
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.
 
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_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.
 
publicphonebutton2 phonegreen basiclayout basiclayout TotalHT VATCode TotalVAT TotalLT1 TotalLT2 TotalTTC TotalHT clearboth nowraponall right right takeposterminal SELECT e rowid
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.