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'));
64$socid =
GETPOST(
"socid",
"int");
67if ($user->socid > 0) {
71if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
72 $setupcompanynotcomplete = 1;
75$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
83if (isModEnabled(
'holiday') && !empty($setupcompanynotcomplete)) {
84 $holidaystatic =
new Holiday($db);
85 $result = $holidaystatic->updateBalance();
93$childids = $user->getAllChildIds();
94$childids[] = $user->id;
96$title = $langs->trans(
'HRMArea');
103if (!empty($setupcompanynotcomplete)) {
104 $langs->load(
"errors");
105 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
106 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>';
113print
'<div class="fichecenter"><div class="fichethirdleft">';
115if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
116 if (isModEnabled(
'holiday') && $user->rights->holiday->read) {
117 $langs->load(
"holiday");
118 $listofsearchfields[
'search_holiday'] = array(
'text'=>
'TitreRequestCP');
120 if (isModEnabled(
'deplacement') && $user->rights->deplacement->lire) {
121 $langs->load(
"trips");
122 $listofsearchfields[
'search_deplacement'] = array(
'text'=>
'ExpenseReport');
124 if (isModEnabled(
'expensereport') && $user->rights->expensereport->lire) {
125 $langs->load(
"trips");
126 $listofsearchfields[
'search_expensereport'] = array(
'text'=>
'ExpenseReport');
128 if (count($listofsearchfields)) {
129 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
130 print
'<input type="hidden" name="token" value="'.newToken().
'">';
131 print
'<div class="div-table-responsive-no-min">';
132 print
'<table class="noborder nohover centpercent">';
134 foreach ($listofsearchfields as $key => $value) {
136 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
139 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>';
141 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
154if (isModEnabled(
'holiday')) {
155 if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
156 $holidaystatic =
new Holiday($db);
157 $user_id = $user->id;
159 print
'<div class="div-table-responsive-no-min">';
160 print
'<table class="noborder nohover centpercent">';
161 print
'<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
162 print
'<tr class="oddeven">';
167 $typeleaves = $holidaystatic->getTypes(1, 1);
168 foreach ($typeleaves as $key => $val) {
169 $nb_type = $holidaystatic->getCPforUser($user->id, $val[
'rowid']);
170 $nb_holiday += $nb_type;
171 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
173 $balancetoshow = $langs->trans(
'SoldeCPUser',
'{s1}');
174 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>';
175 print
'<span class="opacitymedium">'.$out.
'</span>';
179 print
'</table></div><br>';
180 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
181 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).
'<br>';
186print
'</div><div class="fichetwothirdright">';
191if (isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
192 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
193 $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";
194 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
195 $sql .=
" WHERE u.rowid = x.fk_user";
196 $sql .=
" AND x.entity = ".$conf->entity;
197 if (empty($user->rights->holiday->readall)) {
198 $sql .=
' AND x.fk_user IN ('.$db->sanitize(join(
',', $childids)).
')';
202 $sql .= $db->order(
"x.tms",
"DESC");
203 $sql .= $db->plimit($max, 0);
205 $result = $db->query($sql);
208 $num = $db->num_rows($result);
210 $holidaystatic =
new Holiday($db);
211 $userstatic =
new User($db);
213 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
214 $typeleaves = $holidaystatic->getTypes(1, -1);
218 print
'<div class="div-table-responsive-no-min">';
219 print
'<table class="noborder centpercent">';
220 print
'<tr class="liste_titre">';
221 print
'<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num)).
'</th>';
222 print
'<th>'.$langs->trans(
"from").
'</th>';
223 print
'<th>'.$langs->trans(
"to").
'</th>';
224 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
227 while ($i < $num && $i < $max) {
228 $obj = $db->fetch_object($result);
230 $holidaystatic->id = $obj->rowid;
231 $holidaystatic->ref = $obj->ref;
232 $holidaystatic->statut = $obj->status;
233 $holidaystatic->date_debut = $db->jdate($obj->date_start);
235 $userstatic->id = $obj->uid;
236 $userstatic->lastname = $obj->lastname;
237 $userstatic->firstname = $obj->firstname;
238 $userstatic->login = $obj->login;
239 $userstatic->photo = $obj->photo;
240 $userstatic->email = $obj->email;
241 $userstatic->statut = $obj->user_status;
242 $userstatic->status = $obj->user_status;
244 print
'<tr class="oddeven">';
245 print
'<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
246 print
'<td class="tdoverflowmax100">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
248 $leavecode = empty($typeleaves[$obj->fk_type]) ?
'Undefined' : $typeleaves[$obj->fk_type][
'code'];
249 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($langs->trans($leavecode)).
'">'.
dol_escape_htmltag($langs->trans($leavecode)).
'</td>';
251 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
252 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
254 print
'<td class="tdoverflowmax125">'.dol_print_date($db->jdate($obj->date_start),
'day').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
255 print
'<td class="tdoverflowmax125">'.dol_print_date($db->jdate($obj->date_end),
'day').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
256 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'day').
'</td>';
257 print
'<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).
'</td>';
263 print
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
275if (isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'read')) {
276 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,";
277 $sql .=
" x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
278 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
280 $sql .=
" WHERE u.rowid = x.fk_user_author";
281 $sql .=
" AND x.entity = ".$conf->entity;
282 if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) {
283 $sql .=
' AND x.fk_user_author IN ('.$db->sanitize(join(
',', $childids)).
')';
287 $sql .= $db->order(
"x.tms",
"DESC");
288 $sql .= $db->plimit($max, 0);
290 $result = $db->query($sql);
292 $num = $db->num_rows($result);
296 print
'<div class="div-table-responsive-no-min">';
297 print
'<table class="noborder centpercent">';
298 print
'<tr class="liste_titre">';
299 print
'<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num)).
'</th>';
300 print
'<th class="right">'.$langs->trans(
"TotalTTC").
'</th>';
301 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
304 $total_ttc = $totalam = $total = 0;
307 $userstatic =
new User($db);
308 while ($i < $num && $i < $max) {
309 $obj = $db->fetch_object($result);
311 $expensereportstatic->id = $obj->rowid;
312 $expensereportstatic->ref = $obj->ref;
313 $expensereportstatic->statut = $obj->status;
314 $expensereportstatic->status = $obj->status;
316 $userstatic->id = $obj->uid;
317 $userstatic->lastname = $obj->lastname;
318 $userstatic->firstname = $obj->firstname;
319 $userstatic->email = $obj->email;
320 $userstatic->login = $obj->login;
321 $userstatic->statut = $obj->user_status;
322 $userstatic->photo = $obj->photo;
324 print
'<tr class="oddeven">';
325 print
'<td class="tdoverflowmax200">'.$expensereportstatic->getNomUrl(1).
'</td>';
326 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
327 print
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
328 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'day').
'</td>';
329 print
'<td class="right nowraponall" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
335 print
'<tr class="oddeven"><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
347if (isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
350 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
351 $sql.=
" rp.rowid as jobid, rp.ref as jobref, rp.label";
352 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
353 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
354 if (isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
355 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
357 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).
")";
358 if (isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
359 $sql .=
" AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
362 $sql .=
" AND rp.fk_soc = $socid";
364 $sql .= $db->order(
"rc.tms",
"DESC");
365 $sql .= $db->plimit($max, 0);
367 $resql = $db->query($sql);
369 $num = $db->num_rows($resql);
372 print
'<div class="div-table-responsive-no-min">';
373 print
'<table class="noborder centpercent">';
374 print
'<tr class="liste_titre">';
375 print
'<th colspan="3">';
376 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", min($max, $num));
378 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
382 $objp = $db->fetch_object($resql);
383 $staticrecruitmentcandidature->id = $objp->rowid;
384 $staticrecruitmentcandidature->ref = $objp->ref;
385 $staticrecruitmentcandidature->email = $objp->email;
386 $staticrecruitmentcandidature->status = $objp->status;
387 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
388 $staticrecruitmentcandidature->firstname = $objp->firstname;
389 $staticrecruitmentcandidature->lastname = $objp->lastname;
391 $staticrecruitmentjobposition->id = $objp->jobid;
392 $staticrecruitmentjobposition->ref = $objp->jobref;
393 $staticrecruitmentjobposition->label = $objp->label;
395 print
'<tr class="oddeven">';
396 print
'<td class="nowraponall">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
397 print
'<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).
'</td>';
398 print
'<td class="nowraponall">'.$staticrecruitmentjobposition->getNomUrl(1).
'</td>';
399 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
'</td>';
400 print
'<td class="right nowrap" width="16">';
401 print $staticrecruitmentcandidature->getLibStatut(3);
409 print
'<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
422$parameters = array(
'user' => $user);
423$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($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.