dolibarr 18.0.6
evaluation_card.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
4 * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
5 * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
6 * Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
34require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluation.class.php';
35require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
36require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php';
37require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php';
38require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_evaluation.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skillrank.lib.php';
40
41
42// Load translation files required by the page
43$langs->loadLangs(array('hrm', 'other', 'products')); // why products?
44
45// Get parameters
46$id = GETPOST('id', 'int');
47$ref = GETPOST('ref', 'alpha');
48$action = GETPOST('action', 'aZ09');
49$confirm = GETPOST('confirm', 'alpha');
50$cancel = GETPOST('cancel', 'aZ09');
51$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'evaluationcard'; // To manage different context of search
52$backtopage = GETPOST('backtopage', 'alpha');
53$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
54$lineid = GETPOST('lineid', 'int');
55
56// Initialize technical objects
57$object = new Evaluation($db);
58$extrafields = new ExtraFields($db);
59$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
60$hookmanager->initHooks(array('evaluationcard', 'globalcard')); // Note that conf->hooks_modules contains array
61
62// Fetch optionals attributes and labels
63$extrafields->fetch_name_optionals_label($object->table_element);
64
65$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
66
67// Initialize array of search criterias
68$search_all = GETPOST("search_all", 'alpha');
69$search = array();
70foreach ($object->fields as $key => $val) {
71 if (GETPOST('search_'.$key, 'alpha')) {
72 $search[$key] = GETPOST('search_'.$key, 'alpha');
73 }
74}
75
76if (empty($action) && empty($id) && empty($ref)) {
77 $action = 'view';
78}
79
80// Load object
81include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
82
83// Permissions
84$permissiontoread = $user->rights->hrm->evaluation->read;
85$permissiontoadd = $user->rights->hrm->evaluation->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
86$permissiontovalidate = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->hrm->evaluation_advance->validate) || (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $permissiontoadd);
87$permissiontoClose = $user->rights->hrm->evaluation->write;
88$permissiontodelete = $user->rights->hrm->evaluation->delete/* || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT)*/;
89$permissiondellink = $user->rights->hrm->evaluation->write; // Used by the include of actions_dellink.inc.php
90$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/evaluation';
91
92// Security check (enable the most restrictive one)
93//if ($user->socid > 0) accessforbidden();
94//if ($user->socid > 0) $socid = $user->socid;
95//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
96//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
97if (!isModEnabled("hrm")) {
99}
100if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
101
102
103/*
104 * Actions
105 */
106
107$parameters = array();
108$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
109if ($reshook < 0) {
110 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
111}
112
113if (empty($reshook)) {
114 $error = 0;
115
116 $backurlforlist = dol_buildpath('/hrm/evaluation_list.php', 1);
117
118 if (empty($backtopage) || ($cancel && empty($id))) {
119 if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
120 if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
121 $backtopage = $backurlforlist;
122 } else {
123 $backtopage = dol_buildpath('/hrm/evaluation_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
124 }
125 }
126 }
127
128 $triggermodname = 'HRM_EVALUATION_MODIFY'; // Name of trigger action code to execute when we modify record
129
130 // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
131 include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
132
133 // Actions when linking object each other
134 include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
135
136 // Actions when printing a doc from card
137 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
138
139 // Action to move up and down lines of object
140 //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
141
142 // Action to build doc
143 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
144
145 if ($action == 'set_thirdparty' && $permissiontoadd) {
146 $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
147 }
148 if ($action == 'classin' && $permissiontoadd) {
149 $object->setProject(GETPOST('projectid', 'int'));
150 }
151
152 // Actions to send emails
153 $triggersendname = 'HRM_EVALUATION_SENTBYMAIL';
154 $autocopy = 'MAIN_MAIL_AUTOCOPY_EVALUATION_TO';
155 $trackid = 'evaluation'.$object->id;
156 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
157
158 if ($action == 'saveSkill') {
159 $TNote = GETPOST('TNote', 'array');
160 if (!empty($TNote)) {
161 foreach ($object->lines as $line) {
162 $line->rankorder = $TNote[$line->fk_skill];
163 $line->update($user);
164 }
165 setEventMessage($langs->trans("SaveLevelSkill"));
166 }
167 }
168
169 if ($action == 'close') {
170 // save evaldet lines to user;
171 $sk = new SkillRank($db);
172 $SkillrecordsForActiveUser = $sk->fetchAll('ASC', 'fk_skill', 0, 0, array("customsql"=>"fk_object = ".$object->fk_user ." AND objecttype ='".SkillRank::SKILLRANK_TYPE_USER."'"), 'AND');
173
174 $errors = 0;
175 // we go through the evaldets of the eval
176 foreach ($object->lines as $key => $line) {
177 // no reference .. we add the line to use it
178 if (count($SkillrecordsForActiveUser) == 0) {
179 $newSkill = new SkillRank($db);
180 $resCreate = $newSkill->cloneFromCurrentSkill($line, $object->fk_user);
181
182 if ($resCreate <= 0) {
183 $errors++;
184 setEventMessage($langs->trans('ErrorCreateUserSkill'), $line->fk_skill);
185 }
186 } else {
187 //check if the skill is present to use it
188 $find = false;
189 $keyFind = 0;
190 foreach ($SkillrecordsForActiveUser as $k => $sr) {
191 if ($sr->fk_skill == $line->fk_skill) {
192 $keyFind = $k;
193 $find = true;
194 break;
195 }
196 }
197 //we update the skill user
198 if ($find) {
199 $updSkill = $SkillrecordsForActiveUser[$k];
200
201 $updSkill->rankorder = $line->rankorder;
202 $updSkill->update($user);
203 } else { // sinon on ajoute la skill
204 $newSkill = new SkillRank($db);
205 $resCreate = $newSkill->cloneFromCurrentSkill($line, $object->fk_user);
206 }
207 }
208 }
209 if (empty($errors)) {
210 $object->setStatut(Evaluation::STATUS_CLOSED);
211 setEventMessage('EmployeeSkillsUpdated');
212 }
213 }
214
215 if ($action == 'reopen' ) {
216 // no update here we just change the evaluation status
217 $object->setStatut(Evaluation::STATUS_VALIDATED);
218 }
219}
220
221
222
223
224/*
225 * View
226 *
227 * Put here all code to build page
228 */
229
230$form = new Form($db);
231$formfile = new FormFile($db);
232$formproject = new FormProjets($db);
233
234$title = $langs->trans("Evaluation");
235$help_url = '';
236$css = array();
237$css[] = '/hrm/css/style.css';
238llxHeader('', $title, $help_url, '', 0, 0, '', $css);
239
240print '<script type="text/javascript" language="javascript">
241 $(document).ready(function() {
242 $("#btn_valid").click(function(){
243 var form = $("#form_save_rank");
244
245 $.ajax({
246
247 type: "POST",
248 url: form.attr("action"),
249 data: form.serialize(),
250 dataType: "json"
251 }).always(function() {
252 window.location.href = "'.dol_buildpath('/hrm/evaluation_card.php', 1).'?id='.$id.'&action=validate&token='.newToken().'";
253 return false;
254 });
255
256 });
257 });
258</script>';
259
260// Part to create
261if ($action == 'create') {
262 print load_fiche_titre($langs->trans("NewEval"), '', 'object_' . $object->picto);
263
264 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
265 print '<input type="hidden" name="token" value="'.newToken().'">';
266 print '<input type="hidden" name="action" value="add">';
267 if ($backtopage) {
268 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
269 }
270 if ($backtopageforcancel) {
271 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
272 }
273
274 print dol_get_fiche_head(array(), '');
275
276 print '<table class="border centpercent tableforfieldcreate">'."\n";
277
278 // Common attributes
279 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
280
281 // Other attributes
282 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
283
284 print '</table>'."\n";
285
286 print dol_get_fiche_end();
287
288 print $form->buttonsSaveCancel("Create", "Cancel");
289
290 print '</form>';
291}
292
293// Part to edit record
294if (($id || $ref) && $action == 'edit') {
295 print load_fiche_titre($langs->trans("Evaluation"), '', 'object_'.$object->picto);
296
297 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
298 print '<input type="hidden" name="token" value="'.newToken().'">';
299 print '<input type="hidden" name="action" value="update">';
300 print '<input type="hidden" name="id" value="'.$object->id.'">';
301 if ($backtopage) {
302 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
303 }
304 if ($backtopageforcancel) {
305 print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
306 }
307
308 print dol_get_fiche_head();
309
310 print '<table class="border centpercent tableforfieldedit">'."\n";
311
312 // Common attributes
313 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
314
315 // Other attributes
316 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
317
318 print '</table>';
319
320 print dol_get_fiche_end();
321
322 print $form->buttonsSaveCancel();
323
324 print '</form>';
325}
326
327// Part to show record
328if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
329 $res = $object->fetch_optionals();
330
331 $head = evaluationPrepareHead($object);
332 print dol_get_fiche_head($head, 'card', $langs->trans("Workstation"), -1, $object->picto);
333
334 $formconfirm = '';
335
336 if ($action == 'validate' && $permissiontovalidate) {
337 // Confirm validate proposal
338 $error = 0;
339
340 // We verify whether the object is provisionally numbering
341 $ref = substr($object->ref, 1, 4);
342 if ($ref == 'PROV') {
343 $numref = $object->getNextNumRef();
344 if (empty($numref)) {
345 $error++;
346 setEventMessages($object->error, $object->errors, 'errors');
347 }
348 } else {
349 $numref = $object->ref;
350 }
351
352 $text = $langs->trans('ConfirmValidateEvaluation', $numref);
353 if (isModEnabled('notification')) {
354 require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
355 $notify = new Notify($db);
356 $text .= '<br>';
357 $text .= $notify->confirmMessage('HRM_EVALUATION_VALIDATE', $object->socid, $object);
358 }
359
360 if (!$error) {
361 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateEvaluation'), $text, 'confirm_validate', '', 0, 1);
362 }
363 }
364
365 // Confirmation to delete
366 if ($action == 'delete') {
367 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteEvaluation'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
368 }
369 // Confirmation to delete line
370 if ($action == 'deleteline') {
371 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
372 }
373 // Clone confirmation
374 if ($action == 'clone') {
375 // Create an array for form
376 $formquestion = array();
377 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
378 }
379
380 // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
381 if ($action == 'xxx') {
382 $text = $langs->trans('ConfirmActionMyObject', $object->ref);
383
384 $formquestion = array();
385
386 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
387 }
388
389 // Call Hook formConfirm
390 $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
391 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
392 if (empty($reshook)) {
393 $formconfirm .= $hookmanager->resPrint;
394 } elseif ($reshook > 0) {
395 $formconfirm = $hookmanager->resPrint;
396 }
397
398 // Print form confirm
399 print $formconfirm;
400
401
402 // Object card
403 // ------------------------------------------------------------
404 $linkback = '<a href="'.dol_buildpath('/hrm/evaluation_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
405
406 $morehtmlref = '<div class="refidno">';
407 $morehtmlref .= $langs->trans('Label').' : '.$object->label;
408 $u_position = new User(($db));
409 $u_position->fetch($object->fk_user);
410 $morehtmlref .= '<br>'.$u_position->getNomUrl(1);
411 $job = new Job($db);
412 $job->fetch($object->fk_job);
413 $morehtmlref .= '<br>'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1);
414 $morehtmlref .= '</div>';
415
416
417
418 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
419
420
421 print '<div class="fichecenter">';
422 print '<div class="fichehalfleft">';
423 print '<div class="underbanner clearboth"></div>';
424 print '<table class="border centpercent tableforfield">'."\n";
425
426 $object->fields['label']['visible']=0; // Already in banner
427 $object->fields['fk_user']['visible']=0; // Already in banner
428 $object->fields['fk_job']['visible']=0; // Already in banner
429 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
430
431 // Other attributes. Fields from hook formObjectOptions and Extrafields.
432 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
433
434 print '</table>';
435 print '</div>';
436 print '</div>';
437
438 print '<div class="clearboth"></div>';
439
440 print dol_get_fiche_end();
441
442
443 /*
444 * Lines
445 */
446
447 if (!empty($object->table_element_line) && $object->status == Evaluation::STATUS_DRAFT) {
448 // Show object lines
449 $result = $object->getLinesArray();
450 if ($result < 0) {
451 dol_print_error($db, $object->error, $object->errors);
452 }
453
454 print '<br>';
455
456 print ' <form name="form_save_rank" id="form_save_rank" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
457 <input type="hidden" name="token" value="' . newToken().'">
458 <input type="hidden" name="action" value="saveSkill">
459 <input type="hidden" name="mode" value="">
460 <input type="hidden" name="page_y" value="">
461 <input type="hidden" name="id" value="' . $object->id.'">
462 ';
463
464 if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
465 include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
466 }
467
468 $conf->modules_parts['tpl']['hrm']='/hrm/core/tpl/'; // Pour utilisation du tpl hrm sur cet écran
469
470 print '<div class="div-table-responsive-no-min">';
471 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
472 print '<table id="tablelines" class="noborder noshadow" width="100%">';
473 }
474
475
476 $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1);
477
478 if (empty($object->lines)) {
479 print '<tr><td colspan="4"><span class="opacitymedium">'.img_warning().' '.$langs->trans("TheJobProfileHasNoSkillsDefinedFixBefore").'</td></tr>';
480 }
481
482 // Form to add new line
483 /*
484 if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
485 if ($action != 'editline') {
486 // Add products/services form
487
488 $parameters = array();
489 $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
490 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
491 if (empty($reshook))
492 $object->formAddObjectLine(1, $mysoc, $soc);
493 }
494 }
495 */
496
497 if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
498 print '</table>';
499 }
500 print '</div>';
501
502 print "</form>\n";
503
504 print "<br>";
505 }
506
507 // list of comparison
508 if ($object->status != Evaluation::STATUS_DRAFT) {
509 // Recovery of skills related to this evaluation
510
511 $sql = 'select';
512 $sql .= ' e.ref,';
513 $sql .= ' e.date_creation,';
514 $sql .= ' e.fk_job,';
515 $sql .= ' j.label as "refjob",';
516 $sql .= ' ed.fk_skill,';
517
518 $sql .= ' sk.label as "skilllabel",';
519 $sql .= ' sk.skill_type,';
520 $sql .= ' sk.description,';
521 $sql .= ' ed.rankorder,';
522 $sql .= ' ed.required_rank,';
523 $sql .= ' ed.rankorder as "userRankForSkill",';
524 $sql .= ' skdet_user.description as "userRankForSkillDesc",';
525 $sql .= ' skdet_required.description as "required_rank_desc"';
526
527 $sql .= ' FROM ' . MAIN_DB_PREFIX . 'hrm_evaluation as e';
528 $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'hrm_evaluationdet as ed ON e.rowid = ed.fk_evaluation';
529 $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'hrm_job as j ON e.fk_job = j.rowid';
530 $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'hrm_skill as sk ON ed.fk_skill = sk.rowid';
531 $sql .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'hrm_skilldet as skdet_user ON (skdet_user.fk_skill = sk.rowid AND skdet_user.rankorder = ed.rankorder)';
532 //$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "hrm_skillrank as skr ON (j.rowid = skr.fk_object AND skr.fk_skill = ed.fk_skill AND skr.objecttype = 'job')";
533 $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'hrm_skilldet as skdet_required ON (skdet_required.fk_skill = sk.rowid AND skdet_required.rankorder = ed.required_rank)';
534 $sql .= " WHERE e.rowid =" . ((int) $object->id);
535
536 // echo $sql;
537
538 $resql = $db->query($sql);
539 $Tab = array();
540
541 if ($resql) {
542 $num = 0;
543 while ($obj = $db->fetch_object($resql)) {
544 $Tab[$num] = new stdClass();
545 $class = '';
546 $Tab[$num]->skill_type = $obj->skill_type;
547 $Tab[$num]->skill_id = $obj->fk_skill;
548 $Tab[$num]->skilllabel = $obj->skilllabel;
549 $Tab[$num]->description = $obj->description;
550 $Tab[$num]->userRankForSkill = '<span title="'.$obj->userRankForSkillDesc.'" class="radio_js_bloc_number TNote_1">' . $obj->userRankForSkill . '</span>';
551 $Tab[$num]->required_rank = '<span title="'.$obj->required_rank_desc.'" class="radio_js_bloc_number TNote_1">' . $obj->required_rank . '</span>';
552
553 if ($obj->userRankForSkill > $obj->required_rank) {
554 $title=$langs->trans('MaxlevelGreaterThanShort');
555 $class .= 'veryhappy diffnote';
556 } elseif ($obj->userRankForSkill == $obj->required_rank) {
557 $title=$langs->trans('MaxLevelEqualToShort');
558 $class .= 'happy diffnote';
559 } elseif ($obj->userRankForSkill < $obj->required_rank) {
560 $title=$langs->trans('MaxLevelLowerThanShort');
561 $class .= 'sad';
562 }
563
564 $Tab[$num]->result = '<span title="'.$title.'" class="classfortooltip ' . $class . ' note">&nbsp;</span>';
565
566 $num++;
567 }
568
569 print '<div class="underbanner clearboth"></div>';
570 print '<table class="noborder centpercent">';
571
572 print '<tr class="liste_titre">';
573 print '<th style="width:auto;text-align:auto" class="liste_titre">' . $langs->trans("TypeSkill") . ' </th>';
574 print '<th style="width:auto;text-align:auto" class="liste_titre">' . $langs->trans("Label") . '</th>';
575 print '<th style="width:auto;text-align:auto" class="liste_titre">' . $langs->trans("Description") . '</th>';
576 print '<th style="width:auto;text-align:center" class="liste_titre">' . $langs->trans("EmployeeRank") . '</th>';
577 print '<th style="width:auto;text-align:center" class="liste_titre">' . $langs->trans("RequiredRank") . '</th>';
578 print '<th style="width:auto;text-align:auto" class="liste_titre">' . $langs->trans("Result") . ' ' .$form->textwithpicto('', GetLegendSkills(), 1) .'</th>';
579 print '</tr>';
580
581 $sk = new Skill($db);
582 foreach ($Tab as $t) {
583 $sk->fetch($t->skill_id);
584 print '<tr>';
585 print ' <td>' . Skill::typeCodeToLabel($t->skill_type) . '</td>';
586 print ' <td>' . $sk->getNomUrl(1) . '</td>';
587 print ' <td>' . $t->description . '</td>';
588 print ' <td align="center">' . $t->userRankForSkill . '</td>';
589 print ' <td align="center">' . $t->required_rank . '</td>';
590 print ' <td>' . $t->result . '</td>';
591 print '</tr>';
592 }
593
594 print '</table>';
595
596 ?>
597
598 <script>
599
600 $(document).ready(function() {
601 $(".radio_js_bloc_number").tooltip();
602 });
603
604 </script>
605
606 <?php
607 }
608 }
609
610 // Buttons for actions
611 if ($action != 'presend' && $action != 'editline') {
612 print '<div class="tabsAction">'."\n";
613 $parameters = array();
614 $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
615 if ($reshook < 0) {
616 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
617 }
618
619 if (empty($reshook)) {
620 // Send
621 if (empty($user->socid)) {
622 print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
623 }
624
625 // Back to draft
626 if ($object->status == $object::STATUS_VALIDATED) {
627 print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
628 print dolGetButtonAction('', $langs->trans('Close'), 'close', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_CLOSED && $permissiontoclose));
629 } elseif ($object->status != $object::STATUS_CLOSED) {
630 print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
631 }
632
633 if ($object->status == $object::STATUS_CLOSED) {
634 print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd);
635 }
636
637
638 // Validate
639 if ($object->status == $object::STATUS_DRAFT) {
640 if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
641 print dolGetButtonAction($langs->trans('Save').'&nbsp;'.$langs->trans('and').'&nbsp;'.$langs->trans('Valid'), '', 'default', '#', 'btn_valid', $permissiontovalidate);
642 } else {
643 $langs->load("errors");
644 print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0);
645 }
646 }
647
648
649 // Delete (need delete permission, or if draft, just need create/modify permission)
650 print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
651 }
652
653
654 print '</div>'."\n";
655 }
656
657 // Select mail models is same action as presend
658 if (GETPOST('modelselected')) {
659 $action = 'presend';
660 }
661
662 if ($action != 'presend') {
663 print '<div class="fichecenter"><div class="fichehalfleft">';
664 print '<a name="builddoc"></a>'; // ancre
665
666 $includedocgeneration = 0;
667
668 // Documents
669 if ($includedocgeneration) {
670 $objref = dol_sanitizeFileName($object->ref);
671 $relativepath = $objref.'/'.$objref.'.pdf';
672 $filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref;
673 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
674 $genallowed = $user->rights->hrm->evaluation->read; // If you can read, you can build the PDF to read content
675 $delallowed = $user->rights->hrm->evaluation->write; // If you can create/edit, you can remove a file on card
676 print $formfile->showdocuments('hrm:Evaluation', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
677 }
678
679 // Show links to link elements
680 $linktoelem = $form->showLinkToObjectBlock($object, null, array('evaluation'));
681 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
682
683
684 print '</div><div class="fichehalfright">';
685
686 $MAXEVENT = 10;
687
688 $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/evaluation_agenda.php?id='.$object->id);
689
690 // List of actions on element
691 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
692 $formactions = new FormActions($db);
693 $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
694
695 print '</div></div>';
696 }
697
698 //Select mail models is same action as presend
699 if (GETPOST('modelselected')) {
700 $action = 'presend';
701 }
702
703 // Presend form
704 $modelmail = 'evaluation';
705 $defaulttopic = 'InformationMessage';
706 $diroutput = $conf->hrm->dir_output;
707 $trackid = 'evaluation'.$object->id;
708
709 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
710}
711
712// End of page
713llxFooter();
714$db->close();
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.
Definition wrapper.php:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class for Evaluation.
Class to manage standard extra fields.
Class to manage building of HTML components.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage building of HTML components.
Class for Job.
Definition job.class.php:37
Class to manage notifications.
Class for Skill.
static typeCodeToLabel($code)
Class for SkillRank.
Class to manage Dolibarr users.
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
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.
evaluationPrepareHead($object)
Prepare array of tabs for Evaluation.
GetLegendSkills()
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.