35require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
56$action =
GETPOST(
'action',
'aZ09');
57$cancel =
GETPOST(
'cancel',
'alpha');
58$confirm =
GETPOST(
'confirm',
'alpha');
59$backtopage =
GETPOST(
'backtopage',
'alpha');
60$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
64$fuserid = (
GETPOSTINT(
'fuserid') ?
GETPOSTINT(
'fuserid') : ($action ==
'create' ? $user->id : 0));
68$langs->loadLangs(array(
"other",
"holiday",
"mails",
"trips"));
75$childids = $user->getAllChildIds(1);
79 $morefilter =
'AND employee = 1';
87$extrafields->fetch_name_optionals_label(
$object->table_element);
90$hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
92$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
95if (($id > 0) || $ref) {
102 if ($user->hasRight(
'holiday',
'readall')) {
105 if ($user->hasRight(
'holiday',
'read') && in_array(
$object->fk_user, $childids)) {
108 if ($permissiontoapprove &&
$object->fk_validator == $user->id && !
getDolGlobalString(
'HOLIDAY_CAN_APPROVE_ONLY_THE_SUBORDINATES')) {
120$permissiontoaddall = 0;
121if ($user->hasRight(
'holiday',
'write') && in_array($fuserid, $childids)) {
122 $permissiontoadd = 1;
124if ($user->hasRight(
'holiday',
'writeall')) {
125 $permissiontoadd = 1;
126 $permissiontoaddall = 1;
128$permissiontoeditextra = $permissiontoadd;
129if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
131 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
135if ($user->hasRight(
'holiday',
'delete')) {
144 $socid = $user->socid;
153$parameters = array(
'socid' => $socid);
154$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
159if (empty($reshook)) {
160 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
162 if (empty($backtopage) || ($cancel && empty($id))) {
163 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
164 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
165 $backtopage = $backurlforlist;
167 $backtopage = DOL_URL_ROOT.
'/holiday/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
173 if (!empty($backtopageforcancel)) {
174 header(
"Location: ".$backtopageforcancel);
176 } elseif (!empty($backtopage)) {
177 header(
"Location: ".$backtopage);
184 if ($action ==
'add' && $permissiontoadd) {
189 $date_debut =
GETPOSTDATE(
'date_debut_',
'00:00:00');
191 $date_debut_gmt =
GETPOSTDATE(
'date_debut_',
'00:00:00', 1);
192 $date_fin_gmt =
GETPOSTDATE(
'date_fin_',
'00:00:00', 1);
193 $starthalfday =
GETPOST(
'starthalfday');
194 $endhalfday =
GETPOST(
'endhalfday');
197 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
199 } elseif ($starthalfday ==
'afternoon') {
201 } elseif ($endhalfday ==
'morning') {
206 $description = trim(
GETPOST(
'description',
'restricthtml'));
209 if (!$permissiontoaddall) {
211 if (!$user->hasRight(
'holiday',
'write')) {
214 } elseif (!in_array($fuserid, $childids)) {
220 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall_advance')) {
223 } elseif (!$user->hasRight(
'holiday',
'writeall_advance') && !in_array($fuserid, $childids)) {
233 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
239 if (empty($date_debut)) {
245 if (empty($date_fin)) {
251 if ($date_debut > $date_fin) {
258 $verifCP =
$object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
266 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
267 if ($nbopenedday < 0.5) {
274 if ($approverid < 1) {
275 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
279 $approverslist =
$object->fetch_users_approver_holiday();
280 if (!in_array($approverid, $approverslist)) {
281 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidator'),
null,
'errors');
286 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
295 $object->description = $description;
296 $object->fk_validator = $approverid;
298 $object->date_debut = $date_debut;
303 $result =
$object->create($user);
314 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
322 if ($action ==
'update' && GETPOSTISSET(
'savevalidator') && $permissiontoapprove) {
330 $verif =
$object->update($user);
334 $action =
'editvalidator';
336 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
344 if ($action ==
'update' && !GETPOSTISSET(
'savevalidator')) {
345 $date_debut =
GETPOSTDATE(
'date_debut_',
'00:00:00');
347 $date_debut_gmt =
GETPOSTDATE(
'date_debut_',
'00:00:00', 1);
348 $date_fin_gmt =
GETPOSTDATE(
'date_fin_',
'00:00:00', 1);
349 $starthalfday =
GETPOST(
'starthalfday');
350 $endhalfday =
GETPOST(
'endhalfday');
352 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
354 } elseif ($starthalfday ==
'afternoon') {
356 } elseif ($endhalfday ==
'morning') {
361 if (!$permissiontoaddall) {
362 if ($permissiontoadd) {
363 if (!in_array($fuserid, $childids)) {
365 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
370 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
380 if ($permissiontoadd) {
384 $description = trim(
GETPOST(
'description',
'restricthtml'));
394 if ($date_debut > $date_fin) {
401 if ($approverid < 1) {
408 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
409 if ($nbopenedday < 0.5) {
418 $object->description = $description;
419 $object->date_debut = $date_debut;
421 $object->fk_validator = $approverid;
425 $verif =
$object->update($user);
437 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
453 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
462 $result =
$object->delete($user);
471 header(
'Location: list.php?restore_lastsearch_values=1');
479 if ($action ==
'confirm_send') {
488 $verif =
$object->validate($user);
493 $destinataire =
new User($db);
494 $destinataire->fetch(
$object->fk_validator);
495 $emailTo = $destinataire->email;
498 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
499 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
504 $expediteur =
new User($db);
505 $expediteur->fetch(
$object->fk_user);
515 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
518 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
520 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
525 $delayForRequest = 0;
526 if ($delayForRequest) {
529 if (
$object->date_debut < $nowplusdelay) {
530 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", $delayForRequest).
"</p>\n";
539 $affectingtypes =
$object->getTypes(1, 1);
540 if (!empty($affectingtypes[
$object->fk_type])) {
544 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
549 $typeleaves =
$object->getTypes(1, -1);
550 if (empty($typeleaves[
$object->fk_type])) {
551 $labeltoshow = $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type);
553 $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']);
556 $starthalfdaykey =
"Afternoon";
557 $endhalfdaykey =
"Morning";
558 } elseif (
$object->halfday == -1) {
559 $starthalfdaykey =
"Afternoon";
560 $endhalfdaykey =
"Afternoon";
561 } elseif (
$object->halfday == 1) {
562 $starthalfdaykey =
"Morning";
563 $endhalfdaykey =
"Morning";
565 $starthalfdaykey =
"Morning";
566 $endhalfdaykey =
"Afternoon";
568 $starthalfdaykey =
"";
572 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
575 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
576 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type) : $labeltoshow).
"</li>\n";
577 $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";
578 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
579 $message .=
"</ul>\n";
581 $trackid =
'leav'.$object->id;
585 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
588 $result = $mail->sendfile();
594 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
604 if ($action ==
'update_extras' && $permissiontoeditextra) {
607 $attribute_name =
GETPOST(
'attribute',
'aZ09');
610 $ret = $extrafields->setOptionalsFromPost(
null,
$object, $attribute_name);
616 $result =
$object->updateExtraField($attribute_name,
'HOLIDAY_MODIFY');
624 $action =
'edit_extras';
629 if ($action ==
'confirm_valid' && $permissiontoapprove) {
637 $object->fk_user_approve = $user->id;
645 $verif =
$object->approve($user);
652 if (!$error && empty($decrease)) {
656 $newSolde = ($soldeActuel - $nbopenedday);
657 $label =
$object->ref.
' - '.$langs->transnoentitiesnoconv(
"HolidayConsumption");
676 $destinataire =
new User($db);
677 $destinataire->fetch(
$object->fk_user);
678 $emailTo = $destinataire->email;
681 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
684 $expediteur =
new User($db);
685 $expediteur->fetch(
$object->fk_validator);
695 $subject =
'['.$societeName.
"] ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
698 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
704 $message .=
"<ul>\n";
705 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
706 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
707 $message .=
"</ul>\n";
709 $trackid =
'leav'.$object->id;
713 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
716 $result = $mail->sendfile();
732 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
737 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoapprove) {
738 if (
GETPOST(
'detail_refuse')) {
744 $object->fk_user_refuse = $user->id;
751 $verif =
$object->update($user);
760 $destinataire =
new User($db);
761 $destinataire->fetch(
$object->fk_user);
762 $emailTo = $destinataire->email;
765 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
768 $expediteur =
new User($db);
769 $expediteur->fetch(
$object->fk_validator);
779 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
782 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
785 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
789 $message .=
"<ul>\n";
790 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
791 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
794 $trackid =
'leav'.$object->id;
798 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
801 $result = $mail->sendfile();
815 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
823 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
830 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes' && $permissiontoadd) {
836 if (!$user->hasRight(
'holiday',
'writeall') && !($user->hasRight(
'holiday',
'write') && in_array(
$object->fk_user, $childids))) {
841 setEventMessages($langs->trans(
'StatusOfRefMustBe',
$object->ref, $langs->transnoentitiesnoconv(
'Canceled')),
null,
'errors');
849 $result =
$object->update($user);
859 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
868 setEventMessages($langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed"),
null,
'errors');
873 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
880 ($user->id ==
$object->fk_validator || $permissiontoadd || $permissiontoaddall || $permissiontoapprove)) {
885 $object->fk_user_cancel = $user->id;
891 $result =
$object->update($user);
895 $result =
$object->call_trigger(
'HOLIDAY_CANCEL', $user);
900 $startDate =
$object->date_debut_gmt;
901 $endDate =
$object->date_fin_gmt;
902 $alreadydebited =
true;
904 if (!empty($decrease)) {
906 $date = strtotime(
'-1 month', $lastUpdate);
907 $endOfMonthBeforeLastUpdate =
dol_mktime(0, 0, 0, (
int) date(
'm', $date), (
int) date(
't', $date), (
int) date(
'Y', $date), 1);
908 if (
$object->date_debut_gmt < $endOfMonthBeforeLastUpdate &&
$object->date_fin_gmt > $endOfMonthBeforeLastUpdate) {
909 $endDate = $endOfMonthBeforeLastUpdate;
910 } elseif (
$object->date_debut_gmt > $endOfMonthBeforeLastUpdate) {
911 $alreadydebited =
false;
918 if (!$alreadydebited) {
922 $newSolde = ($soldeActuel + $nbopenedday);
925 $result1 =
$object->addLogCP($user->id,
$object->fk_user,
$object->ref.
' - '.$langs->transnoentitiesnoconv(
"HolidayCreditAfterCancellation"), $newSolde,
$object->fk_type);
930 if ($result1 < 0 || $result2 < 0) {
943 if (!$error && $result > 0) {
945 $destinataire =
new User($db);
946 $destinataire->fetch(
$object->fk_user);
947 $emailTo = $destinataire->email;
950 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
955 $expediteur =
new User($db);
956 $expediteur->fetch(
$object->fk_user_cancel);
966 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
969 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
975 $message .=
"<ul>\n";
976 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
977 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
978 $message .=
"</ul>\n";
980 $trackid =
'leav'.$object->id;
984 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
987 $result = $mail->sendfile();
993 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
1023$form =
new Form($db);
1027$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
1029$title = $langs->trans(
'Leave');
1030$help_url =
'EN:Module_Holiday';
1032llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card');
1036if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
1038 if ((in_array($fuserid, $childids) && !$user->hasRight(
'holiday',
'write')) || (!in_array($fuserid, $childids) && ((
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'holiday',
'writeall_advance') || !$user->hasRight(
'holiday',
'writeall'))))) {
1039 $errors[] = $langs->trans(
'CantCreateCP');
1048 $errors[] = $langs->trans(
'ErrorEndDateCP');
1051 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
1054 $errors[] = $langs->trans(
'CantCreateCP');
1057 $errors[] = $langs->trans(
'InvalidValidatorCP');
1060 $errors[] = $langs->trans(
'NoDateDebut');
1063 $errors[] = $langs->trans(
'NoDateFin');
1065 case 'DureeHoliday':
1066 $errors[] = $langs->trans(
'ErrorDureeCP');
1069 $errors[] = $langs->trans(
'alreadyCPexist');
1077 print
'<script type="text/javascript">
1078 $( document ).ready(function() {
1079 $("input.button-save").click("submit", function(e) {
1080 console.log("Call valider()");
1081 if (document.demandeCP.date_debut_.value != "")
1083 if(document.demandeCP.date_fin_.value != "")
1085 if(document.demandeCP.valideur.value != "-1") {
1089 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
1095 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
1101 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
1110 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
1111 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1112 print
'<input type="hidden" name="action" value="add" />'.
"\n";
1118 print
'<table class="border centpercent">';
1123 print
'<td class="titlefield fieldrequired tdtop">'.$langs->trans(
"User").
'</td>';
1124 print
'<td><div class="inline-block">';
1125 if ($permissiontoadd && !$permissiontoaddall) {
1126 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(($fuserid ? $fuserid : $user->id),
'fuserid', 0, null, 0,
'hierarchyme',
'',
'0,'.
$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500 inline-block');
1129 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($fuserid ? $fuserid : $user->id,
'fuserid', 0, null, 0,
'',
'',
'0,'.
$conf->entity, 0, 0, $morefilter, 0,
'',
'minwidth200 maxwidth500 inline-block');
1134 print
'<div class="leaveuserbalance paddingtop inline-block floatright badge badge-status0 badge-status margintoponsmartphone">';
1138 $typeleaves =
$object->getTypes(1, 1);
1139 foreach ($typeleaves as $key => $val) {
1140 $nb_type =
$object->getCPforUser(($fuserid ? $fuserid : $user->id), $val[
'rowid']);
1141 $nb_holiday += $nb_type;
1143 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong><br>';
1146 print
' ';
1148 $htmltooltip = $langs->trans(
"Detail").
'<br>';
1149 $htmltooltip .= $out;
1151 print $form->textwithtooltip($langs->trans(
'SoldeCPUser', (
string) round($nb_holiday, 5)).
' '.
img_picto(
'',
'help'), $htmltooltip);
1154 if (!empty(
$conf->use_javascript_ajax)) {
1156 print
'$( document ).ready(function() {
1157 jQuery("#fuserid").change(function() {
1158 console.log("We change to user id "+jQuery("#fuserid").val());
1159 if (jQuery("#fuserid").val() == '.((int) $user->id).
') {
1160 jQuery(".leaveuserbalance").show();
1162 jQuery(".leaveuserbalance").hide();
1169 print
'<div class="leaveuserbalance paddingtop">';
1179 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
1181 $typeleaves =
$object->getTypes(1, -1);
1182 $arraytypeleaves = array();
1183 foreach ($typeleaves as $key => $val) {
1184 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
1185 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
1186 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
1188 if (empty($typeleaves)) {
1189 print $langs->trans(
"PleaseDefineSomeTypeOfHolidayFirst");
1191 print $form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1193 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1201 print
'<td class="fieldrequired">';
1202 print $form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
1204 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1205 if (!
GETPOST(
'date_debut_')) {
1206 print $form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
1208 $tmpdate =
GETPOSTDATE(
'date_debut_',
'00:00:00');
1209 print $form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
1211 print
' ';
1212 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
1218 print
'<td class="fieldrequired">';
1219 print $form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
1221 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1223 print $form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
1226 print $form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
1228 print
' ';
1229 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
1235 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
1239 $include_users =
$object->fetch_users_approver_holiday();
1240 if (empty($include_users)) {
1241 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1245 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1246 if ($fuserid != $user->id) {
1247 $fuser =
new User($db);
1248 $fuser->fetch($fuserid);
1249 $defaultselectuser = (empty($fuser->fk_user_holiday_validator) ? $fuser->fk_user : $fuser->fk_user_holiday_validator);
1258 $s = $form->select_dolusers($defaultselectuser,
"valideur", 1,
null, 0, $include_users,
'',
'0,'.
$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
1259 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1268 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
1269 print
'<td class="tdtop">';
1270 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In',
false,
false, isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1271 print $doleditor->Create(1);
1275 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1282 print $form->buttonsSaveCancel(
"SendRequestCP");
1284 print
'</from>'.
"\n";
1287 if ($error && $action !=
'edit') {
1288 print
'<div class="tabBar">';
1289 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1293 if (($id > 0) || $ref) {
1294 $result =
$object->fetch($id, $ref);
1296 $approverexpected =
new User($db);
1297 $approverexpected->fetch(
$object->fk_validator);
1299 $userRequest =
new User($db);
1300 $userRequest->fetch(
$object->fk_user);
1308 $errors[] = $langs->transnoentitiesnoconv(
'ErrorEndDateCP');
1311 $errors[] = $langs->transnoentitiesnoconv(
'ErrorSQLCreateCP');
1314 $errors[] = $langs->transnoentitiesnoconv(
'CantCreateCP');
1317 $errors[] = $langs->transnoentitiesnoconv(
'InvalidValidatorCP');
1320 $errors[] = $langs->transnoentitiesnoconv(
'NoDateDebut');
1323 $errors[] = $langs->transnoentitiesnoconv(
'NoDateFin');
1325 case 'DureeHoliday':
1326 $errors[] = $langs->transnoentitiesnoconv(
'ErrorDureeCP');
1328 case 'NoMotifRefuse':
1329 $errors[] = $langs->transnoentitiesnoconv(
'NoMotifRefuseCP');
1332 $errors[] = $langs->transnoentitiesnoconv(
'ErrorMailNotSend');
1348 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">'.
"\n";
1349 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1350 print
'<input type="hidden" name="action" value="update"/>'.
"\n";
1351 print
'<input type="hidden" name="id" value="'.$object->id.
'" />'.
"\n";
1354 print
dol_get_fiche_head($head,
'card', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
1356 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1358 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref');
1361 print
'<div class="fichecenter">';
1362 print
'<div class="fichehalfleft">';
1363 print
'<div class="underbanner clearboth"></div>';
1365 print
'<table class="border tableforfield centpercent">';
1370 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
1372 print $userRequest->getNomUrl(-1,
'leave');
1377 print
'<td>'.$langs->trans(
"Type").
'</td>';
1379 $typeleaves =
$object->getTypes(1, -1);
1380 if (empty($typeleaves[
$object->fk_type])) {
1381 $labeltoshow = $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type);
1383 $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']);
1389 $starthalfday = (
$object->halfday == -1 ||
$object->halfday == 2) ?
'afternoon' :
'morning';
1390 $endhalfday = (
$object->halfday == 1 ||
$object->halfday == 2) ?
'morning' :
'afternoon';
1394 print
'<td class="nowrap">';
1395 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1397 print
'<td>'.dol_print_date(
$object->date_debut,
'day');
1398 print
' ';
1399 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
1404 print
'<td class="nowrap">';
1405 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1408 $tmpdate =
GETPOSTDATE(
'date_debut_',
'00:00:00');
1409 print $form->selectDate($tmpdate ? $tmpdate :
$object->date_debut,
'date_debut_');
1410 print
' ';
1411 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
1418 print
'<td class="nowrap">';
1419 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1421 print
'<td>'.dol_print_date(
$object->date_fin,
'day');
1422 print
' ';
1423 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
1428 print
'<td class="nowrap">';
1429 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1432 print $form->selectDate(
$object->date_fin,
'date_fin_');
1433 print
' ';
1434 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
1442 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
1443 $includesaturday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1);
1444 $includesunday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1);
1445 if ($includesaturday) {
1446 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
1448 if ($includesunday) {
1449 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
1451 print $form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
1460 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
1461 print
'<td>'.$object->detail_refuse.
'</td>';
1468 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1469 print
'<td>'.nl2br(
$object->description).
'</td>';
1473 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1474 print
'<td class="tdtop">';
1475 $doleditor =
new DolEditor(
'description',
$object->description,
'', 80,
'dolibarr_notes',
'In',
false,
false, isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1476 print $doleditor->Create(1);
1481 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1484 print
'</table>'.
"\n";
1487 print
'<div class="fichehalfright">';
1489 print
'<div class="underbanner clearboth"></div>';
1492 print
'<table class="border tableforfield centpercent">'.
"\n";
1495 if (!empty(
$object->fk_user_create)) {
1496 $userCreate =
new User($db);
1497 $userCreate->fetch(
$object->fk_user_create);
1499 print
'<td class="titlefield">'.$langs->trans(
'RequestByCP').
'</td>';
1500 print
'<td>'.$userCreate->getNomUrl(-1).
'</td>';
1505 if (!$edit && $action !=
'editvalidator') {
1507 print
'<td class="titlefield">';
1509 print $langs->trans(
'ApprovedBy');
1511 print $langs->trans(
'ReviewedByCP');
1516 if (
$object->fk_user_approve > 0) {
1517 $approverdone =
new User($db);
1518 $approverdone->fetch(
$object->fk_user_approve);
1519 print $approverdone->getNomUrl(-1);
1522 print $approverexpected->getNomUrl(-1);
1524 $include_users =
$object->fetch_users_approver_holiday();
1526 print
'<a class="editfielda paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editvalidator">'.
img_edit($langs->trans(
"Edit")).
'</a>';
1532 print
'<td class="titlefield">'.$langs->trans(
'ReviewedByCP').
'</td>';
1534 $include_users =
$object->fetch_users_approver_holiday();
1535 if (!in_array(
$object->fk_validator, $include_users)) {
1536 $include_users[] =
$object->fk_validator;
1538 if (empty($include_users)) {
1539 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1541 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ?
'' : array($user->id));
1542 $s = $form->select_dolusers(
$object->fk_validator,
"valideur", (($action ==
'editvalidator') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1543 print $form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1545 if ($action ==
'editvalidator') {
1546 print
'<input type="submit" class="button button-save" name="savevalidator" value="'.$langs->trans(
"Save").
'">';
1547 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1554 print
'<td>'.$langs->trans(
'DateCreation').
'</td>';
1555 print
'<td>'.dol_print_date(
$object->date_create,
'dayhour',
'tzuser').
'</td>';
1559 print
'<td>'.$langs->trans(
'DateValidCP').
'</td>';
1560 print
'<td>'.dol_print_date(
$object->date_approval,
'dayhour',
'tzuser').
'</td>';
1565 print
'<td>'.$langs->trans(
'DateCancelCP').
'</td>';
1566 print
'<td>'.dol_print_date(
$object->date_cancel,
'dayhour',
'tzuser').
'</td>';
1571 print
'<td>'.$langs->trans(
'DateRefusCP').
'</td>';
1572 print
'<td>'.dol_print_date(
$object->date_refuse,
'dayhour',
'tzuser').
'</td>';
1581 print
'<div class="clearboth"></div>';
1587 if ($action ==
'delete') {
1589 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleDeleteCP"), $langs->trans(
"ConfirmDeleteCP"),
"confirm_delete",
'', 0, 1);
1595 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleToValidCP"), $langs->trans(
"ConfirmToValidCP"),
"confirm_send",
'', 1, 1);
1599 if ($action ==
'valid') {
1600 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleValidCP"), $langs->trans(
"ConfirmValidCP"),
"confirm_valid",
'', 1, 1);
1604 if ($action ==
'refuse') {
1605 $array_input = array(array(
'type' =>
"text",
'label' => $langs->trans(
'DetailRefusCP'),
'name' =>
"detail_refuse",
'size' =>
"50",
'value' =>
""));
1606 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id.
"&action=confirm_refuse", $langs->trans(
"TitleRefuseCP"), $langs->trans(
'ConfirmRefuseCP'),
"confirm_refuse", $array_input, 1, 0);
1610 if ($action ==
'cancel') {
1611 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleCancelCP"), $langs->trans(
"ConfirmCancelCP"),
"confirm_cancel",
'', 1, 1);
1615 if ($action ==
'backtodraft') {
1616 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleSetToDraft"), $langs->trans(
"ConfirmSetToDraft"),
"confirm_draft",
'', 1, 1);
1622 print $form->buttonsSaveCancel();
1632 print
'<div class="tabsAction">';
1635 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'" class="butAction">'.$langs->trans(
"EditCP").
'</a>';
1639 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=sendToValidate&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Validate").
'</a>';
1644 if (($user->id ==
$object->fk_validator || $permissiontoaddall) && $permissiontoapprove) {
1645 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Approve").
'</a>';
1646 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=refuse&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1648 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"Approve").
'</a>';
1649 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1652 if ($permissiontoadd || $permissiontoaddall) {
1654 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1656 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1662 if ($user->id ==
$object->fk_validator || $user->id ==
$object->fk_user_approve || $permissiontoadd || $permissiontoaddall || $permissiontoapprove) {
1663 if (((
$object->date_fin >
dol_now()) && $permissiontoapprove) || $user->id ==
$object->fk_user_approve) {
1664 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1667 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1669 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1673 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1678 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=backtodraft&token='.
newToken().
'" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1681 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1687 print
'<div class="tabBar">';
1688 print $langs->trans(
'ErrorUserViewCP');
1689 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1693 print
'<div class="tabBar">';
1694 print $langs->trans(
'ErrorIDFicheCP');
1695 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1701 if (
GETPOST(
'modelselected')) {
1702 $action =
'presend';
1705 if ($action !=
'presend' && $action !=
'edit') {
1706 print
'<div class="fichecenter"><div class="fichehalfleft">';
1707 print
'<a name="builddoc"></a>';
1726 print
'</div><div class="fichehalfright">';
1732 $morehtmlcenter =
'';
1735 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1737 $somethingshown = $formactions->showactions(
$object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1739 print
'</div></div>';
1747if (is_object($db)) {
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage a WYSIWYG editor.
Class of the module paid holiday.
const STATUS_VALIDATED
Validated status.
const STATUS_DRAFT
Draft status.
const STATUS_REFUSED
Refused.
const STATUS_CANCELED
Canceled.
const STATUS_APPROVED
Approved.
Class to manage Dolibarr users.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
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_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify 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 information.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.