30 require
'../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formcompany.class.php';
33 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formprojet.class.php';
35 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/position.class.php';
36 require_once DOL_DOCUMENT_ROOT .
'/hrm/class/job.class.php';
37 require_once DOL_DOCUMENT_ROOT .
'/hrm/lib/hrm_position.lib.php';
41 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
43 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
49 $res = $object->fetch($id);
55 $permissiontoread = $user->rights->hrm->all->read;
56 $permissiontoadd = $user->rights->hrm->all->write;
57 $permissiontodelete = $user->rights->hrm->all->delete;
58 $permissiondellink = $user->rights->hrm->all->write;
59 $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] .
'/position';
67 if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd))
accessforbidden();
69 $langs->loadLangs(array(
"hrm",
"other"));
75 $fk_job =
GETPOST(
'fk_job',
'int');
78 $action =
GETPOST(
'action',
'aZ09');
79 $confirm =
GETPOST(
'confirm',
'alpha');
80 $cancel =
GETPOST(
'cancel',
'aZ09');
81 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'positioncard';
82 $backtopage =
GETPOST(
'backtopage',
'alpha');
83 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
95 $diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
96 $hookmanager->initHooks(array(
'positioncard',
'globalcard'));
99 $extrafields->fetch_name_optionals_label($object->table_element);
101 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
104 $search_all =
GETPOST(
"search_all",
'alpha');
106 foreach ($object->fields as $key => $val) {
107 if (
GETPOST(
'search_' . $key,
'alpha')) {
108 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
112 if (empty($action) && empty($id) && empty($ref)) {
117 include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
124 $parameters = array();
125 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
130 if (empty($reshook)) {
133 $backurlforlist =
dol_buildpath(
'/hrm/position_list.php', 1);
135 if (empty($backtopage) || ($cancel && empty($fk_job))) {
136 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
137 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
138 $backtopage = $backurlforlist;
140 $backtopage =
dol_buildpath(
'/hrm/position_card.php', 1) .
'?id=' . ($id > 0 ? $id :
'__ID__');
145 $triggermodname =
'hrm_POSITION_MODIFY';
148 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
151 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
154 include DOL_DOCUMENT_ROOT .
'/core/actions_printing.inc.php';
160 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
162 if ($action ==
'set_thirdparty' && $permissiontoadd) {
163 $object->setValueFrom(
'fk_soc',
GETPOST(
'fk_soc',
'int'),
'',
'',
'date',
'', $user, $triggermodname);
165 if ($action ==
'classin' && $permissiontoadd) {
166 $object->setProject(
GETPOST(
'projectid',
'int'));
170 $triggersendname =
'hrm_POSITION_SENTBYMAIL';
171 $autocopy =
'MAIN_MAIL_AUTOCOPY_POSITION_TO';
172 $trackid =
'position' . $object->id;
173 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
188 global $user, $langs, $db, $conf, $extrafields, $hookmanager, $action, $permissiontoadd, $permissiontodelete;
202 $backtopage =
GETPOST(
'backtopage',
'alpha');
203 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
205 $title = $langs->trans(
"Position");
211 if (($id || $ref) && $action ==
'edit') {
212 print
load_fiche_titre($langs->trans(
"Position"),
'',
'object_' . $object->picto);
214 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'">';
215 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
216 print
'<input type="hidden" name="action" value="update">';
217 print
'<input type="hidden" name="id" value="' . $object->id .
'">';
220 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
222 if ($backtopageforcancel) {
223 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
228 print
'<table class="border centpercent tableforfieldedit">' .
"\n";
231 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_edit.tpl.php';
234 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_edit.tpl.php';
240 print
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") .
'">';
241 print
' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
249 if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
250 $res = $object->fetch_optionals();
254 print
dol_get_fiche_head($head,
'position', $langs->trans(
"Workstation"), -1, $object->picto);
259 if ($action ==
'delete') {
260 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id, $langs->trans(
'DeletePosition'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
265 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
266 if (empty($reshook)) {
268 } elseif ($reshook > 0) {
279 $linkback =
'<a href="' .
dol_buildpath(
'/hrm/position_list.php', 1) .
'">' . $langs->trans(
"BackToList") .
'</a>';
281 $morehtmlref =
'<div class="refidno">';
282 $u_position =
new User(($db));
283 $u_position->fetch($object->fk_user);
284 $morehtmlref .= $langs->trans(
'Employee').
' : '.($u_position->id > 0 ? $u_position->getNomUrl(1) :
'');
286 $job->fetch($object->fk_job);
287 $morehtmlref .=
'<br>'.$langs->trans(
'Job').
' : '.$job->getNomUrl(1);
288 $morehtmlref .=
'</div>';
290 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
293 print
'<div class="fichecenter">';
294 print
'<div class="fichehalfleft">';
295 print
'<div class="underbanner clearboth"></div>';
296 print
'<table class="border centpercent tableforfield">' .
"\n";
302 $object->fields[
'fk_user'][
'visible']=0;
303 $object->fields[
'fk_job'][
'visible']=0;
304 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
307 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
313 print
'<div class="clearboth"></div>';
320 print
'<div class="tabsAction">';
322 $parameters = array();
323 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
326 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&action=edit&token=' .
newToken(),
'', $permissiontoadd);
329 print
dolGetButtonAction($langs->trans(
'Delete'),
'',
'delete', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=delete&token=' .
newToken(),
'', $permissiontodelete);
367 print
'</table>' .
"\n";
368 print
'</div>' .
"\n";
370 print
'</form>' .
"\n";
373 if ($action !==
'edit' && $action !==
'create') {
374 print
'<div class="fichecenter"><div class="fichehalfleft">';
377 $linktoelem =
$form->showLinkToObjectBlock($object,
null, array(
'position'));
378 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
381 print
'</div><div class="fichehalfright">';
385 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/position_agenda.php?id='.$object->id);
388 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formactions.class.php';
390 $somethingshown =
$formactions->showactions($object, $object->element .
'@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
392 print
'</div></div>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
Class to manage Dolibarr users.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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='')
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
positionCardPrepareHead($object)
Prepare array of tabs for positions.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.