28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
36 if ($conf->deplacement->enabled) require_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
37 if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
42 $hookmanager->initHooks(
'hrmindex');
45 $langs->loadLangs(array(
'users',
'holidays',
'trips',
'boxes'));
47 $socid =
GETPOST(
"socid",
"int");
52 if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete = 1;
55 $holidaystatic =
new Holiday($db);
58 $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
66 if (!empty($conf->holiday->enabled) && !empty($setupcompanynotcomplete))
68 $result = $holiday->updateBalance();
76 $childids = $user->getAllChildIds();
77 $childids[] = $user->id;
84 if (!empty($setupcompanynotcomplete))
86 $langs->load(
"errors");
87 $warnpicto =
img_warning($langs->trans(
"WarningMandatorySetupNotComplete"));
88 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.
'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ?
'' :
'&action=edit').
'">'.$warnpicto.
' '.$langs->trans(
"WarningMandatorySetupNotComplete").
'</a></div>';
95 print '<div class="fichecenter"><div class="fichethirdleft">';
97 if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))
99 if (!empty($conf->holiday->enabled) && $user->rights->holiday->read)
101 $langs->load(
"holiday");
102 $listofsearchfields[
'search_holiday'] = array(
'text'=>
'TitreRequestCP');
104 if (!empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
106 $langs->load(
"trips");
107 $listofsearchfields[
'search_deplacement'] = array(
'text'=>
'ExpenseReport');
109 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
111 $langs->load(
"trips");
112 $listofsearchfields[
'search_expensereport'] = array(
'text'=>
'ExpenseReport');
114 if (count($listofsearchfields))
116 print '<form method="post" action="'.DOL_URL_ROOT.
'/core/search.php">';
117 print '<input type="hidden" name="token" value="'.newToken().
'">';
118 print '<div class="div-table-responsive-no-min">';
119 print '<table class="noborder nohover centpercent">';
121 foreach ($listofsearchfields as $key => $value)
123 if ($i == 0)
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans(
"Search").
'</td></tr>';
124 print '<tr '.$bc[
false].
'>';
125 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>';
126 if ($i == 0)
print '<td rowspan="'.count($listofsearchfields).
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
138 if (!empty($conf->holiday->enabled))
140 if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
142 $user_id = $user->id;
144 print '<div class="div-table-responsive-no-min">';
145 print '<table class="noborder nohover centpercent">';
146 print '<tr class="liste_titre"><th colspan="3">'.$langs->trans(
"Holidays").
'</th></tr>';
147 print '<tr class="oddeven">';
148 print '<td colspan="3">';
151 $typeleaves = $holiday->getTypes(1, 1);
152 foreach ($typeleaves as $key => $val)
154 $nb_type = $holiday->getCPforUser($user->id, $val[
'rowid']);
155 $nb_holiday += $nb_type;
156 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
158 print $langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
'<br>';
163 print '</table></div><br>';
164 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
166 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).
'<br>';
171 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
176 if (!empty($conf->holiday->enabled) && $user->rights->holiday->read)
178 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
179 $sql .=
" x.rowid, x.rowid as 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";
180 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
181 $sql .=
" WHERE u.rowid = x.fk_user";
182 $sql .=
" AND x.entity = ".$conf->entity;
183 if (empty($user->rights->holiday->readall)) $sql .=
' AND x.fk_user IN ('.join(
',', $childids).
')';
186 $sql .= $db->order(
"x.tms",
"DESC");
187 $sql .= $db->plimit($max, 0);
189 $result = $db->query($sql);
193 $num = $db->num_rows($result);
195 $holidaystatic =
new Holiday($db);
196 $userstatic =
new User($db);
198 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
199 $typeleaves = $holidaystatic->getTypes(1, -1);
203 print '<div class="div-table-responsive-no-min">';
204 print '<table class="noborder centpercent">';
205 print '<tr class="liste_titre">';
206 print '<th colspan="3">'.$langs->trans(
"BoxTitleLastLeaveRequests", min($max, $num)).
'</th>';
207 print '<th>'.$langs->trans(
"from").
'</th>';
208 print '<th>'.$langs->trans(
"to").
'</th>';
209 print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
213 while ($i < $num && $i < $max)
215 $obj = $db->fetch_object($result);
217 $holidaystatic->id = $obj->rowid;
218 $holidaystatic->ref = $obj->ref;
219 $holidaystatic->statut = $obj->status;
221 $userstatic->id = $obj->uid;
222 $userstatic->lastname = $obj->lastname;
223 $userstatic->firstname = $obj->firstname;
224 $userstatic->login = $obj->login;
225 $userstatic->photo = $obj->photo;
226 $userstatic->email = $obj->email;
227 $userstatic->statut = $obj->user_status;
229 print '<tr class="oddeven">';
230 print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1).
'</td>';
231 print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1,
'leave').
'</td>';
232 print '<td>'.$typeleaves[$obj->fk_type][
'label'].
'</td>';
234 $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ?
'afternoon' :
'morning';
235 $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ?
'morning' :
'afternoon';
237 print '<td>'.dol_print_date($db->jdate($obj->date_start),
'day').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
238 print '<td>'.dol_print_date($db->jdate($obj->date_end),
'day').
' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
239 print '<td class="right">'.dol_print_date($db->jdate($obj->dm),
'day').
'</td>';
240 print '<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3).
'</td>';
246 print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
256 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
258 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,";
259 $sql .=
" x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
260 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expensereport as x, ".MAIN_DB_PREFIX.
"user as u";
262 $sql .=
" WHERE u.rowid = x.fk_user_author";
263 $sql .=
" AND x.entity = ".$conf->entity;
264 if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql .=
' AND x.fk_user_author IN ('.join(
',', $childids).
')';
267 $sql .= $db->order(
"x.tms",
"DESC");
268 $sql .= $db->plimit($max, 0);
270 $result = $db->query($sql);
273 $num = $db->num_rows($result);
277 print '<div class="div-table-responsive-no-min">';
278 print '<table class="noborder centpercent">';
279 print '<tr class="liste_titre">';
280 print '<th colspan="2">'.$langs->trans(
"BoxTitleLastModifiedExpenses", min($max, $num)).
'</th>';
281 print '<th class="right">'.$langs->trans(
"TotalTTC").
'</th>';
282 print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/expensereport/list.php?sortfield=d.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
286 $total_ttc = $totalam = $total = 0;
289 $userstatic =
new User($db);
290 while ($i < $num && $i < $max)
292 $obj = $db->fetch_object($result);
294 $expensereportstatic->id = $obj->rowid;
295 $expensereportstatic->ref = $obj->ref;
296 $expensereportstatic->statut = $obj->status;
297 $expensereportstatic->status = $obj->status;
299 $userstatic->id = $obj->uid;
300 $userstatic->lastname = $obj->lastname;
301 $userstatic->firstname = $obj->firstname;
302 $userstatic->email = $obj->email;
303 $userstatic->login = $obj->login;
304 $userstatic->statut = $obj->user_status;
305 $userstatic->photo = $obj->photo;
307 print '<tr class="oddeven">';
308 print '<td class="nowraponall">'.$expensereportstatic->getNomUrl(1).
'</td>';
309 print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
'</td>';
310 print '<td class="right">'.price($obj->total_ttc).
'</td>';
311 print '<td class="right">'.dol_print_date($db->jdate($obj->dm),
'day').
'</td>';
312 print '<td class="right nowrap" width="16">'.$expensereportstatic->LibStatut($obj->status, 3).
'</td>';
318 print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
328 if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read)
330 $sql =
"SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
331 $sql .=
" FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rc";
332 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
333 if (!$user->rights->societe->client->voir && !$socid) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
334 $sql .=
" WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).
")";
335 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
336 if ($socid) $sql .=
" AND s.fk_soc = $socid";
337 $sql .=
" ORDER BY rc.tms DESC";
338 $sql .= $db->plimit($max, 0);
340 $resql = $db->query($sql);
343 $num = $db->num_rows(
$resql);
346 print '<div class="div-table-responsive-no-min">';
347 print '<table class="noborder centpercent">';
348 print '<tr class="liste_titre">';
349 print '<th colspan="2">';
350 print $langs->trans(
"BoxTitleLatestModifiedCandidatures", $max);
352 print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.
'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans(
"FullList").
'</th>';
358 $objp = $db->fetch_object(
$resql);
359 $staticrecruitmentcandidature->id = $objp->rowid;
360 $staticrecruitmentcandidature->ref = $objp->ref;
361 $staticrecruitmentcandidature->email = $objp->email;
362 $staticrecruitmentcandidature->status = $objp->status;
363 $staticrecruitmentcandidature->date_creation = $objp->date_creation;
364 $staticrecruitmentcandidature->firstname = $objp->firstname;
365 $staticrecruitmentcandidature->lastname = $objp->lastname;
367 print '<tr class="oddeven">';
368 print '<td class="nowrap">'.$staticrecruitmentcandidature->getNomUrl(1,
'').
'</td>';
369 print '<td class="right nowrap">';
371 print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),
'day').
"</td>";
372 print '<td class="right nowrap" width="16">';
373 print $staticrecruitmentcandidature->getLibStatut(3);
381 print '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
391 print '</div></div></div>';
394 $parameters = array(
'user' => $user);
395 $reshook = $hookmanager->executeHooks(
'dashboardHRM', $parameters, $object);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class of the module paid holiday.
Class to manage Dolibarr users.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage Trips and Expenses.
Class for RecruitmentCandidature.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...