31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
40if (isModEnabled(
'deplacement')) {
41 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
43if (isModEnabled(
'expensereport')) {
44 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
46if (isModEnabled(
'recruitment')) {
47 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
50if (isModEnabled(
'holiday')) {
51 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
58$hookmanager->initHooks(
'hrmindex');
61$langs->loadLangs(array(
'users',
'holiday',
'trips',
'boxes'));
67if ($user->socid > 0) {
72 $setupcompanynotcomplete = 1;
83if (isModEnabled(
'holiday') && !empty($setupcompanynotcomplete)) {
84 $holidaystatic =
new Holiday($db);
85 $result = $holidaystatic->updateBalance();
93$listofsearchfields = array();
95$childids = $user->getAllChildIds();
96$childids[] = $user->id;
98$title = $langs->trans(
'HRMArea');
105if (!empty($setupcompanynotcomplete)) {
106 $langs->load(
"errors");
107 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
108 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>';
115print
'<div class="fichecenter">';
117print
'<div class="twocolumns">';
119print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
123 if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
124 $langs->load(
"holiday");
125 $listofsearchfields[
'search_holiday'] = array(
'text'=>
'TitreRequestCP');
127 if (isModEnabled(
'deplacement') && $user->hasRight(
'deplacement',
'lire')) {
128 $langs->load(
"trips");
129 $listofsearchfields[
'search_deplacement'] = array(
'text'=>
'ExpenseReport');
131 if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'lire')) {
132 $langs->load(
"trips");
133 $listofsearchfields[
'search_expensereport'] = array(
'text'=>
'ExpenseReport');
135 if (count($listofsearchfields)) {
136 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
137 print
'<input type="hidden" name="token" value="'.newToken().
'">';
138 print
'<div class="div-table-responsive-no-min">';
139 print
'<table class="noborder nohover centpercent">';
141 foreach ($listofsearchfields as $key => $value) {
143 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
146 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>';
148 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
161if (isModEnabled(
'holiday')) {
163 $holidaystatic =
new Holiday($db);
164 $user_id = $user->id;
166 print
'<div class="div-table-responsive-no-min">';
167 print
'<table class="noborder nohover centpercent">';
168 print
'<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
169 print
'<tr class="oddeven">';
174 $typeleaves = $holidaystatic->getTypes(1, 1);
175 foreach ($typeleaves as $key => $val) {
176 $nb_type = $holidaystatic->getCPforUser($user->id, $val[
'rowid']);
177 $nb_holiday += $nb_type;
178 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
180 $balancetoshow = $langs->trans(
'SoldeCPUser',
'{s1}');
181 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>';
182 print
'<span class="opacitymedium">'.$out.
'</span>';
186 print
'</table></div><br>';
193print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
197if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
198 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
199 $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";
200 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
201 $sql .=
" WHERE u.rowid = x.fk_user";
202 $sql .=
" AND x.entity = ".$conf->entity;
203 if (!$user->hasRight(
'holiday',
'readall')) {
204 $sql .=
' AND x.fk_user IN ('.$db->sanitize(implode(
',', $childids)).
')';
208 $sql .= $db->order(
"x.tms",
"DESC");
209 $sql .= $db->plimit($max, 0);
211 $result = $db->query($sql);
214 $num = $db->num_rows($result);
216 $holidaystatic =
new Holiday($db);
217 $userstatic =
new User($db);
219 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
220 $typeleaves = $holidaystatic->getTypes(1, -1);
224 print
'<div class="div-table-responsive-no-min">';
225 print
'<table class="noborder centpercent">';
226 print
'<tr class="liste_titre">';
227 print
'<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num));
228 print
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
229 print
'<span class="badge marginleftonlyshort">...</span>';
235 print
'<th class="right">';
240 while ($i < $num && $i < $max) {
241 $obj = $db->fetch_object($result);
243 $holidaystatic->id = $obj->rowid;
244 $holidaystatic->ref = $obj->ref;
245 $holidaystatic->statut = $obj->status;
246 $holidaystatic->date_debut = $db->jdate($obj->date_start);
248 $userstatic->id = $obj->uid;
249 $userstatic->lastname = $obj->lastname;
250 $userstatic->firstname = $obj->firstname;
251 $userstatic->login = $obj->login;
252 $userstatic->photo = $obj->photo;
253 $userstatic->email = $obj->email;
254 $userstatic->statut = $obj->user_status;
255 $userstatic->status = $obj->user_status;
257 print
'<tr class="oddeven">';
258 print
'<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
259 print
'<td class="tdoverflowmax100">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
261 $leavecode = empty($typeleaves[$obj->fk_type]) ?
'Undefined' : $typeleaves[$obj->fk_type][
'code'];
262 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($langs->trans($leavecode)).
'">'.
dol_escape_htmltag($langs->trans($leavecode)).
'</td>';
264 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
265 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
267 print
'<td class="tdoverflowmax125">'.dol_print_date($db->jdate($obj->date_start),
'dayreduceformat').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
268 print
'<td class="tdoverflowmax125">'.dol_print_date($db->jdate($obj->date_end),
'dayreduceformat').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
269 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'dayreduceformat').
'</td>';
270 print
'<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).
'</td>';
276 print
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
288if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'read')) {
289 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,";
290 $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";
291 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
293 $sql .=
" WHERE u.rowid = x.fk_user_author";
294 $sql .=
" AND x.entity = ".$conf->entity;
295 if (!$user->hasRight(
'expensereport',
'readall') && !$user->hasRight(
'expensereport',
'lire_tous')) {
296 $sql .=
' AND x.fk_user_author IN ('.$db->sanitize(implode(
',', $childids)).
')';
300 $sql .= $db->order(
"x.tms",
"DESC");
301 $sql .= $db->plimit($max, 0);
303 $result = $db->query($sql);
305 $num = $db->num_rows($result);
309 print
'<div class="div-table-responsive-no-min">';
310 print
'<table class="noborder centpercent">';
311 print
'<tr class="liste_titre">';
312 print
'<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num));
313 print
'<a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
314 print
'<span class="badge marginleftonlyshort">...</span>';
318 print
'<th class="right">'.$langs->trans(
"AmountHT").
'</th>';
319 print
'<th class="right">'.$langs->trans(
"AmountTTC").
'</th>';
321 print
'<th class="right">';
327 $userstatic =
new User($db);
328 while ($i < $num && $i < $max) {
329 $obj = $db->fetch_object($result);
331 $expensereportstatic->id = $obj->rowid;
332 $expensereportstatic->ref = $obj->ref;
333 $expensereportstatic->statut = $obj->status;
334 $expensereportstatic->status = $obj->status;
336 $userstatic->id = $obj->uid;
337 $userstatic->lastname = $obj->lastname;
338 $userstatic->firstname = $obj->firstname;
339 $userstatic->email = $obj->email;
340 $userstatic->login = $obj->login;
341 $userstatic->status = $obj->user_status;
342 $userstatic->photo = $obj->photo;
344 print
'<tr class="oddeven">';
345 print
'<td class="tdoverflowmax200">'.$expensereportstatic->getNomUrl(1).
'</td>';
346 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
347 print
'<td class="right amount">'.price($obj->total_ht).
'</td>';
348 print
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
349 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'dayreduceformat').
'</td>';
350 print
'<td class="right nowraponall" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
356 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
368if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
371 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
372 $sql.=
" rp.rowid as jobid, rp.ref as jobref, rp.label";
373 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
374 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
375 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
376 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
378 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).
")";
379 if (isModEnabled(
'societe') && !$user->hasRight(
'societe',
'client',
'voir') && !$socid) {
380 $sql .=
" AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
383 $sql .=
" AND rp.fk_soc = $socid";
385 $sql .= $db->order(
"rc.tms",
"DESC");
386 $sql .= $db->plimit($max, 0);
388 $resql = $db->query($sql);
390 $num = $db->num_rows($resql);
393 print
'<div class="div-table-responsive-no-min">';
394 print
'<table class="noborder centpercent">';
395 print
'<tr class="liste_titre">';
396 print
'<th colspan="3">';
397 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", min($max, $num));
398 print
'<a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
399 print
'<span class="badge marginleftonlyshort">...</span>';
404 print
'<th class="right">';
409 $objp = $db->fetch_object($resql);
410 $staticrecruitmentcandidature->id = $objp->rowid;
411 $staticrecruitmentcandidature->ref = $objp->ref;
412 $staticrecruitmentcandidature->email = $objp->email;
413 $staticrecruitmentcandidature->status = $objp->status;
414 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
415 $staticrecruitmentcandidature->firstname = $objp->firstname;
416 $staticrecruitmentcandidature->lastname = $objp->lastname;
418 $staticrecruitmentjobposition->id = $objp->jobid;
419 $staticrecruitmentjobposition->ref = $objp->jobref;
420 $staticrecruitmentjobposition->label = $objp->label;
422 print
'<tr class="oddeven">';
423 print
'<td class="nowraponall">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
424 print
'<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).
'</td>';
425 print
'<td class="nowraponall">'.$staticrecruitmentjobposition->getNomUrl(1).
'</td>';
426 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'dayreduceformat').
'</td>';
427 print
'<td class="right nowrap" width="16">';
428 print $staticrecruitmentcandidature->getLibStatut(3);
436 print
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
446print
'</div></div></div>';
449$parameters = array(
'user' => $user);
450$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()
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_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 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.