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');
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);
67 if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) {
68 $morefilter =
'AND employee = 1';
76 $extrafields->fetch_name_optionals_label($object->table_element);
78 if (($id > 0) || $ref) {
79 $object->fetch($id, $ref);
83 if (!empty($user->rights->holiday->readall)) {
86 if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) {
95 $hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
99 if (!empty($user->rights->holiday->write) && in_array($fuserid, $childids)) {
102 if (!empty($user->rights->holiday->writeall)) {
108 if (!empty($user->rights->holiday->delete)) {
111 if ($object->statut ==
Holiday::STATUS_DRAFT && $user->rights->holiday->write && in_array($object->fk_user, $childids)) {
117 $socid = $user->socid;
119 $result =
restrictedArea($user,
'holiday', $object->id,
'holiday',
'',
'',
'rowid', $object->statut);
127 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
132 if (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) {
191 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
192 if (empty($user->rights->holiday->write)) {
195 } elseif (!in_array($fuserid, $childids)) {
201 if (empty($user->rights->holiday->write) && empty($user->rights->holiday->writeall_advance)) {
204 } elseif (empty($user->rights->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;
283 $result = $object->create($user);
294 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
303 if ($action ==
'update' &&
GETPOSTISSET(
'savevalidator') && !empty($user->rights->holiday->approve)) {
308 $object->fk_validator =
GETPOST(
'valideur',
'int');
310 if ($object->fk_validator != $object->oldcopy->fk_validator) {
311 $verif = $object->update($user);
315 $action =
'editvalidator';
317 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
325 if ($action ==
'update' && !
GETPOSTISSET(
'savevalidator')) {
330 $starthalfday =
GETPOST(
'starthalfday');
331 $endhalfday =
GETPOST(
'endhalfday');
333 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
335 } elseif ($starthalfday ==
'afternoon') {
337 } elseif ($endhalfday ==
'morning') {
342 if (!$cancreateall) {
344 if (!in_array($fuserid, $childids)) {
346 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
351 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
362 $approverid =
GETPOST(
'valideur',
'int');
365 $description = trim(
GETPOST(
'description',
'restricthtml'));
375 if ($date_debut > $date_fin) {
382 if ($approverid < 1) {
389 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
390 if ($nbopenedday < 0.5) {
399 $object->description = $description;
400 $object->date_debut = $date_debut;
401 $object->date_fin = $date_fin;
402 $object->fk_validator = $approverid;
403 $object->halfday = $halfday;
406 $verif = $object->update($user);
418 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
434 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
443 $result = $object->delete($user);
452 header(
'Location: list.php?restore_lastsearch_values=1');
460 if ($action ==
'confirm_send') {
469 $verif = $object->validate($user);
474 $destinataire =
new User($db);
475 $destinataire->fetch($object->fk_validator);
476 $emailTo = $destinataire->email;
479 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
480 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
485 $expediteur =
new User($db);
486 $expediteur->fetch($object->fk_user);
488 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
491 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
492 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
493 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
496 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
499 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
501 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
505 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY)) {
506 $delayForRequest = 0;
507 if ($delayForRequest) {
510 if ($object->date_debut < $nowplusdelay) {
511 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
517 if (empty($conf->global->HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE)) {
518 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
520 if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
521 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
525 $typeleaves = $object->getTypes(1, -1);
526 $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']);
528 if ($object->halfday == 2) {
529 $starthalfdaykey =
"Afternoon";
530 $endhalfdaykey =
"Morning";
531 } elseif ($object->halfday == -1) {
532 $starthalfdaykey =
"Afternoon";
533 $endhalfdaykey =
"Afternoon";
534 } elseif ($object->halfday == 1) {
535 $starthalfdaykey =
"Morning";
536 $endhalfdaykey =
"Morning";
537 } elseif ($object->halfday == 2) {
538 $starthalfdaykey =
"Morning";
539 $endhalfdaykey =
"Afternoon";
542 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
545 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
546 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow).
"</li>\n";
547 $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";
548 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
549 $message .=
"</ul>\n";
551 $trackid =
'leav'.$object->id;
553 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
556 $result = $mail->sendfile();
562 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
572 if ($action ==
'update_extras') {
576 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
583 $result = $object->insertExtraFields(
'HOLIDAY_MODIFY');
591 $action =
'edit_extras';
596 if ($action ==
'confirm_valid') {
603 $object->date_approval =
dol_now();
604 $object->fk_user_approve = $user->id;
610 $verif = $object->approve($user);
619 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
620 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
621 $newSolde = ($soldeActuel - $nbopenedday);
622 $label = $langs->transnoentitiesnoconv(
"Holidays").
' - '.$object->ref;
625 $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type);
632 $result = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
641 $destinataire =
new User($db);
642 $destinataire->fetch($object->fk_user);
643 $emailTo = $destinataire->email;
646 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
649 $expediteur =
new User($db);
650 $expediteur->fetch($object->fk_validator);
652 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
655 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
656 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
657 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
660 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
663 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
665 $message .=
"<p>".$langs->transnoentities(
"HolidaysValidatedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
667 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
669 $message .=
"<ul>\n";
670 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
671 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
672 $message .=
"</ul>\n";
674 $trackid =
'leav'.$object->id;
676 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
679 $result = $mail->sendfile();
691 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
700 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
701 if (
GETPOST(
'detail_refuse')) {
706 $object->date_refuse =
dol_now();
707 $object->fk_user_refuse = $user->id;
710 $object->detail_refuse =
GETPOST(
'detail_refuse',
'alphanohtml');
714 $verif = $object->update($user);
723 $destinataire =
new User($db);
724 $destinataire->fetch($object->fk_user);
725 $emailTo = $destinataire->email;
728 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
731 $expediteur =
new User($db);
732 $expediteur->fetch($object->fk_validator);
734 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
737 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
738 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
739 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
742 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
745 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
747 $message .=
"<p>".$langs->transnoentities(
"HolidaysRefusedBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"<p>\n";
748 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
750 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
752 $message .=
"<ul>\n";
753 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
754 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
757 $trackid =
'leav'.$object->id;
759 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
762 $result = $mail->sendfile();
776 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
784 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
791 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes') {
796 $oldstatus = $object->statut;
800 $result = $object->update($user);
803 setEventMessages($langs->trans(
'ErrorBackToDraft').
' '.$object->error, $object->errors,
'errors');
809 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
817 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
824 (!empty($user->admin) || $user->id == $object->fk_validator || $cancreate || $cancreateall)) {
827 $oldstatus = $object->statut;
828 $object->date_cancel =
dol_now();
829 $object->fk_user_cancel = $user->id;
833 $result = $object->update($user);
837 $result = $object->call_trigger(
'HOLIDAY_CANCEL', $user);
843 $nbopenedday =
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
845 $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type);
846 $newSolde = ($soldeActuel + $nbopenedday);
849 $result1 = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv(
"HolidaysCancelation"), $newSolde, $object->fk_type);
852 $result2 = $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
854 if ($result1 < 0 || $result2 < 0) {
856 setEventMessages($langs->trans(
'ErrorCantDeleteCP').
' '.$object->error, $object->errors,
'errors');
867 if (!$error && $result > 0) {
869 $destinataire =
new User($db);
870 $destinataire->fetch($object->fk_user);
871 $emailTo = $destinataire->email;
874 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
879 $expediteur =
new User($db);
880 $expediteur->fetch($object->fk_user_cancel);
882 $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
885 $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
886 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
887 $societeName = $conf->global->MAIN_APPLICATION_TITLE;
890 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
893 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
895 $message .=
"<p>".$langs->transnoentities(
"HolidaysCanceledBody",
dol_print_date($object->date_debut,
'day'),
dol_print_date($object->date_fin,
'day')).
"</p>\n";
897 $link =
dol_buildpath(
'/holiday/card.php', 3).
'?id='.$object->id;
899 $message .=
"<ul>\n";
900 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
901 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
902 $message .=
"</ul>\n";
904 $trackid =
'leav'.$object->id;
906 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'',
'', 0, 1,
'',
'', $trackid);
909 $result = $mail->sendfile();
915 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
948 $listhalfday = array(
'morning'=>$langs->trans(
"Morning"),
"afternoon"=>$langs->trans(
"Afternoon"));
950 $title = $langs->trans(
'Leave');
957 if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
959 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))))) {
960 $errors[] = $langs->trans(
'CantCreateCP');
969 $errors[] = $langs->trans(
'ErrorEndDateCP');
972 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
975 $errors[] = $langs->trans(
'CantCreateCP');
978 $errors[] = $langs->trans(
'InvalidValidatorCP');
981 $errors[] = $langs->trans(
'NoDateDebut');
984 $errors[] = $langs->trans(
'NoDateFin');
987 $errors[] = $langs->trans(
'ErrorDureeCP');
990 $errors[] = $langs->trans(
'alreadyCPexist');
998 print
'<script type="text/javascript">
999 $( document ).ready(function() {
1000 $("input.button-save").click("submit", function(e) {
1001 console.log("Call valider()");
1002 if (document.demandeCP.date_debut_.value != "")
1004 if(document.demandeCP.date_fin_.value != "")
1006 if(document.demandeCP.valideur.value != "-1") {
1010 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
1016 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
1022 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
1031 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
1032 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1033 print
'<input type="hidden" name="action" value="add" />'.
"\n";
1039 print
'<table class="border centpercent">';
1044 print
'<td class="titlefield fieldrequired tdtop">'.$langs->trans(
"User").
'</td>';
1045 print
'<td><div class="inline-block">';
1046 if ($cancreate && !$cancreateall) {
1047 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');
1050 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');
1054 if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
1055 print
'<div class="leaveuserbalance paddingtop inline-block floatright badge badge-status0 badge-status margintoponsmartphone">';
1059 $typeleaves = $object->getTypes(1, 1);
1060 foreach ($typeleaves as $key => $val) {
1061 $nb_type = $object->getCPforUser(($fuserid ? $fuserid : $user->id), $val[
'rowid']);
1062 $nb_holiday += $nb_type;
1064 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1067 print
' ';
1069 $htmltooltip = $langs->trans(
"Detail").
'<br>';
1070 $htmltooltip .= $out;
1072 print
$form->textwithtooltip($langs->trans(
'SoldeCPUser', round($nb_holiday, 5)).
' '.
img_picto(
'',
'help'), $htmltooltip);
1075 if (!empty($conf->use_javascript_ajax)) {
1077 print
'$( document ).ready(function() {
1078 jQuery("#fuserid").change(function() {
1079 console.log("We change to user id "+jQuery("#fuserid").val());
1080 if (jQuery("#fuserid").val() == '.((int) $user->id).
') {
1081 jQuery(".leaveuserbalance").show();
1083 jQuery(".leaveuserbalance").hide();
1089 } elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
1090 print
'<div class="leaveuserbalance paddingtop">';
1091 print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE);
1100 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
1102 $typeleaves = $object->getTypes(1, -1);
1103 $arraytypeleaves = array();
1104 foreach ($typeleaves as $key => $val) {
1105 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
1106 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
1107 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
1109 print
$form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', true);
1111 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1118 print
'<td class="fieldrequired">';
1119 print
$form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
1121 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1122 if (!
GETPOST(
'date_debut_')) {
1123 print
$form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
1126 print
$form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
1128 print
' ';
1129 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
1135 print
'<td class="fieldrequired">';
1136 print
$form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
1138 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1140 print
$form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
1143 print
$form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
1145 print
' ';
1146 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
1152 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
1156 $include_users = $object->fetch_users_approver_holiday();
1157 if (empty($include_users)) {
1158 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1162 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1163 if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
1164 $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR;
1166 if (
GETPOST(
'valideur',
'int') > 0) {
1167 $defaultselectuser =
GETPOST(
'valideur',
'int');
1169 $s =
$form->select_dolusers($defaultselectuser,
"valideur", 1,
'', 0, $include_users,
'',
'0,'.$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
1170 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1179 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
1180 print
'<td class="tdtop">';
1181 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In', 0,
false,
isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1182 print $doleditor->Create(1);
1186 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1193 print
$form->buttonsSaveCancel(
"SendRequestCP");
1195 print
'</from>'.
"\n";
1198 if ($error && $action !=
'edit') {
1199 print
'<div class="tabBar">';
1201 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1205 if (($id > 0) || $ref) {
1206 $result = $object->fetch($id, $ref);
1208 $approverexpected =
new User($db);
1209 $approverexpected->fetch($object->fk_validator);
1211 $userRequest =
new User($db);
1212 $userRequest->fetch($object->fk_user);
1220 $errors[] = $langs->transnoentitiesnoconv(
'ErrorEndDateCP');
1223 $errors[] = $langs->transnoentitiesnoconv(
'ErrorSQLCreateCP');
1226 $errors[] = $langs->transnoentitiesnoconv(
'CantCreateCP');
1229 $errors[] = $langs->transnoentitiesnoconv(
'InvalidValidatorCP');
1232 $errors[] = $langs->transnoentitiesnoconv(
'NoDateDebut');
1235 $errors[] = $langs->transnoentitiesnoconv(
'NoDateFin');
1237 case 'DureeHoliday':
1238 $errors[] = $langs->transnoentitiesnoconv(
'ErrorDureeCP');
1240 case 'NoMotifRefuse':
1241 $errors[] = $langs->transnoentitiesnoconv(
'NoMotifRefuseCP');
1244 $errors[] = $langs->transnoentitiesnoconv(
'ErrorMailNotSend');
1255 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1260 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">'.
"\n";
1261 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1262 print
'<input type="hidden" name="action" value="update"/>'.
"\n";
1263 print
'<input type="hidden" name="id" value="'.$object->id.
'" />'.
"\n";
1266 print
dol_get_fiche_head($head,
'card', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
1268 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1273 print
'<div class="fichecenter">';
1274 print
'<div class="fichehalfleft">';
1275 print
'<div class="underbanner clearboth"></div>';
1277 print
'<table class="border tableforfield centpercent">';
1282 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
1284 print $userRequest->getNomUrl(-1,
'leave');
1289 print
'<td>'.$langs->trans(
"Type").
'</td>';
1291 $typeleaves = $object->getTypes(1, -1);
1292 $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']);
1293 print empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow;
1297 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ?
'afternoon' :
'morning';
1298 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ?
'morning' :
'afternoon';
1302 print
'<td class="nowrap">';
1303 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1305 print
'<td>'.dol_print_date($object->date_debut,
'day');
1306 print
' ';
1307 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
1312 print
'<td class="nowrap">';
1313 print
$form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1317 print
$form->selectDate($tmpdate ? $tmpdate : $object->date_debut,
'date_debut_');
1318 print
' ';
1319 print
$form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
1326 print
'<td class="nowrap">';
1327 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1329 print
'<td>'.dol_print_date($object->date_fin,
'day');
1330 print
' ';
1331 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
1336 print
'<td class="nowrap">';
1337 print
$form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1340 print
$form->selectDate($object->date_fin,
'date_fin_');
1341 print
' ';
1342 print
$form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
1350 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
1351 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
1352 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
1353 if ($includesaturday) {
1354 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
1356 if ($includesunday) {
1357 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
1359 print
$form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
1362 print
num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
1368 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
1369 print
'<td>'.$object->detail_refuse.
'</td>';
1376 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1377 print
'<td>'.nl2br($object->description).
'</td>';
1381 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1382 print
'<td class="tdtop">';
1383 $doleditor =
new DolEditor(
'description', $object->description,
'', 80,
'dolibarr_notes',
'In', 0,
false,
isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1384 print $doleditor->Create(1);
1389 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1392 print
'</table>'.
"\n";
1395 print
'<div class="fichehalfright">';
1397 print
'<div class="underbanner clearboth"></div>';
1400 print
'<table class="border tableforfield centpercent">'.
"\n";
1403 if (!empty($object->fk_user_create)) {
1404 $userCreate =
new User($db);
1405 $userCreate->fetch($object->fk_user_create);
1407 print
'<td class="titlefield">'.$langs->trans(
'RequestByCP').
'</td>';
1408 print
'<td>'.$userCreate->getNomUrl(-1).
'</td>';
1413 if (!$edit && $action !=
'editvalidator') {
1415 print
'<td class="titlefield">';
1417 print $langs->trans(
'ApprovedBy');
1419 print $langs->trans(
'ReviewedByCP');
1424 if ($object->fk_user_approve > 0) {
1425 $approverdone =
new User($db);
1426 $approverdone->fetch($object->fk_user_approve);
1427 print $approverdone->getNomUrl(-1);
1430 print $approverexpected->getNomUrl(-1);
1432 $include_users = $object->fetch_users_approver_holiday();
1434 print
'<a class="editfielda paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=editvalidator">'.
img_edit($langs->trans(
"Edit")).
'</a>';
1440 print
'<td class="titlefield">'.$langs->trans(
'ReviewedByCP').
'</td>';
1442 $include_users = $object->fetch_users_approver_holiday();
1443 if (!in_array($object->fk_validator, $include_users)) {
1444 $include_users[] = $object->fk_validator;
1446 if (empty($include_users)) {
1447 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1449 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ?
'' : array($user->id));
1450 $s =
$form->select_dolusers($object->fk_validator,
"valideur", (($action ==
'editvalidator') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1451 print
$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1453 if ($action ==
'editvalidator') {
1454 print
'<input type="submit" class="button button-save" name="savevalidator" value="'.$langs->trans(
"Save").
'">';
1455 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1462 print
'<td>'.$langs->trans(
'DateCreation').
'</td>';
1463 print
'<td>'.dol_print_date($object->date_create,
'dayhour',
'tzuser').
'</td>';
1467 print
'<td>'.$langs->trans(
'DateValidCP').
'</td>';
1468 print
'<td>'.dol_print_date($object->date_approval,
'dayhour',
'tzuser').
'</td>';
1473 print
'<td>'.$langs->trans(
'DateCancelCP').
'</td>';
1474 print
'<td>'.dol_print_date($object->date_cancel,
'dayhour',
'tzuser').
'</td>';
1479 print
'<td>'.$langs->trans(
'DateRefusCP').
'</td>';
1480 print
'<td>'.dol_print_date($object->date_refuse,
'dayhour',
'tzuser').
'</td>';
1489 print
'<div class="clearboth"></div>';
1495 if ($action ==
'delete') {
1497 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleDeleteCP"), $langs->trans(
"ConfirmDeleteCP"),
"confirm_delete",
'', 0, 1);
1503 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleToValidCP"), $langs->trans(
"ConfirmToValidCP"),
"confirm_send",
'', 1, 1);
1507 if ($action ==
'valid') {
1508 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleValidCP"), $langs->trans(
"ConfirmValidCP"),
"confirm_valid",
'', 1, 1);
1512 if ($action ==
'refuse') {
1513 $array_input = array(array(
'type'=>
"text",
'label'=> $langs->trans(
'DetailRefusCP'),
'name'=>
"detail_refuse",
'size'=>
"50",
'value'=>
""));
1514 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id.
"&action=confirm_refuse", $langs->trans(
"TitleRefuseCP"), $langs->trans(
'ConfirmRefuseCP'),
"confirm_refuse", $array_input, 1, 0);
1518 if ($action ==
'cancel') {
1519 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleCancelCP"), $langs->trans(
"ConfirmCancelCP"),
"confirm_cancel",
'', 1, 1);
1523 if ($action ==
'backtodraft') {
1524 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
"TitleSetToDraft"), $langs->trans(
"ConfirmSetToDraft"),
"confirm_draft",
'', 1, 1);
1527 if (($action ==
'edit' && $object->statut ==
Holiday::STATUS_DRAFT) || ($action ==
'editvalidator')) {
1530 print
$form->buttonsSaveCancel();
1540 print
'<div class="tabsAction">';
1543 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'" class="butAction">'.$langs->trans(
"EditCP").
'</a>';
1547 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=sendToValidate&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Validate").
'</a>';
1552 if ($user->id == $object->fk_validator) {
1553 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=valid&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Approve").
'</a>';
1554 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=refuse&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1556 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"Approve").
'</a>';
1557 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1560 if ($cancreate || $cancreateall) {
1561 if (($object->date_debut >
dol_now()) || !empty($user->admin)) {
1562 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1564 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1570 if ($user->id == $object->fk_validator || $user->id == $object->fk_user_approve || $cancreate || $cancreateall) {
1571 if (($object->date_debut >
dol_now()) || !empty($user->admin) || $user->id == $object->fk_user_approve) {
1572 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1574 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
'-'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1577 if (!empty($user->admin)) {
1578 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1580 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1586 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=backtodraft" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1589 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delete&token='.
newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1595 print
'<div class="tabBar">';
1596 print $langs->trans(
'ErrorUserViewCP');
1597 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1601 print
'<div class="tabBar">';
1602 print $langs->trans(
'ErrorIDFicheCP');
1603 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1609 if (
GETPOST(
'modelselected')) {
1610 $action =
'presend';
1613 if ($action !=
'presend' && $action !=
'edit') {
1614 print
'<div class="fichecenter"><div class="fichehalfleft">';
1615 print
'<a name="builddoc"></a>';
1617 $includedocgeneration = 0;
1620 if ($includedocgeneration) {
1622 $relativepath = $objref.
'/'.$objref.
'.pdf';
1623 $filedir = $conf->holiday->dir_output.
'/'.$object->element.
'/'.$objref;
1624 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
1625 $genallowed = ($user->rights->holiday->read && $object->fk_user == $user->id) || !empty($user->rights->holiday->readall);
1626 $delallowed = ($user->rights->holiday->write && $object->fk_user == $user->id) || !empty($user->rights->holiday->writeall_advance);
1627 print $formfile->showdocuments(
'holiday:Holiday', $object->element.
'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
1635 print
'</div><div class="fichehalfright">';
1638 $morehtmlright =
'';
1641 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1643 $somethingshown =
$formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlright);
1645 print
'</div></div>';
1653 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.
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.
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.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
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.