31 require
'../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
57 $hookmanager->initHooks(
'hrmindex');
60 $langs->loadLangs(array(
'users',
'holiday',
'trips',
'boxes'));
63 $socid =
GETPOST(
"socid",
"int");
66 if ($user->socid > 0) {
70 if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
71 $setupcompanynotcomplete = 1;
74 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
82 if (
isModEnabled(
'holiday') && !empty($setupcompanynotcomplete)) {
83 $holidaystatic =
new Holiday($db);
84 $result = $holidaystatic->updateBalance();
92 $childids = $user->getAllChildIds();
93 $childids[] = $user->id;
95 $title = $langs->trans(
'HRMArea');
102 if (!empty($setupcompanynotcomplete)) {
103 $langs->load(
"errors");
104 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
105 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>';
112 print
'<div class="fichecenter"><div class="fichethirdleft">';
114 if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
115 if (
isModEnabled(
'holiday') && $user->rights->holiday->read) {
116 $langs->load(
"holiday");
117 $listofsearchfields[
'search_holiday'] = array(
'text'=>
'TitreRequestCP');
119 if (
isModEnabled(
'deplacement') && $user->rights->deplacement->lire) {
120 $langs->load(
"trips");
121 $listofsearchfields[
'search_deplacement'] = array(
'text'=>
'ExpenseReport');
123 if (
isModEnabled(
'expensereport') && $user->rights->expensereport->lire) {
124 $langs->load(
"trips");
125 $listofsearchfields[
'search_expensereport'] = array(
'text'=>
'ExpenseReport');
127 if (count($listofsearchfields)) {
128 print
'<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
129 print
'<input type="hidden" name="token" value="'.newToken().
'">';
130 print
'<div class="div-table-responsive-no-min">';
131 print
'<table class="noborder nohover centpercent">';
133 foreach ($listofsearchfields as $key => $value) {
135 print
'<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
137 print
'<tr '.$bc[
false].
'>';
138 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>';
140 print
'<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
154 if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
155 $holidaystatic =
new Holiday($db);
156 $user_id = $user->id;
158 print
'<div class="div-table-responsive-no-min">';
159 print
'<table class="noborder nohover centpercent">';
160 print
'<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
161 print
'<tr class="oddeven">';
166 $typeleaves = $holidaystatic->getTypes(1, 1);
167 foreach ($typeleaves as $key => $val) {
168 $nb_type = $holidaystatic->getCPforUser($user->id, $val[
'rowid']);
169 $nb_holiday += $nb_type;
170 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
172 $balancetoshow = $langs->trans(
'SoldeCPUser',
'{s1}');
173 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>';
174 print
'<span class="opacitymedium">'.$out.
'</span>';
178 print
'</table></div><br>';
179 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
180 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).
'<br>';
185 print
'</div><div class="fichetwothirdright">';
190 if (
isModEnabled(
'holiday') && $user->hasRight(
'holiday',
'read')) {
191 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
192 $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";
193 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
194 $sql .=
" WHERE u.rowid = x.fk_user";
195 $sql .=
" AND x.entity = ".$conf->entity;
196 if (empty($user->rights->holiday->readall)) {
197 $sql .=
' AND x.fk_user IN ('.$db->sanitize(join(
',', $childids)).
')';
201 $sql .= $db->order(
"x.tms",
"DESC");
202 $sql .= $db->plimit($max, 0);
204 $result = $db->query($sql);
207 $num = $db->num_rows($result);
209 $holidaystatic =
new Holiday($db);
210 $userstatic =
new User($db);
212 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
213 $typeleaves = $holidaystatic->getTypes(1, -1);
217 print
'<div class="div-table-responsive-no-min">';
218 print
'<table class="noborder centpercent">';
219 print
'<tr class="liste_titre">';
220 print
'<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num)).
'</th>';
221 print
'<th>'.$langs->trans(
"from").
'</th>';
222 print
'<th>'.$langs->trans(
"to").
'</th>';
223 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
226 while ($i < $num && $i < $max) {
227 $obj = $db->fetch_object($result);
229 $holidaystatic->id = $obj->rowid;
230 $holidaystatic->ref = $obj->ref;
231 $holidaystatic->statut = $obj->status;
232 $holidaystatic->date_debut = $db->jdate($obj->date_start);
234 $userstatic->id = $obj->uid;
235 $userstatic->lastname = $obj->lastname;
236 $userstatic->firstname = $obj->firstname;
237 $userstatic->login = $obj->login;
238 $userstatic->photo = $obj->photo;
239 $userstatic->email = $obj->email;
240 $userstatic->statut = $obj->user_status;
242 print
'<tr class="oddeven">';
243 print
'<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
244 print
'<td class="tdoverflowmax100">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
246 $leavecode = empty($typeleaves[$obj->fk_type]) ?
'Undefined' : $typeleaves[$obj->fk_type][
'code'];
247 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($langs->trans($leavecode)).
'">'.
dol_escape_htmltag($langs->trans($leavecode)).
'</td>';
249 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
250 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
252 print
'<td>'.dol_print_date($db->jdate($obj->date_start),
'day').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
253 print
'<td>'.dol_print_date($db->jdate($obj->date_end),
'day').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
254 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'day').
'</td>';
255 print
'<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).
'</td>';
261 print
'<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
273 if (
isModEnabled(
'expensereport') && $user->hasRight(
'expensereport',
'read')) {
274 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,";
275 $sql .=
" x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
276 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
278 $sql .=
" WHERE u.rowid = x.fk_user_author";
279 $sql .=
" AND x.entity = ".$conf->entity;
280 if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) {
281 $sql .=
' AND x.fk_user_author IN ('.$db->sanitize(join(
',', $childids)).
')';
285 $sql .= $db->order(
"x.tms",
"DESC");
286 $sql .= $db->plimit($max, 0);
288 $result = $db->query($sql);
290 $num = $db->num_rows($result);
294 print
'<div class="div-table-responsive-no-min">';
295 print
'<table class="noborder centpercent">';
296 print
'<tr class="liste_titre">';
297 print
'<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num)).
'</th>';
298 print
'<th class="right">'.$langs->trans(
"TotalTTC").
'</th>';
299 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
302 $total_ttc = $totalam = $total = 0;
305 $userstatic =
new User($db);
306 while ($i < $num && $i < $max) {
307 $obj = $db->fetch_object($result);
309 $expensereportstatic->id = $obj->rowid;
310 $expensereportstatic->ref = $obj->ref;
311 $expensereportstatic->statut = $obj->status;
312 $expensereportstatic->status = $obj->status;
314 $userstatic->id = $obj->uid;
315 $userstatic->lastname = $obj->lastname;
316 $userstatic->firstname = $obj->firstname;
317 $userstatic->email = $obj->email;
318 $userstatic->login = $obj->login;
319 $userstatic->statut = $obj->user_status;
320 $userstatic->photo = $obj->photo;
322 print
'<tr class="oddeven">';
323 print
'<td class="tdoverflowmax200">'.$expensereportstatic->getNomUrl(1).
'</td>';
324 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
325 print
'<td class="right amount">'.price($obj->total_ttc).
'</td>';
326 print
'<td class="right">'.dol_print_date($db->jdate($obj->dm),
'day').
'</td>';
327 print
'<td class="right nowraponall" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
333 print
'<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
345 if (
isModEnabled(
'recruitment') && $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read')) {
348 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
349 $sql.=
" rp.rowid as jobid, rp.ref as jobref, rp.label";
350 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
351 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
352 if (
isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
353 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
355 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).
")";
356 if (
isModEnabled(
'societe') && empty($user->rights->societe->client->voir) && !$socid) {
357 $sql .=
" AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
360 $sql .=
" AND rp.fk_soc = $socid";
362 $sql .= $db->order(
"rc.tms",
"DESC");
363 $sql .= $db->plimit($max, 0);
365 $resql = $db->query($sql);
367 $num = $db->num_rows(
$resql);
370 print
'<div class="div-table-responsive-no-min">';
371 print
'<table class="noborder centpercent">';
372 print
'<tr class="liste_titre">';
373 print
'<th colspan="3">';
374 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", min($max, $num));
376 print
'<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
380 $objp = $db->fetch_object(
$resql);
381 $staticrecruitmentcandidature->id = $objp->rowid;
382 $staticrecruitmentcandidature->ref = $objp->ref;
383 $staticrecruitmentcandidature->email = $objp->email;
384 $staticrecruitmentcandidature->status = $objp->status;
385 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
386 $staticrecruitmentcandidature->firstname = $objp->firstname;
387 $staticrecruitmentcandidature->lastname = $objp->lastname;
389 $staticrecruitmentjobposition->id = $objp->jobid;
390 $staticrecruitmentjobposition->ref = $objp->jobref;
391 $staticrecruitmentjobposition->label = $objp->label;
393 print
'<tr class="oddeven">';
394 print
'<td class="nowraponall">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
395 print
'<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).
'</td>';
396 print
'<td class="nowraponall">'.$staticrecruitmentjobposition->getNomUrl(1).
'</td>';
397 print
'<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
'</td>';
398 print
'<td class="right nowrap" width="16">';
399 print $staticrecruitmentcandidature->getLibStatut(3);
407 print
'<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
417 print
'</div></div>';
420 $parameters = array(
'user' => $user);
421 $reshook = $hookmanager->executeHooks(
'dashboardHRM', $parameters, $object);
Class to manage Trips and Expenses.
Class of the module paid holiday.
Class for RecruitmentCandidature.
Class for RecruitmentJobPosition.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
isModEnabled($module)
Is Dolibarr module enabled.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.