33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46$action =
GETPOST(
'action',
'aZ09');
47$cancel =
GETPOST(
'cancel',
'alpha');
48$confirm =
GETPOST(
'confirm',
'alpha');
49$backtopage =
GETPOST(
'backtopage',
'alpha');
50$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
54$fuserid = (
GETPOST(
'fuserid',
'int') ?
GETPOST(
'fuserid',
'int') : $user->id);
55$socid =
GETPOST(
'socid',
'int');
58$langs->loadLangs(array(
"other",
"holiday",
"mails",
"trips"));
64$childids = $user->getAllChildIds(1);
68 $morefilter =
'AND employee = 1';
76$extrafields->fetch_name_optionals_label($object->table_element);
78if (($id > 0) || $ref) {
79 $object->fetch($id, $ref);
83 if ($user->hasRight(
'holiday',
'readall')) {
86 if ($user->hasRight(
'holiday',
'read') && in_array($object->fk_user, $childids)) {
95$hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
99if ($user->hasRight(
'holiday',
'write') && in_array($fuserid, $childids)) {
102if ($user->hasRight(
'holiday',
'writeall')) {
108if ($user->hasRight(
'holiday',
'delete')) {
111if ($object->statut ==
Holiday::STATUS_DRAFT && $user->hasRight(
'holiday',
'write') && in_array($object->fk_user, $childids)) {
117 $socid = $user->socid;
119$result =
restrictedArea($user,
'holiday', $object->id,
'holiday',
'',
'',
'rowid', $object->statut);
126$parameters = array(
'socid' => $socid);
127$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
132if (empty($reshook)) {
133 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
135 if (empty($backtopage) || ($cancel && empty($id))) {
136 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
137 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
138 $backtopage = $backurlforlist;
140 $backtopage = DOL_URL_ROOT.
'/holiday/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
146 if (!empty($backtopageforcancel)) {
147 header(
"Location: ".$backtopageforcancel);
149 } elseif (!empty($backtopage)) {
150 header(
"Location: ".$backtopage);
157 if ($action ==
'add') {
174 $starthalfday =
GETPOST(
'starthalfday');
175 $endhalfday =
GETPOST(
'endhalfday');
178 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
180 } elseif ($starthalfday ==
'afternoon') {
182 } elseif ($endhalfday ==
'morning') {
186 $approverid =
GETPOST(
'valideur',
'int');
187 $description = trim(
GETPOST(
'description',
'restricthtml'));
190 if (!$cancreateall) {
192 if (!$user->hasRight(
'holiday',
'write')) {
195 } elseif (!in_array($fuserid, $childids)) {
201 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall_advance')) {
204 } elseif (!$user->hasRight(
'holiday',
'writeall_advance') && !in_array($fuserid, $childids)) {
214 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
220 if (empty($date_debut)) {
226 if (empty($date_fin)) {
232 if ($date_debut > $date_fin) {
239 $verifCP = $object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
247 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
248 if ($nbopenedday < 0.5) {
255 if ($approverid < 1) {
256 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
260 $approverslist = $object->fetch_users_approver_holiday();
261 if (!in_array($approverid, $approverslist)) {
262 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidator'),
null,
'errors');
267 $ret = $extrafields->setOptionalsFromPost(
null, $object);
275 $object->fk_user = $fuserid;
276 $object->description = $description;
277 $object->fk_validator = $approverid;
278 $object->fk_type = $type;
279 $object->date_debut = $date_debut;
280 $object->date_fin = $date_fin;
281 $object->halfday = $halfday;
282 $object->entity = $conf->entity;
284 $result = $object->create($user);
295 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
304 if ($action ==
'update' && GETPOSTISSET(
'savevalidator') && $user->hasRight(
'holiday',
'approve')) {
307 $object->oldcopy =
dol_clone($object, 2);
309 $object->fk_validator =
GETPOST(
'valideur',
'int');
311 if ($object->fk_validator != $object->oldcopy->fk_validator) {
312 $verif = $object->update($user);
316 $action =
'editvalidator';
318 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
326 if ($action ==
'update' && !GETPOSTISSET(
'savevalidator')) {
331 $starthalfday =
GETPOST(
'starthalfday');
332 $endhalfday =
GETPOST(
'endhalfday');
334 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
336 } elseif ($starthalfday ==
'afternoon') {
338 } elseif ($endhalfday ==
'morning') {
343 if (!$cancreateall) {
345 if (!in_array($fuserid, $childids)) {
347 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
352 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
363 $approverid =
GETPOST(
'valideur',
'int');
366 $description = trim(
GETPOST(
'description',
'restricthtml'));
376 if ($date_debut > $date_fin) {
383 if ($approverid < 1) {
390 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
391 if ($nbopenedday < 0.5) {
400 $object->description = $description;
401 $object->date_debut = $date_debut;
402 $object->date_fin = $date_fin;
403 $object->fk_validator = $approverid;
404 $object->halfday = $halfday;
407 $verif = $object->update($user);
419 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
435 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
444 $result = $object->delete($user);
453 header(
'Location: list.php?restore_lastsearch_values=1');
461 if ($action ==
'confirm_send') {
466 $object->oldcopy =
dol_clone($object, 2);
470 $verif = $object->validate($user);
475 $destinataire =
new User($db);
476 $destinataire->fetch($object->fk_validator);
477 $emailTo = $destinataire->email;
480 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
481 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
486 $expediteur =
new User($db);
487 $expediteur->fetch($object->fk_user);
489 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
492 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
494 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
497 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
500 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
502 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
507 $delayForRequest = 0;
508 if ($delayForRequest) {
511 if ($object->date_debut < $nowplusdelay) {
512 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
519 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
521 if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
522 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
526 $typeleaves = $object->getTypes(1, -1);
527 $labeltoshow = (($typeleaves[$object->fk_type][
'code'] && $langs->trans($typeleaves[$object->fk_type][
'code']) != $typeleaves[$object->fk_type][
'code']) ? $langs->trans($typeleaves[$object->fk_type][
'code']) : $typeleaves[$object->fk_type][
'label']);
529 if ($object->halfday == 2) {
530 $starthalfdaykey =
"Afternoon";
531 $endhalfdaykey =
"Morning";
532 } elseif ($object->halfday == -1) {
533 $starthalfdaykey =
"Afternoon";
534 $endhalfdaykey =
"Afternoon";
535 } elseif ($object->halfday == 1) {
536 $starthalfdaykey =
"Morning";
537 $endhalfdaykey =
"Morning";
538 } elseif ($object->halfday == 0 || $object->halfday == 2) {
539 $starthalfdaykey =
"Morning";
540 $endhalfdaykey =
"Afternoon";
543 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
546 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
547 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow).
"</li>\n";
548 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Period").
" : ".
dol_print_date($object->date_debut,
'day').
" ".$langs->transnoentitiesnoconv($starthalfdaykey).
" ".$langs->transnoentitiesnoconv(
"To").
" ".
dol_print_date($object->date_fin,
'day').
" ".$langs->transnoentitiesnoconv($endhalfdaykey).
"</li>\n";
549 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
550 $message .=
"</ul>\n";
552 $trackid =
'leav'.$object->id;
554 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
557 $result = $mail->sendfile();
563 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
573 if ($action ==
'update_extras') {
574 $object->oldcopy =
dol_clone($object, 2);
577 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
584 $result = $object->insertExtraFields(
'HOLIDAY_MODIFY');
592 $action =
'edit_extras';
597 if ($action ==
'confirm_valid') {
602 $object->oldcopy =
dol_clone($object, 2);
604 $object->date_approval =
dol_now();
605 $object->fk_user_approve = $user->id;
611 $verif = $object->approve($user);
620 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
621 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
622 $newSolde = ($soldeActuel - $nbopenedday);
623 $label = $langs->transnoentitiesnoconv(
"Holidays").
' - '.$object->ref;
626 $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type);
633 $result = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
642 $destinataire =
new User($db);
643 $destinataire->fetch($object->fk_user);
644 $emailTo = $destinataire->email;
647 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
650 $expediteur =
new User($db);
651 $expediteur->fetch($object->fk_validator);
653 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
656 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
658 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
661 $subject =
'['.$societeName.
"] ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
664 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
666 $message .=
"<p>".$langs->transnoentities(
"HolidaysValidatedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
668 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
670 $message .=
"<ul>\n";
671 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
672 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
673 $message .=
"</ul>\n";
675 $trackid =
'leav'.$object->id;
677 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
680 $result = $mail->sendfile();
692 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
701 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
702 if (
GETPOST(
'detail_refuse')) {
707 $object->date_refuse =
dol_now();
708 $object->fk_user_refuse = $user->id;
711 $object->detail_refuse =
GETPOST(
'detail_refuse',
'alphanohtml');
715 $verif = $object->update($user);
724 $destinataire =
new User($db);
725 $destinataire->fetch($object->fk_user);
726 $emailTo = $destinataire->email;
729 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
732 $expediteur =
new User($db);
733 $expediteur->fetch($object->fk_validator);
735 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
738 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
740 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
743 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
746 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
748 $message .=
"<p>".$langs->transnoentities(
"HolidaysRefusedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"<p>\n";
749 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
751 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
753 $message .=
"<ul>\n";
754 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
755 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
758 $trackid =
'leav'.$object->id;
760 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
763 $result = $mail->sendfile();
777 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
785 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
792 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes') {
797 $oldstatus = $object->statut;
801 $result = $object->update($user);
804 setEventMessages($langs->trans(
'ErrorBackToDraft').
' '.$object->error, $object->errors,
'errors');
810 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
818 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
825 (!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) {
828 $oldstatus = $object->statut;
829 $object->date_cancel =
dol_now();
830 $object->fk_user_cancel = $user->id;
834 $result = $object->update($user);
838 $result = $object->call_trigger(
'HOLIDAY_CANCEL', $user);
844 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
846 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
847 $newSolde = ($soldeActuel + $nbopenedday);
850 $result1 = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv(
"HolidaysCancelation"), $newSolde, $object->fk_type);
853 $result2 = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
855 if ($result1 < 0 || $result2 < 0) {
857 setEventMessages($langs->trans(
'ErrorCantDeleteCP').
' '.$object->error, $object->errors,
'errors');
868 if (!$error && $result > 0) {
870 $destinataire =
new User($db);
871 $destinataire->fetch($object->fk_user);
872 $emailTo = $destinataire->email;
875 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
880 $expediteur =
new User($db);
881 $expediteur->fetch($object->fk_user_cancel);
883 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
886 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
888 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
891 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
894 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
896 $message .=
"<p>".$langs->transnoentities(
"HolidaysCanceledBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
898 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
900 $message .=
"<ul>\n";
901 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
902 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
903 $message .=
"</ul>\n";
905 $trackid =
'leav'.$object->id;
907 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
910 $result = $mail->sendfile();
916 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
946$form =
new Form($db);
949$listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
951$title = $langs->trans(
'Leave');
952$help_url =
'EN:Module_Holiday';
958if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
960 if ((in_array($fuserid, $childids) && !$user->hasRight(
'holiday',
'write')) || (!in_array($fuserid, $childids) && ((
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'holiday',
'writeall_advance') || !$user->hasRight(
'holiday',
'writeall'))))) {
961 $errors[] = $langs->trans(
'CantCreateCP');
970 $errors[] = $langs->trans(
'ErrorEndDateCP');
973 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
976 $errors[] = $langs->trans(
'CantCreateCP');
979 $errors[] = $langs->trans(
'InvalidValidatorCP');
982 $errors[] = $langs->trans(
'NoDateDebut');
985 $errors[] = $langs->trans(
'NoDateFin');
988 $errors[] = $langs->trans(
'ErrorDureeCP');
991 $errors[] = $langs->trans(
'alreadyCPexist');
999 print
'<script type="text/javascript">
1000 $( document ).ready(function() {
1001 $("input.button-save").click("submit", function(e) {
1002 console.log("Call valider()");
1003 if (document.demandeCP.date_debut_.value != "")
1005 if(document.demandeCP.date_fin_.value != "")
1007 if(document.demandeCP.valideur.value != "-1") {
1011 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
1017 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
1023 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
1032 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
1033 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1034 print
'<input type="hidden" name="action" value="add" />'.
"\n";
1040 print
'<table class="border centpercent">';
1045 print
'<td class="titlefield fieldrequired tdtop">'.$langs->trans(
"User").
'</td>';
1046 print
'<td><div class="inline-block">';
1047 if ($cancreate && !$cancreateall) {
1048 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(($fuserid ? $fuserid : $user->id),
'fuserid', 0,
'', 0,
'hierarchyme',
'',
'0,'.$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500 inline-block');
1051 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($fuserid ? $fuserid : $user->id,
'fuserid', 0,
'', 0,
'',
'',
'0,'.$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500 inline-block');
1056 print
'<div class="leaveuserbalance paddingtop inline-block floatright badge badge-status0 badge-status margintoponsmartphone">';
1060 $typeleaves = $object->getTypes(1, 1);
1061 foreach ($typeleaves as $key => $val) {
1062 $nb_type = $object->getCPforUser(($fuserid ? $fuserid : $user->id), $val[
'rowid']);
1063 $nb_holiday += $nb_type;
1065 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1068 print
' ';
1070 $htmltooltip = $langs->trans(
"Detail").
'<br>';
1071 $htmltooltip .= $out;
1073 print $form->textwithtooltip($langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
' '.
img_picto(
'',
'help'), $htmltooltip);
1076 if (!empty($conf->use_javascript_ajax)) {
1078 print
'$( document ).ready(function() {
1079 jQuery("#fuserid").change(function() {
1080 console.log("We change to user id "+jQuery("#fuserid").val());
1081 if (jQuery("#fuserid").val() == '.((int) $user->id).
') {
1082 jQuery(".leaveuserbalance").show();
1084 jQuery(".leaveuserbalance").hide();
1090 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
1091 print
'<div class="leaveuserbalance paddingtop">';
1092 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE);
1101 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
1103 $typeleaves = $object->getTypes(1, -1);
1104 $arraytypeleaves = array();
1105 foreach ($typeleaves as $key => $val) {
1106 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
1107 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
1108 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
1110 print $form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', true);
1112 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1119 print
'<td class="fieldrequired">';
1120 print $form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
1122 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1123 if (!
GETPOST(
'date_debut_')) {
1124 print $form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
1127 print $form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
1129 print
' ';
1130 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
1136 print
'<td class="fieldrequired">';
1137 print $form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
1139 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1141 print $form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
1144 print $form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
1146 print
' ';
1147 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
1153 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
1157 $include_users = $object->fetch_users_approver_holiday();
1158 if (empty($include_users)) {
1159 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1163 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1165 $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR;
1167 if (
GETPOST(
'valideur',
'int') > 0) {
1168 $defaultselectuser =
GETPOST(
'valideur',
'int');
1170 $s = $form->select_dolusers($defaultselectuser,
"valideur", 1,
'', 0, $include_users,
'',
'0,'.$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
1171 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1180 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
1181 print
'<td class="tdtop">';
1182 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In', 0,
false, isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1183 print $doleditor->Create(1);
1187 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1194 print $form->buttonsSaveCancel(
"SendRequestCP");
1196 print
'</from>'.
"\n";
1199 if ($error && $action !=
'edit') {
1200 print
'<div class="tabBar">';
1202 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1206 if (($id > 0) || $ref) {
1207 $result = $object->fetch($id, $ref);
1209 $approverexpected =
new User($db);
1210 $approverexpected->fetch($object->fk_validator);
1212 $userRequest =
new User($db);
1213 $userRequest->fetch($object->fk_user);
1221 $errors[] = $langs->transnoentitiesnoconv(
'ErrorEndDateCP');
1224 $errors[] = $langs->transnoentitiesnoconv(
'ErrorSQLCreateCP');
1227 $errors[] = $langs->transnoentitiesnoconv(
'CantCreateCP');
1230 $errors[] = $langs->transnoentitiesnoconv(
'InvalidValidatorCP');
1233 $errors[] = $langs->transnoentitiesnoconv(
'NoDateDebut');
1236 $errors[] = $langs->transnoentitiesnoconv(
'NoDateFin');
1238 case 'DureeHoliday':
1239 $errors[] = $langs->transnoentitiesnoconv(
'ErrorDureeCP');
1241 case 'NoMotifRefuse':
1242 $errors[] = $langs->transnoentitiesnoconv(
'NoMotifRefuseCP');
1245 $errors[] = $langs->transnoentitiesnoconv(
'ErrorMailNotSend');
1256 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1261 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">'.
"\n";
1262 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1263 print
'<input type="hidden" name="action" value="update"/>'.
"\n";
1264 print
'<input type="hidden" name="id" value="'.$object->id.
'" />'.
"\n";
1267 print
dol_get_fiche_head($head,
'card', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
1269 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1274 print
'<div class="fichecenter">';
1275 print
'<div class="fichehalfleft">';
1276 print
'<div class="underbanner clearboth"></div>';
1278 print
'<table class="border tableforfield centpercent">';
1283 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
1285 print $userRequest->getNomUrl(-1,
'leave');
1290 print
'<td>'.$langs->trans(
"Type").
'</td>';
1292 $typeleaves = $object->getTypes(1, -1);
1293 $labeltoshow = (($typeleaves[$object->fk_type][
'code'] && $langs->trans($typeleaves[$object->fk_type][
'code']) != $typeleaves[$object->fk_type][
'code']) ? $langs->trans($typeleaves[$object->fk_type][
'code']) : $typeleaves[$object->fk_type][
'label']);
1294 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
1298 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
1299 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
1303 print
'<td class="nowrap">';
1304 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1306 print
'<td>'.dol_print_date($object->date_debut,
'day');
1307 print
' ';
1308 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
1313 print
'<td class="nowrap">';
1314 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1318 print $form->selectDate($tmpdate ? $tmpdate : $object->date_debut,
'date_debut_');
1319 print
' ';
1320 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
1327 print
'<td class="nowrap">';
1328 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1330 print
'<td>'.dol_print_date($object->date_fin,
'day');
1331 print
' ';
1332 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
1337 print
'<td class="nowrap">';
1338 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1341 print $form->selectDate($object->date_fin,
'date_fin_');
1342 print
' ';
1343 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
1351 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
1352 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
1353 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
1354 if ($includesaturday) {
1355 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
1357 if ($includesunday) {
1358 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
1360 print $form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
1363 print
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
1369 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
1370 print
'<td>'.$object->detail_refuse.
'</td>';
1377 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1378 print
'<td>'.nl2br($object->description).
'</td>';
1382 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1383 print
'<td class="tdtop">';
1384 $doleditor =
new DolEditor(
'description', $object->description,
'', 80,
'dolibarr_notes',
'In', 0,
false, isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1385 print $doleditor->Create(1);
1390 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1393 print
'</table>'.
"\n";
1396 print
'<div class="fichehalfright">';
1398 print
'<div class="underbanner clearboth"></div>';
1401 print
'<table class="border tableforfield centpercent">'.
"\n";
1404 if (!empty($object->fk_user_create)) {
1405 $userCreate =
new User($db);
1406 $userCreate->fetch($object->fk_user_create);
1408 print
'<td class="titlefield">'.$langs->trans(
'RequestByCP').
'</td>';
1409 print
'<td>'.$userCreate->getNomUrl(-1).
'</td>';
1414 if (!$edit && $action !=
'editvalidator') {
1416 print
'<td class="titlefield">';
1418 print $langs->trans(
'ApprovedBy');
1420 print $langs->trans(
'ReviewedByCP');
1425 if ($object->fk_user_approve > 0) {
1426 $approverdone =
new User($db);
1427 $approverdone->fetch($object->fk_user_approve);
1428 print $approverdone->getNomUrl(-1);
1431 print $approverexpected->getNomUrl(-1);
1433 $include_users = $object->fetch_users_approver_holiday();
1435 print
'<a class="editfielda paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editvalidator">'.
img_edit($langs->trans(
"Edit")).
'</a>';
1441 print
'<td class="titlefield">'.$langs->trans(
'ReviewedByCP').
'</td>';
1443 $include_users = $object->fetch_users_approver_holiday();
1444 if (!in_array($object->fk_validator, $include_users)) {
1445 $include_users[] = $object->fk_validator;
1447 if (empty($include_users)) {
1448 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1450 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ?
'' : array($user->id));
1451 $s = $form->select_dolusers($object->fk_validator,
"valideur", (($action ==
'editvalidator') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1452 print $form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1454 if ($action ==
'editvalidator') {
1455 print
'<input type="submit" class="button button-save" name="savevalidator" value="'.$langs->trans(
"Save").
'">';
1456 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1463 print
'<td>'.$langs->trans(
'DateCreation').
'</td>';
1464 print
'<td>'.dol_print_date($object->date_create,
'dayhour',
'tzuser').
'</td>';
1468 print
'<td>'.$langs->trans(
'DateValidCP').
'</td>';
1469 print
'<td>'.dol_print_date($object->date_approval,
'dayhour',
'tzuser').
'</td>';
1474 print
'<td>'.$langs->trans(
'DateCancelCP').
'</td>';
1475 print
'<td>'.dol_print_date($object->date_cancel,
'dayhour',
'tzuser').
'</td>';
1480 print
'<td>'.$langs->trans(
'DateRefusCP').
'</td>';
1481 print
'<td>'.dol_print_date($object->date_refuse,
'dayhour',
'tzuser').
'</td>';
1490 print
'<div class="clearboth"></div>';
1496 if ($action ==
'delete') {
1498 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleDeleteCP"), $langs->trans(
"ConfirmDeleteCP"),
"confirm_delete",
'', 0, 1);
1504 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleToValidCP"), $langs->trans(
"ConfirmToValidCP"),
"confirm_send",
'', 1, 1);
1508 if ($action ==
'valid') {
1509 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleValidCP"), $langs->trans(
"ConfirmValidCP"),
"confirm_valid",
'', 1, 1);
1513 if ($action ==
'refuse') {
1514 $array_input = array(array(
'type'=>
"text",
'label'=> $langs->trans(
'DetailRefusCP'),
'name'=>
"detail_refuse",
'size'=>
"50",
'value'=>
""));
1515 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id.
"&action=confirm_refuse", $langs->trans(
"TitleRefuseCP"), $langs->trans(
'ConfirmRefuseCP'),
"confirm_refuse", $array_input, 1, 0);
1519 if ($action ==
'cancel') {
1520 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleCancelCP"), $langs->trans(
"ConfirmCancelCP"),
"confirm_cancel",
'', 1, 1);
1524 if ($action ==
'backtodraft') {
1525 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleSetToDraft"), $langs->trans(
"ConfirmSetToDraft"),
"confirm_draft",
'', 1, 1);
1528 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1531 print $form->buttonsSaveCancel();
1541 print
'<div class="tabsAction">';
1544 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.newToken().
'" class="butAction">'.$langs->trans(
"EditCP").
'</a>';
1548 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=sendToValidate&token='.newToken().
'" class="butAction">'.$langs->trans(
"Validate").
'</a>';
1553 if ($user->id == $object->fk_validator) {
1554 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.newToken().
'" class="butAction">'.$langs->trans(
"Approve").
'</a>';
1555 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=refuse&token='.newToken().
'" class="butAction">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1557 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"Approve").
'</a>';
1558 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1561 if ($cancreate || $cancreateall) {
1562 if (($object->date_fin >
dol_now()) || !empty($user->admin)) {
1563 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1565 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1571 if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $cancreate || $cancreateall) {
1572 if (($object->date_fin >
dol_now()) || !empty($user->admin) || $user->id == $object->fk_user_approve) {
1573 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1575 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1578 if (!empty($user->admin)) {
1579 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1581 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1587 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=backtodraft" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1590 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1596 print
'<div class="tabBar">';
1597 print $langs->trans(
'ErrorUserViewCP');
1598 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1602 print
'<div class="tabBar">';
1603 print $langs->trans(
'ErrorIDFicheCP');
1604 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1610 if (
GETPOST(
'modelselected')) {
1611 $action =
'presend';
1614 if ($action !=
'presend' && $action !=
'edit') {
1615 print
'<div class="fichecenter"><div class="fichehalfleft">';
1616 print
'<a name="builddoc"></a>';
1618 $includedocgeneration = 0;
1621 if ($includedocgeneration) {
1623 $relativepath = $objref.
'/'.$objref.
'.pdf';
1624 $filedir = $conf->holiday->dir_output.
'/'.$object->element.
'/'.$objref;
1625 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1626 $genallowed = ($user->rights->holiday->read && $object->fk_user == $user->id) || !empty($user->rights->holiday->readall);
1627 $delallowed = ($user->rights->holiday->write && $object->fk_user == $user->id) || !empty($user->rights->holiday->writeall_advance);
1628 print $formfile->showdocuments(
'holiday:Holiday', $object->element.
'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
1636 print
'</div><div class="fichehalfright">';
1639 $morehtmlright =
'';
1642 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1644 $somethingshown =
$formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlright);
1646 print
'</div></div>';
1654if (is_object($db)) {
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif( $action=='specimen') elseif($action=='setmodel') elseif( $action=='del') elseif($action=='setdoc') $formactions
View.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage a WYSIWYG editor.
Class of the module paid holiday.
const STATUS_VALIDATED
Validated status.
const STATUS_DRAFT
Draft status.
const STATUS_REFUSED
Refused.
const STATUS_CANCELED
Canceled.
const STATUS_APPROVED
Approved.
Class to manage Dolibarr users.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
holiday_prepare_head($object)
Return array head with list of tabs to view object informations.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.