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';
65$langs->loadLangs(array(
'users',
'holiday',
'trips',
'boxes'));
70$hookmanager->initHooks(array(
'hrmindex'));
76if ($user->socid > 0) {
81 $setupcompanynotcomplete = 1;
92if (isModEnabled(
'holiday') && !empty($setupcompanynotcomplete)) {
93 $holidaystatic =
new Holiday($db);
94 $result = $holidaystatic->updateBalance();
102$listofsearchfields = array();
104$childids = $user->getAllChildIds();
105$childids[] = $user->id;
107$title = $langs->trans(
'HRMArea');
114if (!empty($setupcompanynotcomplete)) {
115 $langs->load(
"errors");
116 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
117 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>';
124print
'<div class="fichecenter">';
126print
'<div class="twocolumns">';
128print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
132 if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
133 $langs->load(
"holiday");
134 $listofsearchfields[
'search_holiday'] = array(
'text' =>
'TitreRequestCP');
136 if (isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')) {
137 $langs->load(
"trips");
138 $listofsearchfields[
'search_deplacement'] = array(
'text' =>
'ExpenseReport');
140 if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
141 $langs->load(
"trips");
142 $listofsearchfields[
'search_expensereport'] = array(
'text' =>
'ExpenseReport');
144 if (count($listofsearchfields)) {
145 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
146 print
'<input type="hidden" name="token" value="'.newToken().
'">';
147 print
'<div class="div-table-responsive-no-min">';
148 print
'<table class="noborder nohover centpercent">';
150 foreach ($listofsearchfields as $key => $value) {
152 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
155 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>';
157 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
170if (isModEnabled(
'holiday')) {
172 $holidaystatic =
new Holiday($db);
173 $user_id = $user->id;
175 print
'<div class="div-table-responsive-no-min">';
176 print
'<table class="noborder nohover centpercent">';
177 print
'<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
178 print
'<tr class="oddeven nohover">';
183 $typeleaves = $holidaystatic->getTypes(1, 1);
184 foreach ($typeleaves as $key => $val) {
185 $nb_type = $holidaystatic->getCPforUser($user->id, $val[
'rowid']);
186 $nb_holiday += $nb_type;
187 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
189 $balancetoshow = $langs->trans(
'SoldeCPUser',
'{s1}');
190 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>';
191 print
'<span class="opacitymedium">'.$out.
'</span>';
195 print
'</table></div><br>';
202print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
206if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
207 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.gender, u.statut as user_status,";
208 $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";
209 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
210 $sql .=
" WHERE u.rowid = x.fk_user";
211 $sql .=
" AND x.entity = ".$conf->entity;
212 if (!$user->hasRight(
'holiday',
'readall')) {
213 $sql .=
' AND x.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
217 $sql .= $db->order(
"x.tms",
"DESC");
218 $sql .= $db->plimit($max, 0);
220 $result = $db->query($sql);
223 $num = $db->num_rows($result);
225 $holidaystatic =
new Holiday($db);
226 $userstatic =
new User($db);
228 $listhalfday = array(
229 'morning' => $langs->trans(
"Morning"),
230 'morningshort' => $langs->trans(
"Morning"),
231 "afternoon" => $langs->trans(
"Afternoon"),
232 "afternoonshort" => $langs->trans(
"Afternoon")
235 $typeleaves = $holidaystatic->getTypes(1, -1);
239 print
'<div class="div-table-responsive-no-min">';
240 print
'<table class="noborder centpercent">';
241 print
'<tr class="liste_titre">';
242 print
'<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num));
243 print
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
244 print
'<span class="badge marginleftonlyshort">...</span>';
250 print
'<th class="right">';
255 while ($i < $num && $i < $max) {
256 $obj = $db->fetch_object($result);
258 $holidaystatic->id = $obj->rowid;
259 $holidaystatic->ref = $obj->ref;
260 $holidaystatic->status = $obj->status;
261 $holidaystatic->date_debut = $db->jdate($obj->date_start);
263 $userstatic->id = $obj->uid;
264 $userstatic->lastname = $obj->lastname;
265 $userstatic->firstname = $obj->firstname;
266 $userstatic->login = $obj->login;
267 $userstatic->photo = $obj->photo;
268 $userstatic->email = $obj->email;
269 $userstatic->gender = $obj->gender;
270 $userstatic->status = $obj->user_status;
272 print
'<tr class="oddeven">';
273 print
'<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
274 print
'<td class="tdoverflowmax100">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
276 $leavecode = empty($typeleaves[$obj->fk_type]) ?
'Undefined' : $typeleaves[$obj->fk_type][
'code'];
277 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($langs->trans($leavecode)).
'">'.
dol_escape_htmltag($langs->trans($leavecode)).
'</td>';
279 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
280 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
282 print
'<td class="tdoverflowmax125 center lineheightsmall">'.dol_print_date($db->jdate($obj->date_start),
'dayreduceformat');
283 print
'<br><span class="opacitymedium small" title="'.dolPrintHTML($langs->trans($listhalfday[$starthalfday])).
'">';
284 $labelshort = $langs->trans($listhalfday[$starthalfday.
'short']) != $listhalfday[$starthalfday.
'short'] ? $langs->trans($listhalfday[$starthalfday.
'short']) : $langs->trans($listhalfday[$starthalfday]);
287 print
'<td class="tdoverflowmax125 center lineheightsmall">'.dol_print_date($db->jdate($obj->date_end),
'dayreduceformat');
288 print
'<br><span class="opacitymedium small" title="'.dolPrintHTML($langs->trans($listhalfday[$endhalfday])).
'">';
289 $labelshort = $langs->trans($listhalfday[$endhalfday.
'short']) != $listhalfday[$endhalfday.
'short'] ? $langs->trans($listhalfday[$endhalfday.
'short']) : $langs->trans($listhalfday[$starthalfday]);
292 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>';
293 print
'<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).
'</td>';
299 print
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
311if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'read')) {
312 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo, u.gender,";
313 $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";
314 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
316 $sql .=
" WHERE u.rowid = x.fk_user_author";
317 $sql .=
" AND x.entity = ".$conf->entity;
318 if (!$user->hasRight(
'expensereport',
'readall') && !$user->hasRight(
'expensereport',
'lire_tous')) {
319 $sql .=
' AND x.fk_user_author IN ('.$db->sanitize(implode(
',', $childids)).
')';
323 $sql .= $db->order(
"x.tms",
"DESC");
324 $sql .= $db->plimit($max, 0);
326 $result = $db->query($sql);
328 $num = $db->num_rows($result);
332 print
'<div class="div-table-responsive-no-min">';
333 print
'<table class="noborder centpercent">';
334 print
'<tr class="liste_titre">';
335 print
'<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num));
336 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
337 print
'<span class="badge marginleftonlyshort">...</span>';
341 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
342 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
344 print
'<th class="right">';
350 $userstatic =
new User($db);
351 while ($i < $num && $i < $max) {
352 $obj = $db->fetch_object($result);
354 $expensereportstatic->id = $obj->rowid;
355 $expensereportstatic->ref = $obj->ref;
356 $expensereportstatic->statut = $obj->status;
357 $expensereportstatic->status = $obj->status;
359 $userstatic->id = $obj->uid;
360 $userstatic->lastname = $obj->lastname;
361 $userstatic->firstname = $obj->firstname;
362 $userstatic->email = $obj->email;
363 $userstatic->login = $obj->login;
364 $userstatic->status = $obj->user_status;
365 $userstatic->gender = $obj->gender;
366 $userstatic->photo = $obj->photo;
368 print
'<tr class="oddeven">';
369 print
'<td class="tdoverflowmax200">'.$expensereportstatic->getNomUrl(1).
'</td>';
370 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
371 print
'<td class="right amount">'.price($obj->total_ht).
'</td>';
372 print
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
373 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'dayreduceformat').
'</td>';
374 print
'<td class="right nowraponall" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
380 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
392if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
395 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
396 $sql .=
" rp.rowid as jobid, rp.ref as jobref, rp.label";
397 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
398 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
399 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
400 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
402 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).
")";
403 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
404 $sql .=
" AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
407 $sql .=
" AND rp.fk_soc = $socid";
409 $sql .= $db->order(
"rc.tms",
"DESC");
410 $sql .= $db->plimit($max, 0);
412 $resql = $db->query($sql);
414 $num = $db->num_rows($resql);
417 print
'<div class="div-table-responsive-no-min">';
418 print
'<table class="noborder centpercent">';
419 print
'<tr class="liste_titre">';
420 print
'<th colspan="3">';
421 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", min($max, $num));
422 print
'<a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
423 print
'<span class="badge marginleftonlyshort">...</span>';
428 print
'<th class="right">';
433 $objp = $db->fetch_object($resql);
434 $staticrecruitmentcandidature->id = $objp->rowid;
435 $staticrecruitmentcandidature->ref = $objp->ref;
436 $staticrecruitmentcandidature->email = $objp->email;
437 $staticrecruitmentcandidature->status = $objp->status;
438 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
439 $staticrecruitmentcandidature->firstname = $objp->firstname;
440 $staticrecruitmentcandidature->lastname = $objp->lastname;
442 $staticrecruitmentjobposition->id = $objp->jobid;
443 $staticrecruitmentjobposition->ref = $objp->jobref;
444 $staticrecruitmentjobposition->label = $objp->label;
446 print
'<tr class="oddeven">';
447 print
'<td class="nowraponall">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
448 print
'<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).
'</td>';
449 print
'<td class="nowraponall">'.$staticrecruitmentjobposition->getNomUrl(1).
'</td>';
450 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'dayreduceformat').
'</td>';
451 print
'<td class="right nowrap" width="16">';
452 print $staticrecruitmentcandidature->getLibStatut(3);
460 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
470print
'</div></div></div>';
473$parameters = array(
'user' => $user);
474$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.