33 require
'../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
46 $action =
GETPOST(
'action',
'aZ09');
47 $cancel =
GETPOST(
'cancel',
'alpha');
48 $confirm =
GETPOST(
'confirm',
'alpha');
52 $fuserid = (
GETPOST(
'fuserid',
'int') ?
GETPOST(
'fuserid',
'int') : $user->id);
53 $socid =
GETPOST(
'socid',
'int');
56 $langs->loadLangs(array(
"other",
"holiday",
"mails",
"trips"));
62 $childids = $user->getAllChildIds(1);
65 if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
66 $morefilter =
'AND employee = 1';
74 $extrafields->fetch_name_optionals_label($object->table_element);
76 if (($id > 0) || $ref) {
77 $object->fetch($id, $ref);
81 if (!empty($user->rights->holiday->readall)) {
84 if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
93 $hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
97 if (!empty($user->rights->holiday->write) && in_array($fuserid, $childids)) {
100 if (!empty($user->rights->holiday->writeall)) {
106 if (!empty($user->rights->holiday->delete)) {
109 if ($object->statut ==
Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) {
115 $socid = $user->socid;
117 $result =
restrictedArea($user,
'holiday', $object->id,
'holiday',
'',
'',
'rowid', $object->statut);
125 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
130 if (empty($reshook)) {
131 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
133 if (empty($backtopage) || ($cancel && empty($id))) {
134 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
135 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
136 $backtopage = $backurlforlist;
138 $backtopage = DOL_URL_ROOT.
'/holiday/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
144 if (!empty($backtopageforcancel)) {
145 header(
"Location: ".$backtopageforcancel);
147 } elseif (!empty($backtopage)) {
148 header(
"Location: ".$backtopage);
155 if ($action ==
'add') {
172 $starthalfday =
GETPOST(
'starthalfday');
173 $endhalfday =
GETPOST(
'endhalfday');
176 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
178 } elseif ($starthalfday ==
'afternoon') {
180 } elseif ($endhalfday ==
'morning') {
184 $approverid =
GETPOST(
'valideur',
'int');
185 $description = trim(
GETPOST(
'description',
'restricthtml'));
188 if (!$cancreateall) {
189 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
190 if (empty($user->rights->holiday->write)) {
193 } elseif (!in_array($fuserid, $childids)) {
199 if (empty($user->rights->holiday->write) && empty($user->rights->holiday->writeall_advance)) {
202 } elseif (empty($user->rights->holiday->writeall_advance) && !in_array($fuserid, $childids)) {
212 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
218 if (empty($date_debut)) {
224 if (empty($date_fin)) {
230 if ($date_debut > $date_fin) {
237 $verifCP = $object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
245 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
246 if ($nbopenedday < 0.5) {
253 if ($approverid < 1) {
254 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
258 $approverslist = $object->fetch_users_approver_holiday();
259 if (!in_array($approverid, $approverslist)) {
260 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidator'),
null,
'errors');
265 $ret = $extrafields->setOptionalsFromPost(
null, $object);
273 $object->fk_user = $fuserid;
274 $object->description = $description;
275 $object->fk_validator = $approverid;
276 $object->fk_type = $type;
277 $object->date_debut = $date_debut;
278 $object->date_fin = $date_fin;
279 $object->halfday = $halfday;
281 $result = $object->create($user);
291 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
300 if ($action ==
'update' &&
GETPOSTISSET(
'savevalidator') && !empty($user->rights->holiday->approve)) {
305 $object->fk_validator =
GETPOST(
'valideur',
'int');
307 if ($object->fk_validator != $object->oldcopy->fk_validator) {
308 $verif = $object->update($user);
312 $action =
'editvalidator';
314 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
322 if ($action ==
'update' && !
GETPOSTISSET(
'savevalidator')) {
327 $starthalfday =
GETPOST(
'starthalfday');
328 $endhalfday =
GETPOST(
'endhalfday');
330 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
332 } elseif ($starthalfday ==
'afternoon') {
334 } elseif ($endhalfday ==
'morning') {
339 if (!$cancreateall) {
341 if (!in_array($fuserid, $childids)) {
343 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
348 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
359 $approverid =
GETPOST(
'valideur',
'int');
362 $description = trim(
GETPOST(
'description',
'restricthtml'));
366 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=nodatedebut');
372 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=nodatefin');
377 if ($date_debut > $date_fin) {
378 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=datefin');
383 if ($approverid < 1) {
384 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=Valideur');
389 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
390 if ($nbopenedday < 0.5) {
391 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&error=DureeHoliday');
395 $object->description = $description;
396 $object->date_debut = $date_debut;
397 $object->date_fin = $date_fin;
398 $object->fk_validator = $approverid;
399 $object->halfday = $halfday;
402 $verif = $object->update($user);
408 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
422 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
431 $result = $object->delete($user);
440 header(
'Location: list.php?restore_lastsearch_values=1');
448 if ($action ==
'confirm_send') {
457 $verif = $object->validate($user);
462 $destinataire =
new User($db);
463 $destinataire->fetch($object->fk_validator);
464 $emailTo = $destinataire->email;
467 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
468 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
473 $expediteur =
new User($db);
474 $expediteur->fetch($object->fk_user);
476 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
479 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
480 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
481 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
484 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
487 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
489 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
493 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY)) {
494 $delayForRequest = 0;
495 if ($delayForRequest) {
498 if ($object->date_debut < $nowplusdelay) {
499 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
505 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE)) {
506 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
508 if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
509 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
513 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
516 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
517 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Period").
" : ".
dol_print_date($object->date_debut,
'day').
" ".$langs->transnoentitiesnoconv(
"To").
" ".
dol_print_date($object->date_fin,
'day').
"</li>\n";
518 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
519 $message .=
"</ul>\n";
521 $trackid =
'leav'.$object->id;
523 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
526 $result = $mail->sendfile();
532 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
542 if ($action ==
'update_extras') {
546 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
553 $result = $object->insertExtraFields(
'HOLIDAY_MODIFY');
561 $action =
'edit_extras';
566 if ($action ==
'confirm_valid') {
573 $object->date_approval =
dol_now();
574 $object->fk_user_approve = $user->id;
580 $verif = $object->approve($user);
589 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
590 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
591 $newSolde = ($soldeActuel - $nbopenedday);
592 $label = $langs->transnoentitiesnoconv(
"Holidays").
' - '.$object->ref;
595 $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type);
602 $result = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
611 $destinataire =
new User($db);
612 $destinataire->fetch($object->fk_user);
613 $emailTo = $destinataire->email;
616 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
619 $expediteur =
new User($db);
620 $expediteur->fetch($object->fk_validator);
622 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
625 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
626 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
627 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
630 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
633 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
635 $message .=
"<p>".$langs->transnoentities(
"HolidaysValidatedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
637 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
639 $message .=
"<ul>\n";
640 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
641 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
642 $message .=
"</ul>\n";
644 $trackid =
'leav'.$object->id;
646 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
649 $result = $mail->sendfile();
661 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
670 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
671 if (
GETPOST(
'detail_refuse')) {
676 $object->date_refuse =
dol_now();
677 $object->fk_user_refuse = $user->id;
680 $object->detail_refuse =
GETPOST(
'detail_refuse',
'alphanohtml');
684 $verif = $object->update($user);
693 $destinataire =
new User($db);
694 $destinataire->fetch($object->fk_user);
695 $emailTo = $destinataire->email;
698 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
701 $expediteur =
new User($db);
702 $expediteur->fetch($object->fk_validator);
704 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
707 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
708 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
709 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
712 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
715 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
717 $message .=
"<p>".$langs->transnoentities(
"HolidaysRefusedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"<p>\n";
718 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
720 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
722 $message .=
"<ul>\n";
723 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
724 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
727 $trackid =
'leav'.$object->id;
729 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
732 $result = $mail->sendfile();
746 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
754 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
761 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes') {
766 $oldstatus = $object->statut;
770 $result = $object->update($user);
773 setEventMessages($langs->trans(
'ErrorBackToDraft').
' '.$object->error, $object->errors,
'errors');
779 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
787 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
794 (!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) {
797 $oldstatus = $object->statut;
798 $object->date_cancel =
dol_now();
799 $object->fk_user_cancel = $user->id;
803 $result = $object->update($user);
807 $result = $object->call_trigger(
'HOLIDAY_CANCEL', $user);
813 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
815 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
816 $newSolde = ($soldeActuel + $nbopenedday);
819 $result1 = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv(
"HolidaysCancelation"), $newSolde, $object->fk_type);
822 $result2 = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
824 if ($result1 < 0 || $result2 < 0) {
826 setEventMessages($langs->trans(
'ErrorCantDeleteCP').
' '.$object->error, $object->errors,
'errors');
837 if (!$error && $result > 0) {
839 $destinataire =
new User($db);
840 $destinataire->fetch($object->fk_user);
841 $emailTo = $destinataire->email;
844 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
849 $expediteur =
new User($db);
850 $expediteur->fetch($object->fk_user_cancel);
852 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
855 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
856 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
857 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
860 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
863 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
865 $message .=
"<p>".$langs->transnoentities(
"HolidaysCanceledBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
867 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
869 $message .=
"<ul>\n";
870 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
871 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
872 $message .=
"</ul>\n";
874 $trackid =
'leav'.$object->id;
876 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
879 $result = $mail->sendfile();
885 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
918 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
920 $title = $langs->trans(
'Leave');
928 if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
933 if ((in_array($fuserid, $childids) && empty($user->rights->holiday->write)) || (!in_array($fuserid, $childids) && ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->writeall_advance) || empty($user->rights->holiday->writeall))))) {
934 $errors[] = $langs->trans(
'CantCreateCP');
940 $errors[] = $langs->trans(
'ErrorEndDateCP');
943 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
946 $errors[] = $langs->trans(
'CantCreateCP');
949 $errors[] = $langs->trans(
'InvalidValidatorCP');
952 $errors[] = $langs->trans(
'NoDateDebut');
955 $errors[] = $langs->trans(
'NoDateFin');
958 $errors[] = $langs->trans(
'ErrorDureeCP');
961 $errors[] = $langs->trans(
'alreadyCPexist');
965 if (count($errors)) {
972 print
'<script type="text/javascript">
973 $( document ).ready(function() {
974 $("input.button-save").click("submit", function(e) {
975 console.log("Call valider()");
976 if (document.demandeCP.date_debut_.value != "")
978 if(document.demandeCP.date_fin_.value != "")
980 if(document.demandeCP.valideur.value != "-1") {
984 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
990 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
996 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
1005 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
1006 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1007 print
'<input type="hidden" name="action" value="add" />'.
"\n";
1009 if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
1014 $typeleaves = $object->getTypes(1, 1);
1015 foreach ($typeleaves as $key => $val) {
1016 $nb_type = $object->getCPforUser($user->id, $val[
'rowid']);
1017 $nb_holiday += $nb_type;
1019 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1022 print $langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
'<br>';
1026 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
1027 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).
'<br>';
1034 print
'<table class="border centpercent">';
1039 print
'<td class="titlefield fieldrequired">'.$langs->trans(
"User").
'</td>';
1041 if ($cancreate && !$cancreateall) {
1042 print
img_picto(
'',
'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id),
'fuserid', 0,
'', 0,
'hierarchyme',
'',
'0,'.$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500');
1045 print
img_picto(
'',
'user').$form->select_dolusers($fuserid ? $fuserid : $user->id,
'fuserid', 0,
'', 0,
'',
'',
'0,'.$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500');
1052 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
1054 $typeleaves = $object->getTypes(1, -1);
1055 $arraytypeleaves = array();
1056 foreach ($typeleaves as $key => $val) {
1057 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
1058 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
1059 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
1061 print
$form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', true);
1063 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1070 print
'<td class="fieldrequired">';
1071 print
$form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
1075 if (!
GETPOST(
'date_debut_')) {
1076 print
$form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
1079 print
$form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
1081 print
' ';
1082 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
1088 print
'<td class="fieldrequired">';
1089 print
$form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
1093 print
$form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
1096 print
$form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
1098 print
' ';
1099 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
1105 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
1109 $include_users = $object->fetch_users_approver_holiday();
1110 if (empty($include_users)) {
1111 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1115 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1116 if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
1117 $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR;
1119 if (
GETPOST(
'valideur',
'int') > 0) {
1120 $defaultselectuser =
GETPOST(
'valideur',
'int');
1122 $s =
$form->select_dolusers($defaultselectuser,
"valideur", 1,
'', 0, $include_users,
'',
'0,'.$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
1123 print
img_picto(
'',
'user').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1132 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
1133 print
'<td class="tdtop">';
1134 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->fckeditor->enabled) ?
false : $conf->fckeditor->enabled, ROWS_3,
'90%');
1135 print $doleditor->Create(1);
1139 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1146 print
$form->buttonsSaveCancel(
"SendRequestCP");
1148 print
'</from>'.
"\n";
1151 print
'<div class="tabBar">';
1153 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1157 if (($id > 0) || $ref) {
1158 $result = $object->fetch($id, $ref);
1160 $approverexpected =
new User($db);
1161 $approverexpected->fetch($object->fk_validator);
1163 $userRequest =
new User($db);
1164 $userRequest->fetch($object->fk_user);
1172 $errors[] = $langs->transnoentitiesnoconv(
'ErrorEndDateCP');
1175 $errors[] = $langs->transnoentitiesnoconv(
'ErrorSQLCreateCP');
1178 $errors[] = $langs->transnoentitiesnoconv(
'CantCreateCP');
1181 $errors[] = $langs->transnoentitiesnoconv(
'InvalidValidatorCP');
1184 $errors[] = $langs->transnoentitiesnoconv(
'NoDateDebut');
1187 $errors[] = $langs->transnoentitiesnoconv(
'NoDateFin');
1189 case 'DureeHoliday':
1190 $errors[] = $langs->transnoentitiesnoconv(
'ErrorDureeCP');
1192 case 'NoMotifRefuse':
1193 $errors[] = $langs->transnoentitiesnoconv(
'NoMotifRefuseCP');
1196 $errors[] = $langs->transnoentitiesnoconv(
'ErrorMailNotSend');
1207 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1212 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">'.
"\n";
1213 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1214 print
'<input type="hidden" name="action" value="update"/>'.
"\n";
1215 print
'<input type="hidden" name="id" value="'.$object->id.
'" />'.
"\n";
1218 print
dol_get_fiche_head($head,
'card', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
1220 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1225 print
'<div class="fichecenter">';
1226 print
'<div class="fichehalfleft">';
1227 print
'<div class="underbanner clearboth"></div>';
1229 print
'<table class="border tableforfield centpercent">';
1234 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
1236 print $userRequest->getNomUrl(-1,
'leave');
1241 print
'<td>'.$langs->trans(
"Type").
'</td>';
1243 $typeleaves = $object->getTypes(1, -1);
1244 $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']);
1245 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
1249 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
1250 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
1254 print
'<td class="nowrap">';
1255 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1257 print
'<td>'.dol_print_date($object->date_debut,
'day');
1258 print
' ';
1259 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
1264 print
'<td class="nowrap">';
1265 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1268 print
$form->selectDate($object->date_debut,
'date_debut_');
1269 print
' ';
1270 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
1277 print
'<td class="nowrap">';
1278 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1280 print
'<td>'.dol_print_date($object->date_fin,
'day');
1281 print
' ';
1282 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
1287 print
'<td class="nowrap">';
1288 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1291 print
$form->selectDate($object->date_fin,
'date_fin_');
1292 print
' ';
1293 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
1301 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
1302 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
1303 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
1304 if ($includesaturday) {
1305 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
1307 if ($includesunday) {
1308 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
1310 print
$form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
1313 print
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
1319 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
1320 print
'<td>'.$object->detail_refuse.
'</td>';
1327 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1328 print
'<td>'.nl2br($object->description).
'</td>';
1332 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1333 print
'<td class="tdtop">';
1334 $doleditor =
new DolEditor(
'description', $object->description,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->fckeditor->enabled) ?
false : $conf->fckeditor->enabled, ROWS_3,
'90%');
1335 print $doleditor->Create(1);
1340 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1343 print
'</table>'.
"\n";
1346 print
'<div class="fichehalfright">';
1348 print
'<div class="underbanner clearboth"></div>';
1351 print
'<table class="border tableforfield centpercent">'.
"\n";
1354 if (!empty($object->fk_user_create)) {
1355 $userCreate =
new User($db);
1356 $userCreate->fetch($object->fk_user_create);
1358 print
'<td class="titlefield">'.$langs->trans(
'RequestByCP').
'</td>';
1359 print
'<td>'.$userCreate->getNomUrl(-1).
'</td>';
1364 if (!$edit && $action !=
'editvalidator') {
1366 print
'<td class="titlefield">';
1368 print $langs->trans(
'ApprovedBy');
1370 print $langs->trans(
'ReviewedByCP');
1375 if ($object->fk_user_approve > 0) {
1376 $approverdone =
new User($db);
1377 $approverdone->fetch($object->fk_user_approve);
1378 print $approverdone->getNomUrl(-1);
1381 print $approverexpected->getNomUrl(-1);
1383 $include_users = $object->fetch_users_approver_holiday();
1385 print
'<a class="editfielda paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editvalidator">'.
img_edit($langs->trans(
"Edit")).
'</a>';
1391 print
'<td class="titlefield">'.$langs->trans(
'ReviewedByCP').
'</td>';
1393 $include_users = $object->fetch_users_approver_holiday();
1394 if (!in_array($object->fk_validator, $include_users)) {
1395 $include_users[] = $object->fk_validator;
1397 if (empty($include_users)) {
1398 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1400 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ?
'' : array($user->id));
1401 $s =
$form->select_dolusers($object->fk_validator,
"valideur", (($action ==
'editvalidator') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1402 print
$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1404 if ($action ==
'editvalidator') {
1405 print
'<input type="submit" class="button button-save" name="savevalidator" value="'.$langs->trans(
"Save").
'">';
1406 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1413 print
'<td>'.$langs->trans(
'DateCreation').
'</td>';
1414 print
'<td>'.dol_print_date($object->date_create,
'dayhour',
'tzuser').
'</td>';
1418 print
'<td>'.$langs->trans(
'DateValidCP').
'</td>';
1419 print
'<td>'.dol_print_date($object->date_approval,
'dayhour',
'tzuser').
'</td>';
1424 print
'<td>'.$langs->trans(
'DateCancelCP').
'</td>';
1425 print
'<td>'.dol_print_date($object->date_cancel,
'dayhour',
'tzuser').
'</td>';
1430 print
'<td>'.$langs->trans(
'DateRefusCP').
'</td>';
1431 print
'<td>'.dol_print_date($object->date_refuse,
'dayhour',
'tzuser').
'</td>';
1440 print
'<div class="clearboth"></div>';
1446 if ($action ==
'delete') {
1448 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleDeleteCP"), $langs->trans(
"ConfirmDeleteCP"),
"confirm_delete",
'', 0, 1);
1454 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleToValidCP"), $langs->trans(
"ConfirmToValidCP"),
"confirm_send",
'', 1, 1);
1458 if ($action ==
'valid') {
1459 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleValidCP"), $langs->trans(
"ConfirmValidCP"),
"confirm_valid",
'', 1, 1);
1463 if ($action ==
'refuse') {
1464 $array_input = array(array(
'type'=>
"text",
'label'=> $langs->trans(
'DetailRefusCP'),
'name'=>
"detail_refuse",
'size'=>
"50",
'value'=>
""));
1465 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id.
"&action=confirm_refuse", $langs->trans(
"TitleRefuseCP"), $langs->trans(
'ConfirmRefuseCP'),
"confirm_refuse", $array_input, 1, 0);
1469 if ($action ==
'cancel') {
1470 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleCancelCP"), $langs->trans(
"ConfirmCancelCP"),
"confirm_cancel",
'', 1, 1);
1474 if ($action ==
'backtodraft') {
1475 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleSetToDraft"), $langs->trans(
"ConfirmSetToDraft"),
"confirm_draft",
'', 1, 1);
1478 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1481 print
$form->buttonsSaveCancel();
1491 print
'<div class="tabsAction">';
1494 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'" class="butAction">'.$langs->trans(
"EditCP").
'</a>';
1498 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=sendToValidate&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Validate").
'</a>';
1503 if ($user->id == $object->fk_validator) {
1504 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Approve").
'</a>';
1505 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=refuse&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1507 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"Approve").
'</a>';
1508 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1511 if ($cancreate || $cancreateall) {
1512 if (($object->date_debut >
dol_now()) || !empty($user->admin)) {
1513 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1515 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1521 if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $cancreate || $cancreateall) {
1522 if (($object->date_debut >
dol_now()) || !empty($user->admin) || $user->id == $object->fk_user_approve) {
1523 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1525 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1528 if (!empty($user->admin)) {
1529 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1531 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1537 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=backtodraft" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1540 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1546 print
'<div class="tabBar">';
1547 print $langs->trans(
'ErrorUserViewCP');
1548 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1552 print
'<div class="tabBar">';
1553 print $langs->trans(
'ErrorIDFicheCP');
1554 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1560 if (
GETPOST(
'modelselected')) {
1561 $action =
'presend';
1564 if ($action !=
'presend' && $action !=
'edit') {
1565 print
'<div class="fichecenter"><div class="fichehalfleft">';
1566 print
'<a name="builddoc"></a>';
1568 $includedocgeneration = 0;
1571 if ($includedocgeneration) {
1573 $relativepath = $objref.
'/'.$objref.
'.pdf';
1574 $filedir = $conf->holiday->dir_output.
'/'.$object->element.
'/'.$objref;
1575 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1576 $genallowed = ($user->rights->holiday->read && $object->fk_user == $user->id) || !empty($user->rights->holiday->readall);
1577 $delallowed = ($user->rights->holiday->write && $object->fk_user == $user->id) || !empty($user->rights->holiday->writeall_advance);
1578 print $formfile->showdocuments(
'holiday:Holiday', $object->element.
'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
1586 print
'</div><div class="fichehalfright">';
1589 $morehtmlright =
'';
1592 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1594 $somethingshown =
$formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlright);
1596 print
'</div></div>';
1604 if (is_object($db)) {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
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_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.