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';
39$langs->loadLangs(array(
'hrm',
'other',
'products'));
44$action =
GETPOST(
'action',
'aZ09');
45$confirm =
GETPOST(
'confirm',
'alpha');
46$cancel =
GETPOST(
'cancel',
'aZ09');
47$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'jobcard';
48$backtopage =
GETPOST(
'backtopage',
'alpha');
49$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
50$lineid =
GETPOST(
'lineid',
'int');
53$object =
new Job($db);
55$diroutputmassaction = $conf->hrm->dir_output .
'/temp/massgeneration/' . $user->id;
56$hookmanager->initHooks(array(
'jobcard',
'globalcard'));
59$extrafields->fetch_name_optionals_label($object->table_element);
61$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
64$search_all =
GETPOST(
"search_all",
'alpha');
66foreach ($object->fields as $key => $val) {
67 if (
GETPOST(
'search_' . $key,
'alpha')) {
68 $search[$key] =
GETPOST(
'search_' . $key,
'alpha');
72if (empty($action) && empty($id) && empty($ref)) {
77include DOL_DOCUMENT_ROOT .
'/core/actions_fetchobject.inc.php';
80$permissiontoread = $user->rights->hrm->all->read;
81$permissiontoadd = $user->rights->hrm->all->write;
82$permissiontodelete = $user->rights->hrm->all->delete;
83$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] .
'/job';
91if (!$permissiontoread || ($action ===
'create' && !$permissiontoadd))
accessforbidden();
99$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
104if (empty($reshook)) {
109 if (empty($backtopage) || ($cancel && empty($id))) {
110 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
111 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
112 $backtopage = $backurlforlist;
114 $backtopage =
dol_buildpath(
'/hrm/job_card.php', 1) .
'?id=' . ($id > 0 ? $id :
'__ID__');
119 $triggermodname =
'HRM_JOB_MODIFY';
123 include DOL_DOCUMENT_ROOT .
'/core/actions_addupdatedelete.inc.php';
126 include DOL_DOCUMENT_ROOT .
'/core/actions_dellink.inc.php';
129 include DOL_DOCUMENT_ROOT .
'/core/actions_printing.inc.php';
135 include DOL_DOCUMENT_ROOT .
'/core/actions_builddoc.inc.php';
137 if ($action ==
'set_thirdparty' && $permissiontoadd) {
138 $object->setValueFrom(
'fk_soc',
GETPOST(
'fk_soc',
'int'),
'',
'',
'date',
'', $user, $triggermodname);
140 if ($action ==
'classin' && $permissiontoadd) {
141 $object->setProject(
GETPOST(
'projectid',
'int'));
145 $triggersendname =
'HRM_JOB_SENTBYMAIL';
146 $autocopy =
'MAIN_MAIL_AUTOCOPY_JOB_TO';
147 $trackid =
'job' . $object->id;
148 include DOL_DOCUMENT_ROOT .
'/core/actions_sendmails.inc.php';
158$form =
new Form($db);
162$title = $langs->trans(
"Job");
183if ($action ==
'create') {
184 print
load_fiche_titre($langs->trans(
"NewJobProfile", $langs->transnoentities(
'Job')),
'',
'object_' . $object->picto);
186 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
187 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
188 print
'<input type="hidden" name="action" value="add">';
190 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
192 if ($backtopageforcancel) {
193 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
198 print
'<table class="border centpercent tableforfieldcreate">' .
"\n";
201 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_add.tpl.php';
204 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_add.tpl.php';
206 print
'</table>' .
"\n";
210 print
'<div class="center">';
211 print
'<input type="submit" class="button" name="add" value="' .
dol_escape_htmltag($langs->trans(
"Create")) .
'">';
213 print
'<input type="' . ($backtopage ?
"submit" :
"button") .
'" class="button button-cancel" name="cancel" value="' .
dol_escape_htmltag($langs->trans(
"Cancel")) .
'"' . ($backtopage ?
'' :
' onclick="history.go(-1)"') .
'>';
222if (($id || $ref) && $action ==
'edit') {
223 print
load_fiche_titre($langs->trans(
"JobProfile"),
'',
'object_' . $object->picto);
225 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
226 print
'<input type="hidden" name="token" value="' . newToken() .
'">';
227 print
'<input type="hidden" name="action" value="update">';
228 print
'<input type="hidden" name="id" value="' . $object->id .
'">';
230 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
232 if ($backtopageforcancel) {
233 print
'<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel .
'">';
238 print
'<table class="border centpercent tableforfieldedit">' .
"\n";
241 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_edit.tpl.php';
244 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_edit.tpl.php';
250 print
'<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans(
"Save") .
'">';
251 print
' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
258if ($object->id > 0 && (empty($action) || ($action !=
'edit' && $action !=
'create'))) {
259 $res = $object->fetch_optionals();
262 $picto =
'company.png';
263 print
dol_get_fiche_head($head,
'job_card', $langs->trans(
"Workstation"), -1, $object->picto);
268 if ($action ==
'delete') {
269 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id, $langs->trans(
'DeleteJob'), $langs->trans(
'ConfirmDeleteObject'),
'confirm_delete',
'', 0, 1);
272 if ($action ==
'deleteline') {
273 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&lineid=' . $lineid, $langs->trans(
'DeleteLine'), $langs->trans(
'ConfirmDeleteLine'),
'confirm_deleteline',
'', 0, 1);
276 if ($action ==
'clone') {
278 $formquestion = array();
279 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneAsk', $object->ref),
'confirm_clone', $formquestion,
'yes', 1);
283 if ($action ==
'xxx') {
284 $formquestion = array();
295 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"] .
'?id=' . $object->id, $langs->trans(
'XXX'), $text,
'confirm_xxx', $formquestion, 0, 1, 220);
299 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
300 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
301 if (empty($reshook)) {
302 $formconfirm .= $hookmanager->resPrint;
303 } elseif ($reshook > 0) {
304 $formconfirm = $hookmanager->resPrint;
313 $linkback =
'<a href="' .
dol_buildpath(
'/hrm/job_list.php', 1) .
'?restore_lastsearch_values=1' . (!empty($socid) ?
'&socid=' . $socid :
'') .
'">' . $langs->trans(
"BackToList") .
'</a>';
315 $morehtmlref =
'<div class="refid">';
316 $morehtmlref.= $object->label;
317 $morehtmlref .=
'</div>';
320 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'rowid', $morehtmlref);
323 print
'<div class="fichecenter">';
324 print
'<div class="fichehalfleft">';
325 print
'<div class="underbanner clearboth"></div>';
326 print
'<table class="border centpercent tableforfield">'.
"\n";
332 $object->fields[
'label'][
'visible']=0;
333 include DOL_DOCUMENT_ROOT .
'/core/tpl/commonfields_view.tpl.php';
336 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_view.tpl.php';
342 print
'<div class="clearboth"></div>';
351 if (!empty($object->table_element_line)) {
353 $result = $object->getLinesArray();
355 print
' <form name="addproduct" id="addproduct" action="' . $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id . (($action !=
'editline') ?
'' :
'#line_' .
GETPOST(
'lineid',
'int')) .
'" method="POST">
356 <input type="hidden" name="token" value="' . newToken() .
'">
357 <input type="hidden" name="action" value="' . (($action !=
'editline') ?
'addline' :
'updateline') .
'">
358 <input type="hidden" name="mode" value="">
359 <input type="hidden" name="page_y" value="">
360 <input type="hidden" name="id" value="' . $object->id .
'">
363 if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
364 include DOL_DOCUMENT_ROOT .
'/core/tpl/ajaxrow.tpl.php';
367 print
'<div class="div-table-responsive-no-min">';
368 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
369 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
372 if (!empty($object->lines)) {
373 $object->printObjectLines($action, $mysoc,
null,
GETPOST(
'lineid',
'int'), 1);
377 if ($object->status == 0 && $permissiontoadd && $action !=
'selectlines') {
378 if ($action !=
'editline') {
381 $parameters = array();
382 $reshook = $hookmanager->executeHooks(
'formAddObjectLine', $parameters, $object, $action);
383 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
385 $object->formAddObjectLine(1, $mysoc, $soc);
389 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action !=
'selectlines' && $action !=
'editline')) {
400 if ($action !=
'presend' && $action !=
'editline') {
401 print
'<div class="tabsAction">' .
"\n";
402 $parameters = array();
403 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
408 if (empty($reshook)) {
410 if ($object->status == $object::STATUS_VALIDATED) {
411 print
dolGetButtonAction($langs->trans(
'SetToDraft'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&action=confirm_setdraft&confirm=yes&token=' . newToken(),
'', $permissiontoadd);
414 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
"PHP_SELF"] .
'?id=' . $object->id .
'&action=edit&token=' . newToken(),
'', $permissiontoadd);
417 print
dolGetButtonAction($langs->trans(
'Delete'),
'',
'delete', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=delete&token=' . newToken(),
'', $permissiontodelete);
419 print
'</div>' .
"\n";
424 if (
GETPOST(
'modelselected')) {
428 if ($action !=
'presend') {
429 print
'<div class="fichecenter"><div class="fichehalfleft">';
430 print
'<a name="builddoc"></a>';
432 $includedocgeneration = 0;
435 if ($includedocgeneration) {
437 $relativepath = $objref .
'/' . $objref .
'.pdf';
438 $filedir = $conf->hrm->dir_output .
'/' . $object->element .
'/' . $objref;
439 $urlsource = $_SERVER[
"PHP_SELF"] .
"?id=" . $object->id;
440 $genallowed = $user->rights->hrm->job->read;
441 $delallowed = $user->rights->hrm->job->write;
442 print $formfile->showdocuments(
'hrm:Job', $object->element .
'/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
446 $linktoelem = $form->showLinkToObjectBlock($object,
null, array(
'job'));
447 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
450 print
'</div><div class="fichehalfright">';
454 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/hrm/job_agenda.php?id='.$object->id);
457 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formactions.class.php';
459 $somethingshown =
$formactions->showactions($object, $object->element .
'@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
461 print
'</div></div>';
466 $defaulttopic =
'InformationMessage';
467 $diroutput = $conf->hrm->dir_output;
468 $trackid =
'job' . $object->id;
470 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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.