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);
292 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
301 if ($action ==
'update' &&
GETPOSTISSET(
'savevalidator') && !empty($user->rights->holiday->approve)) {
306 $object->fk_validator =
GETPOST(
'valideur',
'int');
308 if ($object->fk_validator != $object->oldcopy->fk_validator) {
309 $verif = $object->update($user);
313 $action =
'editvalidator';
315 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
323 if ($action ==
'update' && !
GETPOSTISSET(
'savevalidator')) {
328 $starthalfday =
GETPOST(
'starthalfday');
329 $endhalfday =
GETPOST(
'endhalfday');
331 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
333 } elseif ($starthalfday ==
'afternoon') {
335 } elseif ($endhalfday ==
'morning') {
340 if (!$cancreateall) {
342 if (!in_array($fuserid, $childids)) {
344 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
349 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
360 $approverid =
GETPOST(
'valideur',
'int');
363 $description = trim(
GETPOST(
'description',
'restricthtml'));
367 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=nodatedebut');
373 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=nodatefin');
378 if ($date_debut > $date_fin) {
379 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=datefin');
384 if ($approverid < 1) {
385 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'&error=Valideur');
390 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
391 if ($nbopenedday < 0.5) {
392 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&error=DureeHoliday');
396 $object->description = $description;
397 $object->date_debut = $date_debut;
398 $object->date_fin = $date_fin;
399 $object->fk_validator = $approverid;
400 $object->halfday = $halfday;
403 $verif = $object->update($user);
409 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
423 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
432 $result = $object->delete($user);
441 header(
'Location: list.php?restore_lastsearch_values=1');
449 if ($action ==
'confirm_send') {
458 $verif = $object->validate($user);
463 $destinataire =
new User($db);
464 $destinataire->fetch($object->fk_validator);
465 $emailTo = $destinataire->email;
468 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
469 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
474 $expediteur =
new User($db);
475 $expediteur->fetch($object->fk_user);
477 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
480 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
481 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
482 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
485 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
488 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
490 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
494 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY)) {
495 $delayForRequest = 0;
496 if ($delayForRequest) {
499 if ($object->date_debut < $nowplusdelay) {
500 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
506 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE)) {
507 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
509 if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
510 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
514 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
517 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
518 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Period").
" : ".
dol_print_date($object->date_debut,
'day').
" ".$langs->transnoentitiesnoconv(
"To").
" ".
dol_print_date($object->date_fin,
'day').
"</li>\n";
519 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
520 $message .=
"</ul>\n";
522 $trackid =
'leav'.$object->id;
524 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
527 $result = $mail->sendfile();
533 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
543 if ($action ==
'update_extras') {
547 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
554 $result = $object->insertExtraFields(
'HOLIDAY_MODIFY');
562 $action =
'edit_extras';
567 if ($action ==
'confirm_valid') {
574 $object->date_approval =
dol_now();
575 $object->fk_user_approve = $user->id;
581 $verif = $object->approve($user);
590 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
591 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
592 $newSolde = ($soldeActuel - $nbopenedday);
593 $label = $langs->transnoentitiesnoconv(
"Holidays").
' - '.$object->ref;
596 $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type);
603 $result = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
612 $destinataire =
new User($db);
613 $destinataire->fetch($object->fk_user);
614 $emailTo = $destinataire->email;
617 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
620 $expediteur =
new User($db);
621 $expediteur->fetch($object->fk_validator);
623 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
626 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
627 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
628 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
631 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
634 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
636 $message .=
"<p>".$langs->transnoentities(
"HolidaysValidatedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
638 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
640 $message .=
"<ul>\n";
641 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
642 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
643 $message .=
"</ul>\n";
645 $trackid =
'leav'.$object->id;
647 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
650 $result = $mail->sendfile();
662 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
671 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
672 if (
GETPOST(
'detail_refuse')) {
677 $object->date_refuse =
dol_now();
678 $object->fk_user_refuse = $user->id;
681 $object->detail_refuse =
GETPOST(
'detail_refuse',
'alphanohtml');
685 $verif = $object->update($user);
694 $destinataire =
new User($db);
695 $destinataire->fetch($object->fk_user);
696 $emailTo = $destinataire->email;
699 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
702 $expediteur =
new User($db);
703 $expediteur->fetch($object->fk_validator);
705 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
708 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
709 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
710 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
713 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
716 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
718 $message .=
"<p>".$langs->transnoentities(
"HolidaysRefusedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"<p>\n";
719 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
721 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
723 $message .=
"<ul>\n";
724 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
725 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
728 $trackid =
'leav'.$object->id;
730 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
733 $result = $mail->sendfile();
747 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
755 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
762 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes') {
767 $oldstatus = $object->statut;
771 $result = $object->update($user);
774 setEventMessages($langs->trans(
'ErrorBackToDraft').
' '.$object->error, $object->errors,
'errors');
780 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
788 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
795 (!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) {
798 $oldstatus = $object->statut;
799 $object->date_cancel =
dol_now();
800 $object->fk_user_cancel = $user->id;
804 $result = $object->update($user);
808 $result = $object->call_trigger(
'HOLIDAY_CANCEL', $user);
814 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
816 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
817 $newSolde = ($soldeActuel + $nbopenedday);
820 $result1 = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv(
"HolidaysCancelation"), $newSolde, $object->fk_type);
823 $result2 = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
825 if ($result1 < 0 || $result2 < 0) {
827 setEventMessages($langs->trans(
'ErrorCantDeleteCP').
' '.$object->error, $object->errors,
'errors');
838 if (!$error && $result > 0) {
840 $destinataire =
new User($db);
841 $destinataire->fetch($object->fk_user);
842 $emailTo = $destinataire->email;
845 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
850 $expediteur =
new User($db);
851 $expediteur->fetch($object->fk_user_cancel);
853 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
856 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
857 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
858 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
861 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
864 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
866 $message .=
"<p>".$langs->transnoentities(
"HolidaysCanceledBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
868 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
870 $message .=
"<ul>\n";
871 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
872 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
873 $message .=
"</ul>\n";
875 $trackid =
'leav'.$object->id;
877 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
880 $result = $mail->sendfile();
886 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
919 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
921 $title = $langs->trans(
'Leave');
928 if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
930 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))))) {
931 $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');
969 print
'<script type="text/javascript">
970 $( document ).ready(function() {
971 $("input.button-save").click("submit", function(e) {
972 console.log("Call valider()");
973 if (document.demandeCP.date_debut_.value != "")
975 if(document.demandeCP.date_fin_.value != "")
977 if(document.demandeCP.valideur.value != "-1") {
981 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
987 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
993 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
1002 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
1003 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1004 print
'<input type="hidden" name="action" value="add" />'.
"\n";
1006 if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
1011 $typeleaves = $object->getTypes(1, 1);
1012 foreach ($typeleaves as $key => $val) {
1013 $nb_type = $object->getCPforUser($user->id, $val[
'rowid']);
1014 $nb_holiday += $nb_type;
1016 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1019 print $langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
'<br>';
1023 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
1024 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).
'<br>';
1031 print
'<table class="border centpercent">';
1036 print
'<td class="titlefield fieldrequired">'.$langs->trans(
"User").
'</td>';
1038 if ($cancreate && !$cancreateall) {
1039 print
img_picto(
'',
'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id),
'fuserid', 0,
'', 0,
'hierarchyme',
'',
'0,'.$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500');
1042 print
img_picto(
'',
'user').$form->select_dolusers($fuserid ? $fuserid : $user->id,
'fuserid', 0,
'', 0,
'',
'',
'0,'.$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500');
1049 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
1051 $typeleaves = $object->getTypes(1, -1);
1052 $arraytypeleaves = array();
1053 foreach ($typeleaves as $key => $val) {
1054 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
1055 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
1056 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
1058 print
$form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', true);
1060 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1067 print
'<td class="fieldrequired">';
1068 print
$form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
1072 if (!
GETPOST(
'date_debut_')) {
1073 print
$form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
1076 print
$form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
1078 print
' ';
1079 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
1085 print
'<td class="fieldrequired">';
1086 print
$form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
1090 print
$form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
1093 print
$form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
1095 print
' ';
1096 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
1102 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
1106 $include_users = $object->fetch_users_approver_holiday();
1107 if (empty($include_users)) {
1108 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1112 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1113 if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
1114 $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR;
1116 if (
GETPOST(
'valideur',
'int') > 0) {
1117 $defaultselectuser =
GETPOST(
'valideur',
'int');
1119 $s =
$form->select_dolusers($defaultselectuser,
"valideur", 1,
'', 0, $include_users,
'',
'0,'.$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
1120 print
img_picto(
'',
'user').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1129 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
1130 print
'<td class="tdtop">';
1131 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->fckeditor->enabled) ?
false : $conf->fckeditor->enabled, ROWS_3,
'90%');
1132 print $doleditor->Create(1);
1136 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1143 print
$form->buttonsSaveCancel(
"SendRequestCP");
1145 print
'</from>'.
"\n";
1149 print
'<div class="tabBar">';
1151 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1155 if (($id > 0) || $ref) {
1156 $result = $object->fetch($id, $ref);
1158 $approverexpected =
new User($db);
1159 $approverexpected->fetch($object->fk_validator);
1161 $userRequest =
new User($db);
1162 $userRequest->fetch($object->fk_user);
1170 $errors[] = $langs->transnoentitiesnoconv(
'ErrorEndDateCP');
1173 $errors[] = $langs->transnoentitiesnoconv(
'ErrorSQLCreateCP');
1176 $errors[] = $langs->transnoentitiesnoconv(
'CantCreateCP');
1179 $errors[] = $langs->transnoentitiesnoconv(
'InvalidValidatorCP');
1182 $errors[] = $langs->transnoentitiesnoconv(
'NoDateDebut');
1185 $errors[] = $langs->transnoentitiesnoconv(
'NoDateFin');
1187 case 'DureeHoliday':
1188 $errors[] = $langs->transnoentitiesnoconv(
'ErrorDureeCP');
1190 case 'NoMotifRefuse':
1191 $errors[] = $langs->transnoentitiesnoconv(
'NoMotifRefuseCP');
1194 $errors[] = $langs->transnoentitiesnoconv(
'ErrorMailNotSend');
1205 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1210 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">'.
"\n";
1211 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1212 print
'<input type="hidden" name="action" value="update"/>'.
"\n";
1213 print
'<input type="hidden" name="id" value="'.$object->id.
'" />'.
"\n";
1216 print
dol_get_fiche_head($head,
'card', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
1218 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1223 print
'<div class="fichecenter">';
1224 print
'<div class="fichehalfleft">';
1225 print
'<div class="underbanner clearboth"></div>';
1227 print
'<table class="border tableforfield centpercent">';
1232 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
1234 print $userRequest->getNomUrl(-1,
'leave');
1239 print
'<td>'.$langs->trans(
"Type").
'</td>';
1241 $typeleaves = $object->getTypes(1, -1);
1242 $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']);
1243 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
1247 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
1248 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
1252 print
'<td class="nowrap">';
1253 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1255 print
'<td>'.dol_print_date($object->date_debut,
'day');
1256 print
' ';
1257 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
1262 print
'<td class="nowrap">';
1263 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1266 print
$form->selectDate($object->date_debut,
'date_debut_');
1267 print
' ';
1268 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
1275 print
'<td class="nowrap">';
1276 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1278 print
'<td>'.dol_print_date($object->date_fin,
'day');
1279 print
' ';
1280 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
1285 print
'<td class="nowrap">';
1286 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1289 print
$form->selectDate($object->date_fin,
'date_fin_');
1290 print
' ';
1291 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
1299 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
1300 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
1301 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
1302 if ($includesaturday) {
1303 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
1305 if ($includesunday) {
1306 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
1308 print
$form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
1311 print
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
1317 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
1318 print
'<td>'.$object->detail_refuse.
'</td>';
1325 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1326 print
'<td>'.nl2br($object->description).
'</td>';
1330 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1331 print
'<td class="tdtop">';
1332 $doleditor =
new DolEditor(
'description', $object->description,
'', 80,
'dolibarr_notes',
'In', 0,
false, empty($conf->fckeditor->enabled) ?
false : $conf->fckeditor->enabled, ROWS_3,
'90%');
1333 print $doleditor->Create(1);
1338 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1341 print
'</table>'.
"\n";
1344 print
'<div class="fichehalfright">';
1346 print
'<div class="underbanner clearboth"></div>';
1349 print
'<table class="border tableforfield centpercent">'.
"\n";
1352 if (!empty($object->fk_user_create)) {
1353 $userCreate =
new User($db);
1354 $userCreate->fetch($object->fk_user_create);
1356 print
'<td class="titlefield">'.$langs->trans(
'RequestByCP').
'</td>';
1357 print
'<td>'.$userCreate->getNomUrl(-1).
'</td>';
1362 if (!$edit && $action !=
'editvalidator') {
1364 print
'<td class="titlefield">';
1366 print $langs->trans(
'ApprovedBy');
1368 print $langs->trans(
'ReviewedByCP');
1373 if ($object->fk_user_approve > 0) {
1374 $approverdone =
new User($db);
1375 $approverdone->fetch($object->fk_user_approve);
1376 print $approverdone->getNomUrl(-1);
1379 print $approverexpected->getNomUrl(-1);
1381 $include_users = $object->fetch_users_approver_holiday();
1383 print
'<a class="editfielda paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editvalidator">'.
img_edit($langs->trans(
"Edit")).
'</a>';
1389 print
'<td class="titlefield">'.$langs->trans(
'ReviewedByCP').
'</td>';
1391 $include_users = $object->fetch_users_approver_holiday();
1392 if (!in_array($object->fk_validator, $include_users)) {
1393 $include_users[] = $object->fk_validator;
1395 if (empty($include_users)) {
1396 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1398 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ?
'' : array($user->id));
1399 $s =
$form->select_dolusers($object->fk_validator,
"valideur", (($action ==
'editvalidator') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1400 print
$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1402 if ($action ==
'editvalidator') {
1403 print
'<input type="submit" class="button button-save" name="savevalidator" value="'.$langs->trans(
"Save").
'">';
1404 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1411 print
'<td>'.$langs->trans(
'DateCreation').
'</td>';
1412 print
'<td>'.dol_print_date($object->date_create,
'dayhour',
'tzuser').
'</td>';
1416 print
'<td>'.$langs->trans(
'DateValidCP').
'</td>';
1417 print
'<td>'.dol_print_date($object->date_approval,
'dayhour',
'tzuser').
'</td>';
1422 print
'<td>'.$langs->trans(
'DateCancelCP').
'</td>';
1423 print
'<td>'.dol_print_date($object->date_cancel,
'dayhour',
'tzuser').
'</td>';
1428 print
'<td>'.$langs->trans(
'DateRefusCP').
'</td>';
1429 print
'<td>'.dol_print_date($object->date_refuse,
'dayhour',
'tzuser').
'</td>';
1438 print
'<div class="clearboth"></div>';
1444 if ($action ==
'delete') {
1446 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleDeleteCP"), $langs->trans(
"ConfirmDeleteCP"),
"confirm_delete",
'', 0, 1);
1452 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleToValidCP"), $langs->trans(
"ConfirmToValidCP"),
"confirm_send",
'', 1, 1);
1456 if ($action ==
'valid') {
1457 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleValidCP"), $langs->trans(
"ConfirmValidCP"),
"confirm_valid",
'', 1, 1);
1461 if ($action ==
'refuse') {
1462 $array_input = array(array(
'type'=>
"text",
'label'=> $langs->trans(
'DetailRefusCP'),
'name'=>
"detail_refuse",
'size'=>
"50",
'value'=>
""));
1463 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id.
"&action=confirm_refuse", $langs->trans(
"TitleRefuseCP"), $langs->trans(
'ConfirmRefuseCP'),
"confirm_refuse", $array_input, 1, 0);
1467 if ($action ==
'cancel') {
1468 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleCancelCP"), $langs->trans(
"ConfirmCancelCP"),
"confirm_cancel",
'', 1, 1);
1472 if ($action ==
'backtodraft') {
1473 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleSetToDraft"), $langs->trans(
"ConfirmSetToDraft"),
"confirm_draft",
'', 1, 1);
1476 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1479 print
$form->buttonsSaveCancel();
1489 print
'<div class="tabsAction">';
1492 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'" class="butAction">'.$langs->trans(
"EditCP").
'</a>';
1496 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=sendToValidate&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Validate").
'</a>';
1501 if ($user->id == $object->fk_validator) {
1502 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Approve").
'</a>';
1503 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=refuse&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1505 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"Approve").
'</a>';
1506 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1509 if ($cancreate || $cancreateall) {
1510 if (($object->date_debut >
dol_now()) || !empty($user->admin)) {
1511 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1513 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1519 if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $cancreate || $cancreateall) {
1520 if (($object->date_debut >
dol_now()) || !empty($user->admin) || $user->id == $object->fk_user_approve) {
1521 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1523 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1526 if (!empty($user->admin)) {
1527 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1529 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1535 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=backtodraft" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1538 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1544 print
'<div class="tabBar">';
1545 print $langs->trans(
'ErrorUserViewCP');
1546 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1550 print
'<div class="tabBar">';
1551 print $langs->trans(
'ErrorIDFicheCP');
1552 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1558 if (
GETPOST(
'modelselected')) {
1559 $action =
'presend';
1562 if ($action !=
'presend' && $action !=
'edit') {
1563 print
'<div class="fichecenter"><div class="fichehalfleft">';
1564 print
'<a name="builddoc"></a>';
1566 $includedocgeneration = 0;
1569 if ($includedocgeneration) {
1571 $relativepath = $objref.
'/'.$objref.
'.pdf';
1572 $filedir = $conf->holiday->dir_output.
'/'.$object->element.
'/'.$objref;
1573 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1574 $genallowed = ($user->rights->holiday->read && $object->fk_user == $user->id) || !empty($user->rights->holiday->readall);
1575 $delallowed = ($user->rights->holiday->write && $object->fk_user == $user->id) || !empty($user->rights->holiday->writeall_advance);
1576 print $formfile->showdocuments(
'holiday:Holiday', $object->element.
'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
1584 print
'</div><div class="fichehalfright">';
1587 $morehtmlright =
'';
1590 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1592 $somethingshown =
$formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlright);
1594 print
'</div></div>';
1602 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.