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/position.class.php';
 
   38require_once DOL_DOCUMENT_ROOT . 
'/hrm/class/job.class.php';
 
   39require_once DOL_DOCUMENT_ROOT . 
'/hrm/lib/hrm_position.lib.php';
 
   51$action   = 
GETPOST(
'action', 
'aZ09') ? 
GETPOST(
'action', 
'aZ09') : 
'view'; 
 
   52$backtopage = 
GETPOST(
'backtopage', 
'alpha');
 
   53$backtopageforcancel = 
GETPOST(
'backtopageforcancel', 
'alpha');
 
   65$permissiontoread = $user->hasRight(
'hrm', 
'all', 
'read');
 
   66$permissiontoadd = $user->hasRight(
'hrm', 
'all', 
'write'); 
 
   67$permissiontodelete = $user->hasRight(
'hrm', 
'all', 
'delete');
 
   68$permissiondellink = $user->hasRight(
'hrm', 
'all', 
'write'); 
 
   69$upload_dir = 
$conf->hrm->multidir_output[isset(
$object->entity) ? 
$object->entity : 1] . 
'/position';
 
   76if (empty(
$conf->hrm->enabled)) {
 
   79if (!$permissiontoread || ($action === 
'create' && !$permissiontoadd)) {
 
   83$langs->loadLangs(array(
"hrm", 
"other"));
 
   92$action = 
GETPOST(
'action', 
'aZ09');
 
   93$confirm = 
GETPOST(
'confirm', 
'alpha');
 
   94$cancel = 
GETPOST(
'cancel', 
'aZ09');
 
   95$contextpage = 
GETPOST(
'contextpage', 
'aZ') ? 
GETPOST(
'contextpage', 
'aZ') : 
'positioncard'; 
 
   96$backtopage = 
GETPOST(
'backtopage', 
'alpha');
 
   97$backtopageforcancel = 
GETPOST(
'backtopageforcancel', 
'alpha');
 
  109$diroutputmassaction = 
$conf->hrm->dir_output . 
'/temp/massgeneration/' . $user->id;
 
  110$hookmanager->initHooks(array(
'positioncard', 
'globalcard')); 
 
  113$extrafields->fetch_name_optionals_label(
$object->table_element);
 
  115$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element, 
'', 
'search_');
 
  118$search_all = 
GETPOST(
"search_all", 
'alpha');
 
  120foreach (
$object->fields as $key => $val) {
 
  121  if (
GETPOST(
'search_' . $key, 
'alpha')) {
 
  122    $search[$key] = 
GETPOST(
'search_' . $key, 
'alpha');
 
  126if (empty($action) && empty($id) && empty($ref)) {
 
  131include DOL_DOCUMENT_ROOT . 
'/core/actions_fetchobject.inc.php'; 
 
  138$parameters = array();
 
  139$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  144if (empty($reshook)) {
 
  147  $backurlforlist = 
dol_buildpath(
'/hrm/position_list.php', 1);
 
  149  if (empty($backtopage) || ($cancel && empty($fk_job))) {
 
  150    if (empty($backtopage) || ($cancel && strpos($backtopage, 
'__ID__'))) {
 
  151      if (empty($id) && (($action != 
'add' && $action != 
'create') || $cancel)) {
 
  152        $backtopage = $backurlforlist;
 
  154        $backtopage = 
dol_buildpath(
'/hrm/position_card.php', 1) . 
'?id=' . (
$id > 0 ? 
$id : 
'__ID__');
 
  159  $triggermodname = 
'HRM_POSITION_MODIFY'; 
 
  162  include DOL_DOCUMENT_ROOT . 
'/core/actions_addupdatedelete.inc.php';
 
  165  include DOL_DOCUMENT_ROOT . 
'/core/actions_dellink.inc.php';
 
  168  include DOL_DOCUMENT_ROOT . 
'/core/actions_printing.inc.php';
 
  174  include DOL_DOCUMENT_ROOT . 
'/core/actions_builddoc.inc.php';
 
  176  if ($action == 
'set_thirdparty' && $permissiontoadd) {
 
  177    $object->setValueFrom(
'fk_soc', 
GETPOSTINT(
'fk_soc'), 
'', 
null, 
'date', 
'', $user, $triggermodname);
 
  179  if ($action == 
'classin' && $permissiontoadd) {
 
  184  $triggersendname = 
'HRM_POSITION_SENTBYMAIL';
 
  185  $autocopy = 
'MAIN_MAIL_AUTOCOPY_POSITION_TO';
 
  186  $trackid = 
'position' . 
$object->id;
 
  187  include DOL_DOCUMENT_ROOT . 
'/core/actions_sendmails.inc.php';
 
  207  global $user, $langs, $db, 
$conf, $extrafields, $hookmanager, $action, $permissiontoadd, $permissiontodelete;
 
  218  $form = 
new Form($db);
 
  222  $backtopage = 
GETPOST(
'backtopage', 
'alpha');
 
  223  $backtopageforcancel = 
GETPOST(
'backtopageforcancel', 
'alpha');
 
  225  $title = $langs->trans(
"Position");
 
  231  if ((
$id || $ref) && $action == 
'edit') {
 
  234    print 
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] . 
'?id=' . 
$object->id . 
'">';
 
  235    print 
'<input type="hidden" name="token" value="' . 
newToken() . 
'">';
 
  236    print 
'<input type="hidden" name="action" value="update">';
 
  237    print 
'<input type="hidden" name="id" value="' . 
$object->id . 
'">';
 
  240      print 
'<input type="hidden" name="backtopage" value="' . $backtopage . 
'">';
 
  242    if ($backtopageforcancel) {
 
  243      print 
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . 
'">';
 
  248    print 
'<table class="border centpercent tableforfieldedit">' . 
"\n";
 
  251    include DOL_DOCUMENT_ROOT . 
'/core/tpl/commonfields_edit.tpl.php';
 
  254    include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_edit.tpl.php';
 
  260    print 
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") . 
'">';
 
  261    print 
'   <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") . 
'">';
 
  269  if (
$object->id > 0 && (empty($action) || ($action != 
'edit' && $action != 
'create'))) {
 
  270    $res = 
$object->fetch_optionals();
 
  279    if ($action == 
'delete') {
 
  280      $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] . 
'?id=' . 
$object->id, $langs->trans(
'DeletePosition'), $langs->trans(
'ConfirmDeleteObject'), 
'confirm_delete', 
'', 0, 1);
 
  284    $parameters = array(
'formConfirm' => $formconfirm);
 
  285    $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, 
$object, $action); 
 
  286    if (empty($reshook)) {
 
  287      $formconfirm .= $hookmanager->resPrint;
 
  288    } elseif ($reshook > 0) {
 
  289      $formconfirm = $hookmanager->resPrint;
 
  298    $linkback = 
'<a href="'.DOL_URL_ROOT.
'/hrm/position_list.php">'.$langs->trans(
"BackToList").
'</a>';
 
  300    $morehtmlref = 
'<div class="refidno">';
 
  301    $u_position = 
new User(($db));
 
  302    $u_position->fetch(
$object->fk_user);
 
  303    $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans(
'Employee').
' : ');
 
  306    $morehtmlref .= 
'<br>'.$langs->trans(
'JobProfile').
' : '.$job->getNomUrl(1);
 
  307    $morehtmlref .= 
'</div>';
 
  309    dol_banner_tab(
$object, 
'id', $linkback, 1, 
'rowid', 
'rowid', $morehtmlref);
 
  312    print 
'<div class="fichecenter">';
 
  313    print 
'<div class="fichehalfleft">';
 
  314    print 
'<div class="underbanner clearboth"></div>';
 
  315    print 
'<table class="border centpercent tableforfield">' . 
"\n";
 
  321    $object->fields[
'fk_user'][
'visible'] = 0; 
 
  322    $object->fields[
'fk_job'][
'visible'] = 0; 
 
  323    include DOL_DOCUMENT_ROOT . 
'/core/tpl/commonfields_view.tpl.php';
 
  326    include DOL_DOCUMENT_ROOT . 
'/core/tpl/extrafields_view.tpl.php';
 
  332    print 
'<div class="clearboth"></div>';
 
  339    print 
'<div class="tabsAction">';
 
  341    $parameters = array();
 
  342    $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, 
$object, $action); 
 
  345    print 
dolGetButtonAction($langs->trans(
'Modify'), 
'', 
'default', $_SERVER[
"PHP_SELF"] . 
'?id=' . 
$object->id . 
'&action=edit&token=' . 
newToken(), 
'', $permissiontoadd);
 
  348    print 
dolGetButtonAction($langs->trans(
'Delete'), 
'', 
'delete', $_SERVER[
'PHP_SELF'] . 
'?id=' . 
$object->id . 
'&action=delete&token=' . 
newToken(), 
'', $permissiontodelete);
 
  386print 
'</table>' . 
"\n";
 
  387print 
'</div>' . 
"\n";
 
  389print 
'</form>' . 
"\n";
 
  392if ($action !== 
'edit' && $action !== 
'create') {
 
  393  print 
'<div class="fichecenter"><div class="fichehalfleft">';
 
  396  $tmparray = $form->showLinkToObjectBlock($object, array(), array(
'position'), 1);
 
  397  $linktoelem = $tmparray[
'linktoelem'];
 
  398  $htmltoenteralink = $tmparray[
'htmltoenteralink'];
 
  399  print $htmltoenteralink;
 
  401  $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
 
  403  print 
'</div><div class="fichehalfright">';
 
  407  $morehtmlcenter = 
dolGetButtonTitle($langs->trans(
'SeeAll'), 
'', 
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/position_agenda.php?id='.
$object->id);
 
  410  include_once DOL_DOCUMENT_ROOT . 
'/core/class/html.formactions.class.php';
 
  412  $somethingshown = $formactions->showactions($object, 
$object->element . 
'@' . 
$object->module, (is_object(
$object->thirdparty) ? 
$object->thirdparty->id : 0), 1, 
'', $MAXEVENT, 
'', $morehtmlcenter);
 
  414  print 
'</div></div>';
 
 
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
 
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
 
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 Dolibarr users.
 
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
positionCardPrepareHead($object)
Prepare array of tabs for positions.
 
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
 
displayPositionCard(&$object)
Show the card of a position.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.