32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
65$langs->loadLangs(array(
'users',
'holiday',
'trips',
'boxes'));
70$hookmanager->initHooks(array(
'hrmindex'));
76if ($user->socid > 0) {
81 $setupcompanynotcomplete = 1;
83 $setupcompanynotcomplete = 0;
94if (
isModEnabled(
'holiday') && !empty($setupcompanynotcomplete)) {
95 $holidaystatic =
new Holiday($db);
96 $result = $holidaystatic->updateBalance();
104$listofsearchfields = array();
106$childids = $user->getAllChildIds();
107$childids[] = $user->id;
109$title = $langs->trans(
'HRMArea');
116if (!empty($setupcompanynotcomplete)) {
117 $langs->load(
"errors");
118 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
119 print
'<br><div class="warning"><a href="'.DOL_URL_ROOT.
'/admin/company.php?mainmenu=home&action=edit&token='.
newToken().
'">'.$warnpicto.
' '.$langs->trans(
"WarningMandatorySetupNotComplete").
'</a></div>';
126print
'<div class="fichecenter">';
128print
'<div class="twocolumns">';
130print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
134 if (
isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
135 $langs->load(
"holiday");
136 $listofsearchfields[
'search_holiday'] = array(
'text' =>
'TitreRequestCP');
138 if (
isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')) {
139 $langs->load(
"trips");
140 $listofsearchfields[
'search_deplacement'] = array(
'text' =>
'ExpenseReport');
142 if (
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
143 $langs->load(
"trips");
144 $listofsearchfields[
'search_expensereport'] = array(
'text' =>
'ExpenseReport');
146 if (count($listofsearchfields)) {
147 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
148 print
'<input type="hidden" name="token" value="'.newToken().
'">';
149 print
'<div class="div-table-responsive-no-min">';
150 print
'<table class="noborder nohover centpercent">';
152 foreach ($listofsearchfields as $key => $value) {
154 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
157 print
'<td class="nowrap"><label for="'.$key.
'">'.$langs->trans($value[
"text"]).
'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.
'" id="'.$key.
'" size="18"></td>';
159 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
174 $holidaystatic =
new Holiday($db);
175 $user_id = $user->id;
177 print
'<div class="div-table-responsive-no-min">';
178 print
'<table class="noborder nohover centpercent">';
179 print
'<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
180 print
'<tr class="oddeven nohover">';
185 $typeleaves = $holidaystatic->getTypes(1, 1);
186 foreach ($typeleaves as $key => $val) {
187 $nb_type = $holidaystatic->getCPforUser($user->id, $val[
'rowid']);
188 $nb_holiday += $nb_type;
189 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
191 $balancetoshow = $langs->trans(
'SoldeCPUser',
'{s1}');
192 print
'<div class="valignmiddle div-balanceofleave">'.str_replace(
'{s1}',
img_picto(
'',
'holiday',
'class="paddingleft pictofixedwidth"').
'<span class="balanceofleave valignmiddle'.($nb_holiday > 0 ?
' amountpaymentcomplete' : ($nb_holiday < 0 ?
' amountremaintopay' :
' amountpaymentneutral')).
'">'.round($nb_holiday, 5).
'</span>', $balancetoshow).
'</div>';
193 print
'<span class="opacitymedium">'.$out.
'</span>';
197 print
'</table></div><br>';
204print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
208if (
isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
209 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.gender, u.statut as user_status,";
210 $sql .=
" x.rowid, x.ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
211 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
212 $sql .=
" WHERE u.rowid = x.fk_user";
213 $sql .=
" AND x.entity = ".$conf->entity;
214 if (!$user->hasRight(
'holiday',
'readall')) {
215 $sql .=
' AND x.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
219 $sql .= $db->order(
"x.tms",
"DESC");
220 $sql .= $db->plimit($max, 0);
222 $result = $db->query($sql);
225 $num = $db->num_rows($result);
227 $holidaystatic =
new Holiday($db);
228 $userstatic =
new User($db);
230 $listhalfday = array(
231 'morning' => $langs->trans(
"Morning"),
232 'morningshort' => $langs->trans(
"Morning"),
233 "afternoon" => $langs->trans(
"Afternoon"),
234 "afternoonshort" => $langs->trans(
"Afternoon")
237 $typeleaves = $holidaystatic->getTypes(1, -1);
241 print
'<div class="div-table-responsive-no-min">';
242 print
'<table class="noborder centpercent">';
243 print
'<tr class="liste_titre">';
244 print
'<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num));
245 print
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
246 print
'<span class="badge marginleftonlyshort">...</span>';
252 print
'<th class="right">';
257 while ($i < $num && $i < $max) {
258 $obj = $db->fetch_object($result);
260 $holidaystatic->id = $obj->rowid;
261 $holidaystatic->ref = $obj->ref;
262 $holidaystatic->status = $obj->status;
263 $holidaystatic->date_debut = $db->jdate($obj->date_start);
265 $userstatic->id = $obj->uid;
266 $userstatic->lastname = $obj->lastname;
267 $userstatic->firstname = $obj->firstname;
268 $userstatic->login = $obj->login;
269 $userstatic->photo = $obj->photo;
270 $userstatic->email = $obj->email;
271 $userstatic->gender = $obj->gender;
272 $userstatic->status = $obj->user_status;
274 print
'<tr class="oddeven">';
275 print
'<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
276 print
'<td class="tdoverflowmax100">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
278 $leavecode = empty($typeleaves[$obj->fk_type]) ?
'Undefined' : $typeleaves[$obj->fk_type][
'code'];
279 print
'<td class="tdoverflowmax80" title="'.dol_escape_htmltag($langs->trans($leavecode)).
'">'.
dol_escape_htmltag($langs->trans($leavecode)).
'</td>';
281 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
282 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
284 print
'<td class="tdoverflowmax125 center lineheightsmall">'.dol_print_date($db->jdate($obj->date_start),
'dayreduceformat');
285 print
'<br><span class="opacitymedium small" title="'.dolPrintHTML($langs->trans($listhalfday[$starthalfday])).
'">';
286 $labelshort = $langs->trans($listhalfday[$starthalfday.
'short']) != $listhalfday[$starthalfday.
'short'] ? $langs->trans($listhalfday[$starthalfday.
'short']) : $langs->trans($listhalfday[$starthalfday]);
289 print
'<td class="tdoverflowmax125 center lineheightsmall">'.dol_print_date($db->jdate($obj->date_end),
'dayreduceformat');
290 print
'<br><span class="opacitymedium small" title="'.dolPrintHTML($langs->trans($listhalfday[$endhalfday])).
'">';
291 $labelshort = $langs->trans($listhalfday[$endhalfday.
'short']) != $listhalfday[$endhalfday.
'short'] ? $langs->trans($listhalfday[$endhalfday.
'short']) : $langs->trans($listhalfday[$starthalfday]);
294 print
'<td class="right" title="'.$langs->trans(
"DateModification").
': '.
dol_print_date($db->jdate($obj->dm),
'dayhourreduceformat').
'">'.
dol_print_date($db->jdate($obj->dm),
'dayreduceformat').
'</td>';
295 print
'<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).
'</td>';
301 print
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
313if (
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'read')) {
314 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo, u.gender,";
315 $sql .=
" x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ht, x.total_ttc, x.fk_statut as status";
316 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
318 $sql .=
" WHERE u.rowid = x.fk_user_author";
319 $sql .=
" AND x.entity = ".$conf->entity;
320 if (!$user->hasRight(
'expensereport',
'readall') && !$user->hasRight(
'expensereport',
'lire_tous')) {
321 $sql .=
' AND x.fk_user_author IN ('.$db->sanitize(implode(
',', $childids)).
')';
325 $sql .= $db->order(
"x.tms",
"DESC");
326 $sql .= $db->plimit($max, 0);
328 $result = $db->query($sql);
330 $num = $db->num_rows($result);
334 print
'<div class="div-table-responsive-no-min">';
335 print
'<table class="noborder centpercent">';
336 print
'<tr class="liste_titre">';
337 print
'<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num));
338 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
339 print
'<span class="badge marginleftonlyshort">...</span>';
343 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
344 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
346 print
'<th class="right">';
352 $userstatic =
new User($db);
353 while ($i < $num && $i < $max) {
354 $obj = $db->fetch_object($result);
356 $expensereportstatic->id = $obj->rowid;
357 $expensereportstatic->ref = $obj->ref;
358 $expensereportstatic->statut = $obj->status;
359 $expensereportstatic->status = $obj->status;
361 $userstatic->id = $obj->uid;
362 $userstatic->lastname = $obj->lastname;
363 $userstatic->firstname = $obj->firstname;
364 $userstatic->email = $obj->email;
365 $userstatic->login = $obj->login;
366 $userstatic->status = $obj->user_status;
367 $userstatic->gender = $obj->gender;
368 $userstatic->photo = $obj->photo;
370 print
'<tr class="oddeven">';
371 print
'<td class="tdoverflowmax200">'.$expensereportstatic->getNomUrl(1).
'</td>';
372 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
373 print
'<td class="right amount">'.price($obj->total_ht).
'</td>';
374 print
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
375 print
'<td class="right" title="'.$langs->trans(
"DateModification").
': '.
dol_print_date($db->jdate($obj->dm),
'dayhour').
'">'.
dol_print_date($db->jdate($obj->dm),
'dayreduceformat').
'</td>';
376 print
'<td class="right nowraponall" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
382 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
394if (
isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
397 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
398 $sql .=
" rp.rowid as jobid, rp.ref as jobref, rp.label";
399 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
400 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
401 if (
isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
402 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
404 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).
")";
405 if (
isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
406 $sql .=
" AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
409 $sql .=
" AND rp.fk_soc = $socid";
411 $sql .= $db->order(
"rc.tms",
"DESC");
412 $sql .= $db->plimit($max, 0);
414 $resql = $db->query($sql);
416 $num = $db->num_rows($resql);
419 print
'<div class="div-table-responsive-no-min">';
420 print
'<table class="noborder centpercent">';
421 print
'<tr class="liste_titre">';
422 print
'<th colspan="3">';
423 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", min($max, $num));
424 print
'<a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
425 print
'<span class="badge marginleftonlyshort">...</span>';
430 print
'<th class="right">';
435 $objp = $db->fetch_object($resql);
436 $staticrecruitmentcandidature->id = $objp->rowid;
437 $staticrecruitmentcandidature->ref = $objp->ref;
438 $staticrecruitmentcandidature->email = $objp->email;
439 $staticrecruitmentcandidature->status = $objp->status;
440 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
441 $staticrecruitmentcandidature->firstname = $objp->firstname;
442 $staticrecruitmentcandidature->lastname = $objp->lastname;
444 $staticrecruitmentjobposition->id = $objp->jobid;
445 $staticrecruitmentjobposition->ref = $objp->jobref;
446 $staticrecruitmentjobposition->label = $objp->label;
448 print
'<tr class="oddeven">';
449 print
'<td class="nowraponall">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
450 print
'<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).
'</td>';
451 print
'<td class="nowraponall">'.$staticrecruitmentjobposition->getNomUrl(1).
'</td>';
452 print
'<td class="right nowrap" title="'.$langs->trans(
"DateModification").
': '.
dol_print_date($db->jdate($objp->tms),
'dayhour').
'">'.
dol_print_date($db->jdate($objp->tms),
'dayreduceformat').
'</td>';
453 print
'<td class="right nowrap" width="16">';
454 print $staticrecruitmentcandidature->getLibStatut(3);
462 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
472print
'</div></div></div>';
475$parameters = array(
'user' => $user);
476$reshook = $hookmanager->executeHooks(
'dashboardHRM', $parameters, $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 Trips and Expenses.
Class of the module paid holiday.
Class for RecruitmentCandidature.
Class for RecruitmentJobPosition.
Class to manage Dolibarr users.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.