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';
41if (isModEnabled(
'deplacement')) {
42 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
44if (isModEnabled(
'expensereport')) {
45 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
47if (isModEnabled(
'recruitment')) {
48 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
51if (isModEnabled(
'holiday')) {
52 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
59$hookmanager->initHooks(array(
'hrmindex'));
62$langs->loadLangs(array(
'users',
'holiday',
'trips',
'boxes'));
68if ($user->socid > 0) {
73 $setupcompanynotcomplete = 1;
84if (isModEnabled(
'holiday') && !empty($setupcompanynotcomplete)) {
85 $holidaystatic =
new Holiday($db);
86 $result = $holidaystatic->updateBalance();
94$listofsearchfields = array();
96$childids = $user->getAllChildIds();
97$childids[] = $user->id;
99$title = $langs->trans(
'HRMArea');
106if (!empty($setupcompanynotcomplete)) {
107 $langs->load(
"errors");
108 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
109 print
'<br><div class="warning"><a href="'.DOL_URL_ROOT.
'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ?
'' :
'&action=edit&token='.newToken()).
'">'.$warnpicto.
' '.$langs->trans(
"WarningMandatorySetupNotComplete").
'</a></div>';
116print
'<div class="fichecenter">';
118print
'<div class="twocolumns">';
120print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
124 if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
125 $langs->load(
"holiday");
126 $listofsearchfields[
'search_holiday'] = array(
'text' =>
'TitreRequestCP');
128 if (isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')) {
129 $langs->load(
"trips");
130 $listofsearchfields[
'search_deplacement'] = array(
'text' =>
'ExpenseReport');
132 if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
133 $langs->load(
"trips");
134 $listofsearchfields[
'search_expensereport'] = array(
'text' =>
'ExpenseReport');
136 if (count($listofsearchfields)) {
137 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
138 print
'<input type="hidden" name="token" value="'.newToken().
'">';
139 print
'<div class="div-table-responsive-no-min">';
140 print
'<table class="noborder nohover centpercent">';
142 foreach ($listofsearchfields as $key => $value) {
144 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
147 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>';
149 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
162if (isModEnabled(
'holiday')) {
164 $holidaystatic =
new Holiday($db);
165 $user_id = $user->id;
167 print
'<div class="div-table-responsive-no-min">';
168 print
'<table class="noborder nohover centpercent">';
169 print
'<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
170 print
'<tr class="oddeven nohover">';
175 $typeleaves = $holidaystatic->getTypes(1, 1);
176 foreach ($typeleaves as $key => $val) {
177 $nb_type = $holidaystatic->getCPforUser($user->id, $val[
'rowid']);
178 $nb_holiday += $nb_type;
179 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
181 $balancetoshow = $langs->trans(
'SoldeCPUser',
'{s1}');
182 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>';
183 print
'<span class="opacitymedium">'.$out.
'</span>';
187 print
'</table></div><br>';
194print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
198if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
199 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.gender, u.statut as user_status,";
200 $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";
201 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
202 $sql .=
" WHERE u.rowid = x.fk_user";
203 $sql .=
" AND x.entity = ".$conf->entity;
204 if (!$user->hasRight(
'holiday',
'readall')) {
205 $sql .=
' AND x.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
209 $sql .= $db->order(
"x.tms",
"DESC");
210 $sql .= $db->plimit($max, 0);
212 $result = $db->query($sql);
215 $num = $db->num_rows($result);
217 $holidaystatic =
new Holiday($db);
218 $userstatic =
new User($db);
220 $listhalfday = array(
221 'morning' => $langs->trans(
"Morning"),
222 'morningshort' => $langs->trans(
"Morning"),
223 "afternoon" => $langs->trans(
"Afternoon"),
224 "afternoonshort" => $langs->trans(
"Afternoon")
227 $typeleaves = $holidaystatic->getTypes(1, -1);
231 print
'<div class="div-table-responsive-no-min">';
232 print
'<table class="noborder centpercent">';
233 print
'<tr class="liste_titre">';
234 print
'<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num));
235 print
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
236 print
'<span class="badge marginleftonlyshort">...</span>';
242 print
'<th class="right">';
247 while ($i < $num && $i < $max) {
248 $obj = $db->fetch_object($result);
250 $holidaystatic->id = $obj->rowid;
251 $holidaystatic->ref = $obj->ref;
252 $holidaystatic->status = $obj->status;
253 $holidaystatic->date_debut = $db->jdate($obj->date_start);
255 $userstatic->id = $obj->uid;
256 $userstatic->lastname = $obj->lastname;
257 $userstatic->firstname = $obj->firstname;
258 $userstatic->login = $obj->login;
259 $userstatic->photo = $obj->photo;
260 $userstatic->email = $obj->email;
261 $userstatic->gender = $obj->gender;
262 $userstatic->status = $obj->user_status;
264 print
'<tr class="oddeven">';
265 print
'<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
266 print
'<td class="tdoverflowmax100">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
268 $leavecode = empty($typeleaves[$obj->fk_type]) ?
'Undefined' : $typeleaves[$obj->fk_type][
'code'];
269 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($langs->trans($leavecode)).
'">'.
dol_escape_htmltag($langs->trans($leavecode)).
'</td>';
271 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
272 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
274 print
'<td class="tdoverflowmax125 center lineheightsmall">'.dol_print_date($db->jdate($obj->date_start),
'dayreduceformat');
275 print
'<br><span class="opacitymedium small" title="'.dolPrintHTML($langs->trans($listhalfday[$starthalfday])).
'">';
276 $labelshort = $langs->trans($listhalfday[$starthalfday.
'short']) != $listhalfday[$starthalfday.
'short'] ? $langs->trans($listhalfday[$starthalfday.
'short']) : $langs->trans($listhalfday[$starthalfday]);
279 print
'<td class="tdoverflowmax125 center lineheightsmall">'.dol_print_date($db->jdate($obj->date_end),
'dayreduceformat');
280 print
'<br><span class="opacitymedium small" title="'.dolPrintHTML($langs->trans($listhalfday[$endhalfday])).
'">';
281 $labelshort = $langs->trans($listhalfday[$endhalfday.
'short']) != $listhalfday[$endhalfday.
'short'] ? $langs->trans($listhalfday[$endhalfday.
'short']) : $langs->trans($listhalfday[$starthalfday]);
284 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>';
285 print
'<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).
'</td>';
291 print
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
303if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'read')) {
304 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo, u.gender,";
305 $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";
306 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
308 $sql .=
" WHERE u.rowid = x.fk_user_author";
309 $sql .=
" AND x.entity = ".$conf->entity;
310 if (!$user->hasRight(
'expensereport',
'readall') && !$user->hasRight(
'expensereport',
'lire_tous')) {
311 $sql .=
' AND x.fk_user_author IN ('.$db->sanitize(implode(
',', $childids)).
')';
315 $sql .= $db->order(
"x.tms",
"DESC");
316 $sql .= $db->plimit($max, 0);
318 $result = $db->query($sql);
320 $num = $db->num_rows($result);
324 print
'<div class="div-table-responsive-no-min">';
325 print
'<table class="noborder centpercent">';
326 print
'<tr class="liste_titre">';
327 print
'<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num));
328 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
329 print
'<span class="badge marginleftonlyshort">...</span>';
333 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
334 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
336 print
'<th class="right">';
342 $userstatic =
new User($db);
343 while ($i < $num && $i < $max) {
344 $obj = $db->fetch_object($result);
346 $expensereportstatic->id = $obj->rowid;
347 $expensereportstatic->ref = $obj->ref;
348 $expensereportstatic->statut = $obj->status;
349 $expensereportstatic->status = $obj->status;
351 $userstatic->id = $obj->uid;
352 $userstatic->lastname = $obj->lastname;
353 $userstatic->firstname = $obj->firstname;
354 $userstatic->email = $obj->email;
355 $userstatic->login = $obj->login;
356 $userstatic->status = $obj->user_status;
357 $userstatic->gender = $obj->gender;
358 $userstatic->photo = $obj->photo;
360 print
'<tr class="oddeven">';
361 print
'<td class="tdoverflowmax200">'.$expensereportstatic->getNomUrl(1).
'</td>';
362 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
363 print
'<td class="right amount">'.price($obj->total_ht).
'</td>';
364 print
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
365 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'dayreduceformat').
'</td>';
366 print
'<td class="right nowraponall" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
372 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
384if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
387 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
388 $sql .=
" rp.rowid as jobid, rp.ref as jobref, rp.label";
389 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
390 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
391 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
392 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
394 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).
")";
395 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
396 $sql .=
" AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
399 $sql .=
" AND rp.fk_soc = $socid";
401 $sql .= $db->order(
"rc.tms",
"DESC");
402 $sql .= $db->plimit($max, 0);
404 $resql = $db->query($sql);
406 $num = $db->num_rows($resql);
409 print
'<div class="div-table-responsive-no-min">';
410 print
'<table class="noborder centpercent">';
411 print
'<tr class="liste_titre">';
412 print
'<th colspan="3">';
413 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", min($max, $num));
414 print
'<a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
415 print
'<span class="badge marginleftonlyshort">...</span>';
420 print
'<th class="right">';
425 $objp = $db->fetch_object($resql);
426 $staticrecruitmentcandidature->id = $objp->rowid;
427 $staticrecruitmentcandidature->ref = $objp->ref;
428 $staticrecruitmentcandidature->email = $objp->email;
429 $staticrecruitmentcandidature->status = $objp->status;
430 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
431 $staticrecruitmentcandidature->firstname = $objp->firstname;
432 $staticrecruitmentcandidature->lastname = $objp->lastname;
434 $staticrecruitmentjobposition->id = $objp->jobid;
435 $staticrecruitmentjobposition->ref = $objp->jobref;
436 $staticrecruitmentjobposition->label = $objp->label;
438 print
'<tr class="oddeven">';
439 print
'<td class="nowraponall">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
440 print
'<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).
'</td>';
441 print
'<td class="nowraponall">'.$staticrecruitmentjobposition->getNomUrl(1).
'</td>';
442 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'dayreduceformat').
'</td>';
443 print
'<td class="right nowrap" width="16">';
444 print $staticrecruitmentcandidature->getLibStatut(3);
452 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
462print
'</div></div></div>';
465$parameters = array(
'user' => $user);
466$reshook = $hookmanager->executeHooks(
'dashboardHRM', $parameters, $object);
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.