36require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/holiday.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.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';
85$extrafields->fetch_name_optionals_label(
$object->table_element);
88$hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
90$permissiontoapprove = $user->hasRight(
'holiday',
'approve');
93if (($id > 0) || $ref) {
100 if ($user->hasRight(
'holiday',
'readall')) {
103 if ($user->hasRight(
'holiday',
'read') && in_array(
$object->fk_user, $childids)) {
106 if ($permissiontoapprove &&
$object->fk_validator == $user->id && !
getDolGlobalString(
'HOLIDAY_CAN_APPROVE_ONLY_THE_SUBORDINATES')) {
118$permissiontoaddall = 0;
119if ($user->hasRight(
'holiday',
'write') && in_array($fuserid, $childids)) {
120 $permissiontoadd = 1;
122if ($user->hasRight(
'holiday',
'writeall')) {
123 $permissiontoadd = 1;
124 $permissiontoaddall = 1;
126$permissiontoeditextra = $permissiontoadd;
127if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
129 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
133if ($user->hasRight(
'holiday',
'delete')) {
142 $socid = $user->socid;
151$parameters = array(
'socid' => $socid);
152$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
154 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
157if (empty($reshook)) {
158 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
160 if (empty($backtopage) || ($cancel && empty($id))) {
161 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
162 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
163 $backtopage = $backurlforlist;
165 $backtopage = DOL_URL_ROOT.
'/holiday/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
171 if (!empty($backtopageforcancel)) {
172 header(
"Location: ".$backtopageforcancel);
174 } elseif (!empty($backtopage)) {
175 header(
"Location: ".$backtopage);
182 if ($action ==
'add' && $permissiontoadd) {
187 $date_debut =
GETPOSTDATE(
'date_debut_',
'00:00:00');
189 $date_debut_gmt =
GETPOSTDATE(
'date_debut_',
'00:00:00', 1);
190 $date_fin_gmt =
GETPOSTDATE(
'date_fin_',
'00:00:00', 1);
191 $starthalfday =
GETPOST(
'starthalfday');
192 $endhalfday =
GETPOST(
'endhalfday');
195 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
197 } elseif ($starthalfday ==
'afternoon') {
199 } elseif ($endhalfday ==
'morning') {
204 $description = trim(
GETPOST(
'description',
'restricthtml'));
207 if (!$permissiontoaddall) {
209 if (!$user->hasRight(
'holiday',
'write')) {
211 setEventMessages($langs->trans(
"NotEnoughPermissions"),
null,
'errors');
212 } elseif (!in_array($fuserid, $childids)) {
214 setEventMessages($langs->trans(
"UserNotInHierachy"),
null,
'errors');
218 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall')) {
220 setEventMessages($langs->trans(
"NotEnoughPermissions"),
null,
'errors');
221 } elseif (!$user->hasRight(
'holiday',
'writeall') && !in_array($fuserid, $childids)) {
223 setEventMessages($langs->trans(
"UserNotInHierachy"),
null,
'errors');
231 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
237 if (empty($date_debut)) {
238 setEventMessages($langs->trans(
"NoDateDebut"),
null,
'errors');
243 if (empty($date_fin)) {
244 setEventMessages($langs->trans(
"NoDateFin"),
null,
'errors');
249 if ($date_debut > $date_fin) {
250 setEventMessages($langs->trans(
"ErrorEndDateCP"),
null,
'errors');
256 $verifCP =
$object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
258 setEventMessages($langs->trans(
"alreadyCPexist"),
null,
'errors');
263 $tmpUser =
new User($db);
264 $tmpUser->fetch($fuserid);
267 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday, $tmpUser->country_id, $tmpUser->id);
268 if ($nbopenedday < 0.5) {
269 setEventMessages($langs->trans(
"ErrorDureeCP"),
null,
'errors');
275 if ($approverid < 1) {
276 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
280 $approverslist =
$object->fetch_users_approver_holiday();
281 if (!in_array($approverid, $approverslist)) {
282 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidator'),
null,
'errors');
287 $ret = $extrafields->setOptionalsFromPost(
null, $object);
296 $object->description = $description;
297 $object->fk_validator = $approverid;
299 $object->date_debut = $date_debut;
304 $result =
$object->create($user);
315 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
323 if ($action ==
'update' &&
GETPOSTISSET(
'savevalidator') && $permissiontoapprove) {
331 $verif =
$object->update($user);
335 $action =
'editvalidator';
337 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
345 if ($action ==
'update' && !
GETPOSTISSET(
'savevalidator')) {
346 $date_debut =
GETPOSTDATE(
'date_debut_',
'00:00:00');
348 $date_debut_gmt =
GETPOSTDATE(
'date_debut_',
'00:00:00', 1);
349 $date_fin_gmt =
GETPOSTDATE(
'date_fin_',
'00:00:00', 1);
350 $starthalfday =
GETPOST(
'starthalfday');
351 $endhalfday =
GETPOST(
'endhalfday');
353 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
355 } elseif ($starthalfday ==
'afternoon') {
357 } elseif ($endhalfday ==
'morning') {
362 if (!$permissiontoaddall) {
363 if ($permissiontoadd) {
364 if (!in_array($fuserid, $childids)) {
365 setEventMessages($langs->trans(
"UserNotInHierachy"),
null,
'errors');
366 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
370 setEventMessages($langs->trans(
"NotEnoughPermissions"),
null,
'errors');
371 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
381 if ($permissiontoadd) {
385 $description = trim(
GETPOST(
'description',
'restricthtml'));
389 setEventMessages($langs->trans(
'NoDateFin'),
null,
'warnings');
395 if ($date_debut > $date_fin) {
396 setEventMessages($langs->trans(
'ErrorEndDateCP'),
null,
'warnings');
402 if ($approverid < 1) {
403 setEventMessages($langs->trans(
'InvalidValidatorCP'),
null,
'warnings');
408 $tmpUser =
new User($db);
409 $tmpUser->fetch($fuserid);
412 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday, $tmpUser->country_id, $tmpUser->id);
413 if ($nbopenedday < 0.5) {
414 setEventMessages($langs->trans(
'ErrorDureeCP'),
null,
'warnings');
422 $object->description = $description;
423 $object->date_debut = $date_debut;
425 $object->fk_validator = $approverid;
429 $verif =
$object->update($user);
441 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
447 setEventMessages($langs->trans(
"NotEnoughPermissions"),
null,
'errors');
451 setEventMessages($langs->trans(
"ErrorBadStatus"),
null,
'errors');
457 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
467 $result =
$object->delete($user);
475 setEventMessages($langs->trans(
'BadStatusOfObject'),
null,
'errors');
481 header(
'Location: list.php?restore_lastsearch_values=1');
489 if ($action ==
'confirm_send') {
498 $verif =
$object->validate($user);
503 $destinataire =
new User($db);
504 $destinataire->fetch(
$object->fk_validator);
505 $emailTo = $destinataire->email;
508 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
509 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
514 $expediteur =
new User($db);
515 $expediteur->fetch(
$object->fk_user);
527 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
530 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
532 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
538 if ($delayForRequest) {
541 if (
$object->date_debut < $nowplusdelay) {
542 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", (
string) $delayForRequest).
"</p>\n";
551 $affectingtypes =
$object->getTypes(1, 1);
552 if (!empty($affectingtypes[
$object->fk_type])) {
553 $tmpUser =
new User($db);
554 $tmpUser->fetch(
$object->fk_user);
559 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
564 $typeleaves =
$object->getTypes(1, -1);
565 if (empty($typeleaves[
$object->fk_type])) {
566 $labeltoshow = $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type);
568 $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']);
571 $starthalfdaykey =
"Afternoon";
572 $endhalfdaykey =
"Morning";
573 } elseif (
$object->halfday == -1) {
574 $starthalfdaykey =
"Afternoon";
575 $endhalfdaykey =
"Afternoon";
576 } elseif (
$object->halfday == 1) {
577 $starthalfdaykey =
"Morning";
578 $endhalfdaykey =
"Morning";
580 $starthalfdaykey =
"Morning";
581 $endhalfdaykey =
"Afternoon";
583 $starthalfdaykey =
"";
587 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
590 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
591 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type) : $labeltoshow).
"</li>\n";
592 $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";
593 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
594 $message .=
"</ul>\n";
596 $trackid =
'leav'.$object->id;
600 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
603 $result = $mail->sendfile();
606 setEventMessages($mail->error, $mail->errors,
'warnings');
609 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
619 if ($action ==
'update_extras' && $permissiontoeditextra) {
622 $attribute_name =
GETPOST(
'attribute',
'aZ09');
625 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
631 $result =
$object->updateExtraField($attribute_name,
'HOLIDAY_MODIFY');
639 $action =
'edit_extras';
644 if ($action ==
'confirm_valid' && $permissiontoapprove) {
652 $object->fk_user_approve = $user->id;
660 $verif =
$object->approve($user);
667 if (!$error && empty($decrease)) {
668 $tmpUser =
new User($db);
669 $tmpUser->fetch(
$object->fk_user);
674 $newSolde = ($soldeActuel - $nbopenedday);
675 $label =
$object->ref.
' - '.$langs->transnoentitiesnoconv(
"HolidayConsumption");
681 setEventMessages(
null,
$object->errors,
'errors');
688 setEventMessages(
null,
$object->errors,
'errors');
693 $result =
$object->sendApprovalEmail();
707 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
712 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoapprove) {
713 if (
GETPOST(
'detail_refuse')) {
719 $object->fk_user_refuse = $user->id;
726 $verif =
$object->update($user);
735 $destinataire =
new User($db);
736 $destinataire->fetch(
$object->fk_user);
737 $emailTo = $destinataire->email;
740 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
743 $expediteur =
new User($db);
744 $expediteur->fetch(
$object->fk_validator);
754 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
757 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
760 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
764 $message .=
"<ul>\n";
765 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
766 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
769 $trackid =
'leav'.$object->id;
773 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
776 $result = $mail->sendfile();
779 setEventMessages($mail->error, $mail->errors,
'warnings');
790 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
798 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
804 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes' && $permissiontoadd) {
810 if (!$user->hasRight(
'holiday',
'writeall') && !($user->hasRight(
'holiday',
'write') && in_array(
$object->fk_user, $childids))) {
815 setEventMessages($langs->trans(
'StatusOfRefMustBe',
$object->ref, $langs->transnoentitiesnoconv(
'Canceled')),
null,
'errors');
823 $result =
$object->update($user);
826 setEventMessages($langs->trans(
'ErrorBackToDraft').
' '.
$object->error,
$object->errors,
'errors');
833 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
842 setEventMessages($langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed"),
null,
'errors');
847 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
854 ($user->id ==
$object->fk_validator || $permissiontoadd || $permissiontoaddall || $permissiontoapprove)) {
859 $object->fk_user_cancel = $user->id;
865 $result =
$object->update($user);
869 $result =
$object->call_trigger(
'HOLIDAY_CANCEL', $user);
874 $startDate =
$object->date_debut_gmt;
875 $endDate =
$object->date_fin_gmt;
876 $alreadydebited =
true;
878 if (!empty($decrease)) {
880 $date = strtotime(
'-1 month', $lastUpdate);
881 $endOfMonthBeforeLastUpdate =
dol_mktime(0, 0, 0, (
int)
date(
'm', $date), (
int)
date(
't', $date), (
int)
date(
'Y', $date), 1);
882 if (
$object->date_debut_gmt < $endOfMonthBeforeLastUpdate &&
$object->date_fin_gmt > $endOfMonthBeforeLastUpdate) {
883 $endDate = $endOfMonthBeforeLastUpdate;
884 } elseif (
$object->date_debut_gmt > $endOfMonthBeforeLastUpdate) {
885 $alreadydebited =
false;
889 $tmpUser =
new User($db);
890 $tmpUser->fetch(
$object->fk_user);
895 if (!$alreadydebited) {
899 $newSolde = ($soldeActuel + $nbopenedday);
902 $result1 =
$object->addLogCP($user->id,
$object->fk_user,
$object->ref.
' - '.$langs->transnoentitiesnoconv(
"HolidayCreditAfterCancellation"), $newSolde,
$object->fk_type);
907 if ($result1 < 0 || $result2 < 0) {
909 setEventMessages($langs->trans(
'ErrorCantDeleteCP').
' '.
$object->error,
$object->errors,
'errors');
920 if (!$error && $result > 0) {
922 $destinataire =
new User($db);
923 $destinataire->fetch(
$object->fk_user);
924 $emailTo = $destinataire->email;
927 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
932 $expediteur =
new User($db);
933 $expediteur->fetch(
$object->fk_user_cancel);
943 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
946 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
952 $message .=
"<ul>\n";
953 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
954 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
955 $message .=
"</ul>\n";
957 $trackid =
'leav'.$object->id;
961 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
964 $result = $mail->sendfile();
967 setEventMessages($mail->error, $mail->errors,
'warnings');
970 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
1000$form =
new Form($db);
1004$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
1006$title = $langs->trans(
'Leave');
1007$help_url =
'EN:Module_Holiday';
1009llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card');
1013if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
1015 if ((in_array($fuserid, $childids) && !$user->hasRight(
'holiday',
'write')) || (!in_array($fuserid, $childids) && ((
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'holiday',
'writeall') || !$user->hasRight(
'holiday',
'writeall'))))) {
1016 $errors[] = $langs->trans(
'CantCreateCP');
1025 $errors[] = $langs->trans(
'ErrorEndDateCP');
1028 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
1031 $errors[] = $langs->trans(
'CantCreateCP');
1034 $errors[] = $langs->trans(
'InvalidValidatorCP');
1037 $errors[] = $langs->trans(
'NoDateDebut');
1040 $errors[] = $langs->trans(
'NoDateFin');
1042 case 'DureeHoliday':
1043 $errors[] = $langs->trans(
'ErrorDureeCP');
1046 $errors[] = $langs->trans(
'alreadyCPexist');
1050 setEventMessages(
null, $errors,
'errors');
1054 print
'<script type="text/javascript">
1055 $( document ).ready(function() {
1056 $("input.button-save").click("submit", function(e) {
1057 console.log("Call valider()");
1058 if (document.demandeCP.date_debut_.value != "")
1060 if(document.demandeCP.date_fin_.value != "")
1062 if(document.demandeCP.valideur.value != "-1") {
1066 alert(\''.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'\');
1072 alert(\
''.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'\');
1078 alert(\
''.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'\');
1086 // Leave request form
1087 print '<form method=
"POST" action=
"'.$_SERVER['PHP_SELF'].'" name=
"demandeCP">
'."\n";
1088 print '<input
type=
"hidden" name=
"token" value=
"'.newToken().'" />
'."\n";
1089 print '<input
type=
"hidden" name=
"action" value=
"add" />
'."\n";
1091 print dol_get_fiche_head();
1093 //print '<span>
'.$langs->trans('DelayToRequestCP
',$object->getConfCP('delayForRequest
')).'</span><br><br>
';
1095 print '<
table class=
"border centpercent">
';
1098 // User for leave request
1100 print '<td
class=
"titlefield fieldrequired tdtop">
'.$langs->trans("User").'</td>
';
1101 print '<td><div
class=
"inline-block">
';
1102 if ($permissiontoadd && !$permissiontoaddall) {
1103 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
');
1104 //print '<input
type=
"hidden" name=
"fuserid" value=
"'.($fuserid?$fuserid:$user->id).'">
';
1106 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
');
1110 if (!getDolGlobalString('HOLIDAY_HIDE_BALANCE
')) {
1111 print '<div
class=
"leaveuserbalance paddingtop inline-block floatright badge badge-status0 badge-status margintoponsmartphone">
';
1115 $typeleaves = $object->getTypes(1, 1);
1116 foreach ($typeleaves as $key => $val) {
1117 $nb_type = $object->getCPforUser(($fuserid ? $fuserid : $user->id), $val['rowid
']);
1118 $nb_holiday += $nb_type;
1120 $out .= ' -
'.($langs->trans($val['code
']) != $val['code
'] ? $langs->trans($val['code
']) : $val['label
']).': <strong>
'.($nb_type ? price2num($nb_type) : 0).'</strong>
';
1121 if ($val['newbymonth
'] > 0) {
1122 $out .= ' <span
class=
"opacitymedium">+
'.$val['newbymonth
'].' /
'.$langs->trans("Month").'</span>
';
1127 print '
';
1129 $htmltooltip = $langs->trans("Detail").'<br>
';
1130 $htmltooltip .= $out;
1132 print $form->textwithtooltip($langs->trans('SoldeCPUser
', (string) round($nb_holiday, 5)).' '.img_picto('', 'help
'), $htmltooltip);
1135 if (!empty($conf->use_javascript_ajax)) {
1137 print '$( document ).ready(
function() {
1138 jQuery(
"#fuserid").change(
function() {
1139 console.log(
"We change to user id "+jQuery(
"#fuserid").val());
1140 if (jQuery(
"#fuserid").val() ==
'.((int) $user->id).') {
1141 jQuery(
".leaveuserbalance").show();
1143 jQuery(
".leaveuserbalance").hide();
1149 } elseif (!is_numeric(getDolGlobalString('HOLIDAY_HIDE_BALANCE
'))) {
1150 print '<div
class=
"leaveuserbalance paddingtop">
';
1151 print $langs->trans(getDolGlobalString('HOLIDAY_HIDE_BALANCE
'));
1160 print '<td
class=
"fieldrequired">
'.$langs->trans("Type").'</td>
';
1162 $typeleaves = $object->getTypes(1, -1);
1163 $arraytypeleaves = array();
1164 foreach ($typeleaves as $key => $val) {
1165 $labeltoshow = ($langs->trans($val['code
']) != $val['code
'] ? $langs->trans($val['code
']) : $val['label
']);
1166 $labeltoshow .= ($val['delay
'] > 0 ? ' (
'.$langs->trans("NoticePeriod").':
'.$val['delay
'].' '.$langs->trans("days").')
' : '');
1167 $arraytypeleaves[$val['rowid
']] = $labeltoshow;
1169 if (empty($typeleaves)) {
1170 print $langs->trans("PleaseDefineSomeTypeOfHolidayFirst");
1172 print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha
') ? GETPOST('type', 'alpha
') : ''), 1, 0, 0, '', 0, 0, 0, '', '', 1);
1174 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1182 print '<td
class=
"fieldrequired">
';
1183 print $form->textwithpicto($langs->trans("DateDebCP"), $langs->trans("FirstDayOfHoliday"));
1185 print '<td>
'.img_picto('', 'action
', 'class=
"pictofixedwidth"');
1186 if (!GETPOST('date_debut_
')) { // If visitor does not come from agenda
1187 print $form->selectDate(-1, 'date_debut_
', 0, 0, 0, '', 1, 1);
1189 $tmpdate = GETPOSTDATE('date_debut_
', '00:00:00
');
1190 print $form->selectDate($tmpdate, 'date_debut_
', 0, 0, 0, '', 1, 1);
1192 print '
';
1193 print $form->selectarray('starthalfday
', $listhalfday, (GETPOST('starthalfday
', 'alpha
') ? GETPOST('starthalfday
', 'alpha
') : 'morning
'));
1199 print '<td
class=
"fieldrequired">
';
1200 print $form->textwithpicto($langs->trans("DateFinCP"), $langs->trans("LastDayOfHoliday"));
1202 print '<td>
'.img_picto('', 'action
', 'class=
"pictofixedwidth"');
1203 if (!GETPOST('date_fin_
')) {
1204 print $form->selectDate(-1, 'date_fin_
', 0, 0, 0, '', 1, 1);
1206 $tmpdate = GETPOSTDATE('date_fin_
', '00:00:00
');
1207 print $form->selectDate($tmpdate, 'date_fin_
', 0, 0, 0, '', 1, 1);
1209 print '
';
1210 print $form->selectarray('endhalfday
', $listhalfday, (GETPOST('endhalfday
', 'alpha
') ? GETPOST('endhalfday
', 'alpha
') : 'afternoon
'));
1216 print '<td
class=
"fieldrequired">
'.$langs->trans("ReviewedByCP").'</td>
';
1219 $object = new Holiday($db);
1220 $include_users = $object->fetch_users_approver_holiday();
1221 if (empty($include_users)) {
1222 print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
1224 // Defined default approver (the forced approver of edited user or the supervisor of user if no forced value defined)
1225 // Note: This user will be set only if the defined approver has permission to approve so is inside include_users
1226 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1227 if ($fuserid != $user->id) {
1228 $fuser = new User($db);
1229 $fuser->fetch($fuserid);
1230 $defaultselectuser = (empty($fuser->fk_user_holiday_validator) ? $fuser->fk_user : $fuser->fk_user_holiday_validator);
1233 if (getDolGlobalString('HOLIDAY_DEFAULT_VALIDATOR
')) {
1234 $defaultselectuser = getDolGlobalString('HOLIDAY_DEFAULT_VALIDATOR
'); // Can force default approver
1236 if (GETPOSTINT('valideur
') > 0) {
1237 $defaultselectuser = GETPOSTINT('valideur
');
1239 $s = $form->select_dolusers($defaultselectuser, "valideur", 1, null, 0, $include_users, '', '0,
'.$conf->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500
');
1240 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
1243 //print $form->select_dolusers((GETPOST('valideur
','int')>0?GETPOST('valideur
','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent
1249 print '<td>
'.$langs->trans("DescCP").'</td>
';
1250 print '<td
class=
"tdtop">
';
1251 $doleditor = new DolEditor('description', GETPOST('description', 'restricthtml
'), '', 80, 'dolibarr_notes
', 'In
', false, false, isModEnabled('fckeditor
'), ROWS_3, '90%
');
1252 print $doleditor->Create(1);
1256 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php
';
1261 print dol_get_fiche_end();
1263 print $form->buttonsSaveCancel("SendRequestCP");
1265 print '</from>
'."\n";
1268 if ($error && $action != 'edit
') {
1269 print '<div
class=
"tabBar">
';
1270 print '<br><br><input
type=
"button" value=
"'.$langs->trans("ReturnCP
").'" class=
"button" onclick=
"history.go(-1)" />
';
1273 // Show page in view or edit mode
1274 if (($id > 0) || $ref) {
1275 $result = $object->fetch($id, $ref);
1277 $approverexpected = new User($db);
1278 $approverexpected->fetch($object->fk_validator); // Use that should be the approver
1280 $userRequest = new User($db);
1281 $userRequest->fetch($object->fk_user);
1283 //print load_fiche_titre($langs->trans('TitreRequestCP
'));
1285 // Si il y a une erreur
1286 if (GETPOST('error
')) {
1287 switch (GETPOST('error
')) {
1289 $errors[] = $langs->transnoentitiesnoconv('ErrorEndDateCP
');
1292 $errors[] = $langs->transnoentitiesnoconv('ErrorSQLCreateCP
');
1295 $errors[] = $langs->transnoentitiesnoconv('CantCreateCP
');
1298 $errors[] = $langs->transnoentitiesnoconv('InvalidValidatorCP
');
1301 $errors[] = $langs->transnoentitiesnoconv('NoDateDebut
');
1304 $errors[] = $langs->transnoentitiesnoconv('NoDateFin
');
1306 case 'DureeHoliday
':
1307 $errors[] = $langs->transnoentitiesnoconv('ErrorDureeCP
');
1309 case 'NoMotifRefuse
':
1310 $errors[] = $langs->transnoentitiesnoconv('NoMotifRefuseCP
');
1313 $errors[] = $langs->transnoentitiesnoconv('ErrorMailNotSend
');
1317 setEventMessages(null, $errors, 'errors
');
1320 // check if the user has the right to read this request
1322 $head = holiday_prepare_head($object);
1324 $editmode = (($action == 'edit
' && $object->status == Holiday::STATUS_DRAFT) || ($action == 'editvalidator
'));
1327 if ($action == 'edit
' && $object->status == Holiday::STATUS_DRAFT) {
1331 print '<form method=
"post" action=
"'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">
'."\n";
1332 print '<input
type=
"hidden" name=
"token" value=
"'.newToken().'" />
'."\n";
1333 print '<input
type=
"hidden" name=
"action" value=
"update"/>
'."\n";
1334 print '<input
type=
"hidden" name=
"id" value=
"'.$object->id.'" />
'."\n";
1337 // No drop area in edit mode: these tabs are printed inside the edit form, and dropping a file
1338 // reloads the page, which would discard what the user is typing.
1339 print dol_get_fiche_head($head, 'card
', $langs->trans("CPTitreMenu"), -1, 'holiday
', 0, '', '', 0, '', ($editmode ? 0 : 1));
1341 $linkback = '<a href=
"'.DOL_URL_ROOT.'/holiday/list.php?restore_lastsearch_values=1">
'.$langs->trans("BackToList").'</a>
';
1343 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');
1346 print '<div
class=
"fichecenter">
';
1347 print '<div
class=
"fichehalfleft">
';
1348 print '<div
class=
"underbanner clearboth"></div>
';
1350 print '<
table class=
"border tableforfield centpercent">
';
1355 print '<td
class=
"titlefield">
'.$langs->trans("User").'</td>
';
1357 print $userRequest->getNomUrl(-1, 'leave
');
1362 print '<td>
'.$langs->trans("Type").'</td>
';
1364 $typeleaves = $object->getTypes(1, -1);
1365 if (empty($typeleaves[$object->fk_type])) {
1366 $labeltoshow = $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type);
1368 $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
']);
1374 $starthalfday = ($object->halfday == -1 || $object->halfday == 2) ? 'afternoon
' : 'morning
';
1375 $endhalfday = ($object->halfday == 1 || $object->halfday == 2) ? 'morning
' : 'afternoon
';
1379 print '<td
class=
"nowrap">
';
1380 print $form->textwithpicto($langs->trans('DateDebCP
'), $langs->trans("FirstDayOfHoliday"));
1382 print '<td>
'.dol_print_date($object->date_debut, 'day
');
1383 print '
';
1384 print '<span
class=
"opacitymedium">
'.$langs->trans($listhalfday[$starthalfday]).'</span>
';
1389 print '<td
class=
"nowrap">
';
1390 print $form->textwithpicto($langs->trans('DateDebCP
'), $langs->trans("FirstDayOfHoliday"));
1393 $tmpdate = GETPOSTDATE('date_debut_
', '00:00:00
');
1394 print $form->selectDate($tmpdate ? $tmpdate : $object->date_debut, 'date_debut_
');
1395 print '
';
1396 print $form->selectarray('starthalfday
', $listhalfday, (GETPOST('starthalfday
') ? GETPOST('starthalfday
') : $starthalfday));
1403 print '<td
class=
"nowrap">
';
1404 print $form->textwithpicto($langs->trans('DateFinCP
'), $langs->trans("LastDayOfHoliday"));
1406 print '<td>
'.dol_print_date($object->date_fin, 'day
');
1407 print '
';
1408 print '<span
class=
"opacitymedium">
'.$langs->trans($listhalfday[$endhalfday]).'</span>
';
1413 print '<td
class=
"nowrap">
';
1414 print $form->textwithpicto($langs->trans('DateFinCP
'), $langs->trans("LastDayOfHoliday"));
1417 print $form->selectDate($object->date_fin, 'date_fin_
');
1418 print '
';
1419 print $form->selectarray('endhalfday
', $listhalfday, (GETPOST('endhalfday
') ? GETPOST('endhalfday
') : $endhalfday));
1427 $htmlhelp = $langs->trans('NbUseDaysCPHelp
');
1428 $includesaturday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY
', 1);
1429 $includesunday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY
', 1);
1430 if ($includesaturday) {
1431 $htmlhelp .= '<br>
'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Saturday"));
1433 if ($includesunday) {
1434 $htmlhelp .= '<br>
'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
1436 print $form->textwithpicto($langs->trans('NbUseDaysCP
'), $htmlhelp);
1439 print num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, (int) $object->halfday, $userRequest->country_id, $object->fk_user);
1443 if ($object->status == Holiday::STATUS_REFUSED) {
1445 print '<td>
'.$langs->trans('DetailRefusCP
').'</td>
';
1446 print '<td>
'.$object->detail_refuse.'</td>
';
1453 print '<td>
'.$langs->trans('DescCP
').'</td>
';
1454 print '<td>
'.nl2br($object->description).'</td>
';
1458 print '<td>
'.$langs->trans('DescCP
').'</td>
';
1459 print '<td
class=
"tdtop">
';
1460 $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_notes
', 'In
', false, false, isModEnabled('fckeditor
'), ROWS_3, '90%
');
1461 print $doleditor->Create(1);
1466 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php
';
1469 print '</
table>
'."\n";
1472 print '<div
class=
"fichehalfright">
';
1474 print '<div
class=
"underbanner clearboth"></div>
';
1477 print '<
table class=
"border tableforfield centpercent">
'."\n";
1480 if (!empty($object->fk_user_create)) {
1481 $userCreate = new User($db);
1482 $userCreate->fetch($object->fk_user_create);
1484 print '<td
class=
"titlefield">
'.$langs->trans('RequestByCP
').'</td>
';
1485 print '<td>
'.$userCreate->getNomUrl(-1).'</td>
';
1490 if (!$edit && $action != 'editvalidator
') {
1492 print '<td
class=
"titlefield">
';
1493 if ($object->status == Holiday::STATUS_APPROVED || $object->status == Holiday::STATUS_CANCELED) {
1494 print $langs->trans('ApprovedBy
');
1496 print $langs->trans('ReviewedByCP
');
1500 if ($object->status == Holiday::STATUS_APPROVED || $object->status == Holiday::STATUS_CANCELED) {
1501 if ($object->fk_user_approve > 0) {
1502 $approverdone = new User($db);
1503 $approverdone->fetch($object->fk_user_approve);
1504 print $approverdone->getNomUrl(-1);
1507 print $approverexpected->getNomUrl(-1);
1509 $include_users = $object->fetch_users_approver_holiday();
1510 if (is_array($include_users) && in_array($user->id, $include_users) && $object->status == Holiday::STATUS_VALIDATED) {
1511 print '<a
class=
"editfielda paddingleft" href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=editvalidator">
'.img_edit($langs->trans("Edit")).'</a>
';
1517 print '<td
class=
"titlefield">
'.$langs->trans('ReviewedByCP
').'</td>
'; // Will be approved by
1519 $include_users = $object->fetch_users_approver_holiday();
1520 if (!in_array($object->fk_validator, $include_users)) { // Add the current validator to the list to not lose it when editing.
1521 $include_users[] = $object->fk_validator;
1523 if (empty($include_users)) {
1524 print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
1526 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ? '' : array($user->id)); // We exclude ourself from validator list. Not if we are admin or if we are on the leave of someone else
1527 $s = $form->select_dolusers($object->fk_validator, "valideur", (($action == 'editvalidator
') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1528 print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
1530 if ($action == 'editvalidator
') {
1531 print '<input
type=
"submit" class=
"button button-save" name=
"savevalidator" value=
"'.$langs->trans("Save
").'">
';
1532 print '<input
type=
"submit" class=
"button button-cancel" name=
"cancel" value=
"'.$langs->trans("Cancel
").'">
';
1539 print '<td>
'.$langs->trans('DateCreation
').'</td>
';
1540 print '<td>
'.dol_print_date($object->date_create, 'dayhour
', 'tzuser
').'</td>
';
1542 if ($object->status == Holiday::STATUS_APPROVED || $object->status == Holiday::STATUS_CANCELED) {
1544 print '<td>
'.$langs->trans('DateValidCP
').'</td>
';
1545 print '<td>
'.dol_print_date($object->date_approval, 'dayhour
', 'tzuser
').'</td>
'; // warning: date_valid is approval date on holiday module
1548 if ($object->status == Holiday::STATUS_CANCELED) {
1550 print '<td>
'.$langs->trans('DateCancelCP
').'</td>
';
1551 print '<td>
'.dol_print_date($object->date_cancel, 'dayhour
', 'tzuser
').'</td>
';
1554 if ($object->status == Holiday::STATUS_REFUSED) {
1556 print '<td>
'.$langs->trans('DateRefusCP
').'</td>
';
1557 print '<td>
'.dol_print_date($object->date_refuse, 'dayhour
', 'tzuser
').'</td>
';
1566 print '<div
class=
"clearboth"></div>
';
1568 print dol_get_fiche_end();
1571 // Confirmation messages
1572 if ($action == 'delete') {
1574 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1);
1578 // Si envoi en validation
1579 if ($action == 'sendToValidate
' && $object->status == Holiday::STATUS_DRAFT) {
1580 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleToValidCP"), $langs->trans("ConfirmToValidCP"), "confirm_send", '', 1, 1);
1583 // If validating the request
1584 if ($action == 'valid
') {
1585 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleValidCP"), $langs->trans("ConfirmValidCP"), "confirm_valid", '', 1, 1);
1588 // If refusing the request
1589 if ($action == 'refuse
') {
1590 $array_input = array(array('type' => "text", 'label
' => $langs->trans('DetailRefusCP
'), 'name' => "detail_refuse", 'size
' => "50", 'value
' => ""));
1591 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP
'), "confirm_refuse", $array_input, 1, 0);
1594 // If cancelling the request
1595 if ($action == 'cancel
') {
1596 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleCancelCP"), $langs->trans("ConfirmCancelCP"), "confirm_cancel", '', 1, 1);
1600 if ($action == 'backtodraft
') {
1601 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleSetToDraft"), $langs->trans("ConfirmSetToDraft"), "confirm_draft", '', 1, 1);
1604 if (($action == 'edit
' && $object->status == Holiday::STATUS_DRAFT) || ($action == 'editvalidator
')) {
1605 if ($action == 'edit
' && $object->status == Holiday::STATUS_DRAFT) {
1606 if ($permissiontoadd && $object->status == Holiday::STATUS_DRAFT) {
1607 print $form->buttonsSaveCancel();
1615 // Buttons for actions
1617 print '<div
class=
"tabsAction">
';
1619 if ($permissiontoadd && $object->status == Holiday::STATUS_DRAFT) {
1620 print '<a href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=edit&token='.newToken().'" class=
"butAction">
'.$langs->trans("EditCP").'</a>
';
1623 if ($permissiontoadd && $object->status == Holiday::STATUS_DRAFT) { // If draft
1624 print '<a href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=sendToValidate&token='.newToken().'" class=
"butAction">
'.$langs->trans("Validate").'</a>
';
1627 if ($object->status == Holiday::STATUS_VALIDATED) { // If validated
1628 // Button Approve / Refuse
1629 if (($user->id == $object->fk_validator || $permissiontoaddall) && $permissiontoapprove) {
1630 print '<a href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=valid&token='.newToken().'" class=
"butAction">
'.$langs->trans("Approve").'</a>
';
1631 print '<a href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=refuse&token='.newToken().'" class=
"butAction">
'.$langs->trans("ActionRefuseCP").'</a>
';
1633 print '<a href=
"#" class=
"butActionRefused classfortooltip" title=
"'.$langs->trans("NotTheAssignedApprover
").'">
'.$langs->trans("Approve").'</a>
';
1634 print '<a href=
"#" class=
"butActionRefused classfortooltip" title=
"'.$langs->trans("NotTheAssignedApprover
").'">
'.$langs->trans("ActionRefuseCP").'</a>
';
1636 // Button Cancel (because we can't approve)
1637 if ($permissiontoadd || $permissiontoaddall) {
1639 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1641 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1647 if ($user->id ==
$object->fk_validator || $user->id ==
$object->fk_user_approve || $permissiontoadd || $permissiontoaddall || $permissiontoapprove) {
1648 if (((
$object->date_fin >
dol_now()) && $permissiontoapprove) || $user->id ==
$object->fk_user_approve) {
1649 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1652 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1654 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1658 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1663 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=backtodraft&token='.
newToken().
'" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1666 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1672 print
'<div class="tabBar">';
1673 print $langs->trans(
'ErrorUserViewCP');
1674 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1678 print
'<div class="tabBar">';
1679 print $langs->trans(
'ErrorIDFicheCP');
1680 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1686 if (
GETPOST(
'modelselected')) {
1687 $action =
'presend';
1690 if ($action !=
'presend' && $action !=
'edit') {
1691 print
'<div class="fichecenter"><div class="fichehalfleft">';
1692 print
'<a name="builddoc"></a>';
1711 print
'</div><div class="fichehalfright">';
1715 $morehtmlcenter =
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/holiday/holiday_agenda.php?id='.
$object->id);
1718 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1720 $somethingshown = $formactions->showactions($object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1722 print
'</div></div>';
1730if (is_object($db)) {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
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, $countryCodeOrId='', $user_id=0)
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, $tz='')
Add a delay to a date.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_now($mode='gmt')
Return date for now.
getDolGlobalFloat($key, $default=0)
Return a Dolibarr global constant float value.
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...
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
$conf db user
Active Directory does not allow anonymous connections.
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.
treeview li table
No Email.