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);
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')) {
212 } elseif (!in_array($fuserid, $childids)) {
218 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall')) {
221 } elseif (!$user->hasRight(
'holiday',
'writeall') && !in_array($fuserid, $childids)) {
231 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
237 if (empty($date_debut)) {
243 if (empty($date_fin)) {
249 if ($date_debut > $date_fin) {
256 $verifCP =
$object->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
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) {
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)) {
366 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
371 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?action=create');
381 if ($permissiontoadd) {
385 $description = trim(
GETPOST(
'description',
'restricthtml'));
395 if ($date_debut > $date_fin) {
402 if ($approverid < 1) {
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) {
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);
457 if ($action ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' && $candelete) {
466 $result =
$object->delete($user);
475 header(
'Location: list.php?restore_lastsearch_values=1');
483 if ($action ==
'confirm_send') {
492 $verif =
$object->validate($user);
498 $destinataire->fetch(
$object->fk_validator);
499 $emailTo = $destinataire->email;
502 dol_syslog(
"Expected validator has no email, so we redirect directly to finished page without sending email");
503 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
509 $expediteur->fetch(
$object->fk_user);
521 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysToValidate");
524 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
526 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateBody").
"</p>\n";
532 if ($delayForRequest) {
535 if (
$object->date_debut < $nowplusdelay) {
536 $message =
"<p>".$langs->transnoentities(
"HolidaysToValidateDelay", (
string) $delayForRequest).
"</p>\n";
545 $affectingtypes =
$object->getTypes(1, 1);
546 if (!empty($affectingtypes[
$object->fk_type])) {
548 $tmpUser->fetch(
$object->fk_user);
553 $message .=
"<p>".$langs->transnoentities(
"HolidaysToValidateAlertSolde").
"</p>\n";
558 $typeleaves =
$object->getTypes(1, -1);
559 if (empty($typeleaves[
$object->fk_type])) {
560 $labeltoshow = $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type);
562 $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']);
565 $starthalfdaykey =
"Afternoon";
566 $endhalfdaykey =
"Morning";
567 } elseif (
$object->halfday == -1) {
568 $starthalfdaykey =
"Afternoon";
569 $endhalfdaykey =
"Afternoon";
570 } elseif (
$object->halfday == 1) {
571 $starthalfdaykey =
"Morning";
572 $endhalfdaykey =
"Morning";
574 $starthalfdaykey =
"Morning";
575 $endhalfdaykey =
"Afternoon";
577 $starthalfdaykey =
"";
581 $link =
dol_buildpath(
"/holiday/card.php", 3) .
'?id='.$object->id;
584 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Name").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
585 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Type").
" : ".(empty($labeltoshow) ? $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type) : $labeltoshow).
"</li>\n";
586 $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";
587 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
588 $message .=
"</ul>\n";
590 $trackid =
'leav'.$object->id;
594 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
597 $result = $mail->sendfile();
603 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
613 if ($action ==
'update_extras' && $permissiontoeditextra) {
616 $attribute_name =
GETPOST(
'attribute',
'aZ09');
619 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
625 $result =
$object->updateExtraField($attribute_name,
'HOLIDAY_MODIFY');
633 $action =
'edit_extras';
638 if ($action ==
'confirm_valid' && $permissiontoapprove) {
646 $object->fk_user_approve = $user->id;
654 $verif =
$object->approve($user);
661 if (!$error && empty($decrease)) {
663 $tmpUser->fetch(
$object->fk_user);
668 $newSolde = ($soldeActuel - $nbopenedday);
669 $label =
$object->ref.
' - '.$langs->transnoentitiesnoconv(
"HolidayConsumption");
689 $destinataire->fetch(
$object->fk_user);
690 $emailTo = $destinataire->email;
693 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
697 $expediteur->fetch(
$object->fk_validator);
707 $subject =
'['.$societeName.
"] ".$langs->transnoentitiesnoconv(
"HolidaysValidated");
710 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
716 $message .=
"<ul>\n";
717 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ValidatedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
718 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
719 $message .=
"</ul>\n";
721 $trackid =
'leav'.$object->id;
725 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
728 $result = $mail->sendfile();
744 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
749 if ($action ==
'confirm_refuse' &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoapprove) {
750 if (
GETPOST(
'detail_refuse')) {
756 $object->fk_user_refuse = $user->id;
763 $verif =
$object->update($user);
773 $destinataire->fetch(
$object->fk_user);
774 $emailTo = $destinataire->email;
777 dol_syslog(
"User that request leave has no email, so we redirect directly to finished page without sending email");
781 $expediteur->fetch(
$object->fk_validator);
791 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysRefused");
794 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
797 $message .=
"<p>".GETPOST(
'detail_refuse',
'alpha').
"</p>";
801 $message .=
"<ul>\n";
802 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
803 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
806 $trackid =
'leav'.$object->id;
810 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
813 $result = $mail->sendfile();
827 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
835 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DetailRefusCP")),
null,
'errors');
841 if ($action ==
'confirm_draft' &&
GETPOST(
'confirm') ==
'yes' && $permissiontoadd) {
847 if (!$user->hasRight(
'holiday',
'writeall') && !($user->hasRight(
'holiday',
'write') && in_array(
$object->fk_user, $childids))) {
852 setEventMessages($langs->trans(
'StatusOfRefMustBe',
$object->ref, $langs->transnoentitiesnoconv(
'Canceled')),
null,
'errors');
860 $result =
$object->update($user);
870 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
879 setEventMessages($langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed"),
null,
'errors');
884 if ($action ==
'confirm_cancel' &&
GETPOST(
'confirm') ==
'yes') {
891 ($user->id ==
$object->fk_validator || $permissiontoadd || $permissiontoaddall || $permissiontoapprove)) {
896 $object->fk_user_cancel = $user->id;
902 $result =
$object->update($user);
906 $result =
$object->call_trigger(
'HOLIDAY_CANCEL', $user);
911 $startDate =
$object->date_debut_gmt;
912 $endDate =
$object->date_fin_gmt;
913 $alreadydebited =
true;
915 if (!empty($decrease)) {
917 $date = strtotime(
'-1 month', $lastUpdate);
918 $endOfMonthBeforeLastUpdate =
dol_mktime(0, 0, 0, (
int)
date(
'm', $date), (
int)
date(
't', $date), (
int)
date(
'Y', $date), 1);
919 if (
$object->date_debut_gmt < $endOfMonthBeforeLastUpdate &&
$object->date_fin_gmt > $endOfMonthBeforeLastUpdate) {
920 $endDate = $endOfMonthBeforeLastUpdate;
921 } elseif (
$object->date_debut_gmt > $endOfMonthBeforeLastUpdate) {
922 $alreadydebited =
false;
927 $tmpUser->fetch(
$object->fk_user);
932 if (!$alreadydebited) {
936 $newSolde = ($soldeActuel + $nbopenedday);
939 $result1 =
$object->addLogCP($user->id,
$object->fk_user,
$object->ref.
' - '.$langs->transnoentitiesnoconv(
"HolidayCreditAfterCancellation"), $newSolde,
$object->fk_type);
944 if ($result1 < 0 || $result2 < 0) {
957 if (!$error && $result > 0) {
960 $destinataire->fetch(
$object->fk_user);
961 $emailTo = $destinataire->email;
964 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
970 $expediteur->fetch(
$object->fk_user_cancel);
980 $subject = $societeName.
" - ".$langs->transnoentitiesnoconv(
"HolidaysCanceled");
983 $message =
"<p>".$langs->transnoentitiesnoconv(
"Hello").
" ".$destinataire->firstname.
",</p>\n";
989 $message .=
"<ul>\n";
990 $message .=
"<li>".$langs->transnoentitiesnoconv(
"ModifiedBy").
" : ".
dolGetFirstLastname($expediteur->firstname, $expediteur->lastname).
"</li>\n";
991 $message .=
"<li>".$langs->transnoentitiesnoconv(
"Link").
' : <a href="'.$link.
'" target="_blank">'.$link.
"</a></li>\n";
992 $message .=
"</ul>\n";
994 $trackid =
'leav'.$object->id;
998 $mail =
new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(),
'', $sendtobcc, 0, 1,
'',
'', $trackid);
1001 $result = $mail->sendfile();
1007 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
1041$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
1043$title = $langs->trans(
'Leave');
1044$help_url =
'EN:Module_Holiday';
1046llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card');
1050if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
1052 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'))))) {
1053 $errors[] = $langs->trans(
'CantCreateCP');
1062 $errors[] = $langs->trans(
'ErrorEndDateCP');
1065 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
1068 $errors[] = $langs->trans(
'CantCreateCP');
1071 $errors[] = $langs->trans(
'InvalidValidatorCP');
1074 $errors[] = $langs->trans(
'NoDateDebut');
1077 $errors[] = $langs->trans(
'NoDateFin');
1079 case 'DureeHoliday':
1080 $errors[] = $langs->trans(
'ErrorDureeCP');
1083 $errors[] = $langs->trans(
'alreadyCPexist');
1091 print
'<script type="text/javascript">
1092 $( document ).ready(function() {
1093 $("input.button-save").click("submit", function(e) {
1094 console.log("Call valider()");
1095 if (document.demandeCP.date_debut_.value != "")
1097 if(document.demandeCP.date_fin_.value != "")
1099 if(document.demandeCP.valideur.value != "-1") {
1103 alert("'.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'");
1109 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'");
1115 alert("'.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'");
1124 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="demandeCP">'.
"\n";
1125 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1126 print
'<input type="hidden" name="action" value="add" />'.
"\n";
1132 print
'<table class="border centpercent">';
1137 print
'<td class="titlefield fieldrequired tdtop">'.$langs->trans(
"User").
'</td>';
1138 print
'<td><div class="inline-block">';
1139 if ($permissiontoadd && !$permissiontoaddall) {
1140 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');
1143 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');
1148 print
'<div class="leaveuserbalance paddingtop inline-block floatright badge badge-status0 badge-status margintoponsmartphone">';
1152 $typeleaves =
$object->getTypes(1, 1);
1153 foreach ($typeleaves as $key => $val) {
1154 $nb_type =
$object->getCPforUser(($fuserid ? $fuserid : $user->id), $val[
'rowid']);
1155 $nb_holiday += $nb_type;
1157 $out .=
' - '.($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']).
': <strong>'.($nb_type ?
price2num($nb_type) : 0).
'</strong>';
1158 if ($val[
'newbymonth'] > 0) {
1159 $out .=
' <span class="opacitymedium">+'.$val[
'newbymonth'].
' / '.$langs->trans(
"Month").
'</span>';
1164 print
' ';
1166 $htmltooltip = $langs->trans(
"Detail").
'<br>';
1167 $htmltooltip .= $out;
1169 print $form->textwithtooltip($langs->trans(
'SoldeCPUser', (
string) round($nb_holiday, 5)).
' '.
img_picto(
'',
'help'), $htmltooltip);
1172 if (!empty(
$conf->use_javascript_ajax)) {
1174 print
'$( document ).ready(function() {
1175 jQuery("#fuserid").change(function() {
1176 console.log("We change to user id "+jQuery("#fuserid").val());
1177 if (jQuery("#fuserid").val() == '.((int) $user->id).
') {
1178 jQuery(".leaveuserbalance").show();
1180 jQuery(".leaveuserbalance").hide();
1187 print
'<div class="leaveuserbalance paddingtop">';
1197 print
'<td class="fieldrequired">'.$langs->trans(
"Type").
'</td>';
1199 $typeleaves =
$object->getTypes(1, -1);
1200 $arraytypeleaves = array();
1201 foreach ($typeleaves as $key => $val) {
1202 $labeltoshow = ($langs->trans($val[
'code']) != $val[
'code'] ? $langs->trans($val[
'code']) : $val[
'label']);
1203 $labeltoshow .= ($val[
'delay'] > 0 ?
' ('.$langs->trans(
"NoticePeriod").
': '.$val[
'delay'].
' '.$langs->trans(
"days").
')' :
'');
1204 $arraytypeleaves[$val[
'rowid']] = $labeltoshow;
1206 if (empty($typeleaves)) {
1207 print $langs->trans(
"PleaseDefineSomeTypeOfHolidayFirst");
1209 print $form->selectarray(
'type', $arraytypeleaves, (
GETPOST(
'type',
'alpha') ?
GETPOST(
'type',
'alpha') :
''), 1, 0, 0,
'', 0, 0, 0,
'',
'', 1);
1211 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1219 print
'<td class="fieldrequired">';
1220 print $form->textwithpicto($langs->trans(
"DateDebCP"), $langs->trans(
"FirstDayOfHoliday"));
1222 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1223 if (!
GETPOST(
'date_debut_')) {
1224 print $form->selectDate(-1,
'date_debut_', 0, 0, 0,
'', 1, 1);
1226 $tmpdate =
GETPOSTDATE(
'date_debut_',
'00:00:00');
1227 print $form->selectDate($tmpdate,
'date_debut_', 0, 0, 0,
'', 1, 1);
1229 print
' ';
1230 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday',
'alpha') ?
GETPOST(
'starthalfday',
'alpha') :
'morning'));
1236 print
'<td class="fieldrequired">';
1237 print $form->textwithpicto($langs->trans(
"DateFinCP"), $langs->trans(
"LastDayOfHoliday"));
1239 print
'<td>'.img_picto(
'',
'action',
'class="pictofixedwidth"');
1241 print $form->selectDate(-1,
'date_fin_', 0, 0, 0,
'', 1, 1);
1244 print $form->selectDate($tmpdate,
'date_fin_', 0, 0, 0,
'', 1, 1);
1246 print
' ';
1247 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday',
'alpha') ?
GETPOST(
'endhalfday',
'alpha') :
'afternoon'));
1253 print
'<td class="fieldrequired">'.$langs->trans(
"ReviewedByCP").
'</td>';
1257 $include_users =
$object->fetch_users_approver_holiday();
1258 if (empty($include_users)) {
1259 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1263 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
1264 if ($fuserid != $user->id) {
1266 $fuser->fetch($fuserid);
1267 $defaultselectuser = (empty($fuser->fk_user_holiday_validator) ? $fuser->fk_user : $fuser->fk_user_holiday_validator);
1276 $s = $form->select_dolusers($defaultselectuser,
"valideur", 1,
null, 0, $include_users,
'',
'0,'.
$conf->entity, 0, 0,
'', 0,
'',
'minwidth200 maxwidth500');
1277 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1286 print
'<td>'.$langs->trans(
"DescCP").
'</td>';
1287 print
'<td class="tdtop">';
1288 $doleditor =
new DolEditor(
'description',
GETPOST(
'description',
'restricthtml'),
'', 80,
'dolibarr_notes',
'In',
false,
false,
isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1289 print $doleditor->Create(1);
1293 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1300 print $form->buttonsSaveCancel(
"SendRequestCP");
1302 print
'</from>'.
"\n";
1305 if ($error && $action !=
'edit') {
1306 print
'<div class="tabBar">';
1307 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1311 if (($id > 0) || $ref) {
1312 $result =
$object->fetch($id, $ref);
1314 $approverexpected =
new User(
$db);
1315 $approverexpected->fetch(
$object->fk_validator);
1318 $userRequest->fetch(
$object->fk_user);
1326 $errors[] = $langs->transnoentitiesnoconv(
'ErrorEndDateCP');
1329 $errors[] = $langs->transnoentitiesnoconv(
'ErrorSQLCreateCP');
1332 $errors[] = $langs->transnoentitiesnoconv(
'CantCreateCP');
1335 $errors[] = $langs->transnoentitiesnoconv(
'InvalidValidatorCP');
1338 $errors[] = $langs->transnoentitiesnoconv(
'NoDateDebut');
1341 $errors[] = $langs->transnoentitiesnoconv(
'NoDateFin');
1343 case 'DureeHoliday':
1344 $errors[] = $langs->transnoentitiesnoconv(
'ErrorDureeCP');
1346 case 'NoMotifRefuse':
1347 $errors[] = $langs->transnoentitiesnoconv(
'NoMotifRefuseCP');
1350 $errors[] = $langs->transnoentitiesnoconv(
'ErrorMailNotSend');
1366 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">'.
"\n";
1367 print
'<input type="hidden" name="token" value="'.newToken().
'" />'.
"\n";
1368 print
'<input type="hidden" name="action" value="update"/>'.
"\n";
1369 print
'<input type="hidden" name="id" value="'.$object->id.
'" />'.
"\n";
1372 print
dol_get_fiche_head($head,
'card', $langs->trans(
"CPTitreMenu"), -1,
'holiday');
1374 $linkback =
'<a href="'.DOL_URL_ROOT.
'/holiday/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1376 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref');
1379 print
'<div class="fichecenter">';
1380 print
'<div class="fichehalfleft">';
1381 print
'<div class="underbanner clearboth"></div>';
1383 print
'<table class="border tableforfield centpercent">';
1388 print
'<td class="titlefield">'.$langs->trans(
"User").
'</td>';
1390 print $userRequest->getNomUrl(-1,
'leave');
1395 print
'<td>'.$langs->trans(
"Type").
'</td>';
1397 $typeleaves =
$object->getTypes(1, -1);
1398 if (empty($typeleaves[
$object->fk_type])) {
1399 $labeltoshow = $langs->trans(
"TypeWasDisabledOrRemoved",
$object->fk_type);
1401 $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']);
1407 $starthalfday = (
$object->halfday == -1 ||
$object->halfday == 2) ?
'afternoon' :
'morning';
1408 $endhalfday = (
$object->halfday == 1 ||
$object->halfday == 2) ?
'morning' :
'afternoon';
1412 print
'<td class="nowrap">';
1413 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1415 print
'<td>'.dol_print_date(
$object->date_debut,
'day');
1416 print
' ';
1417 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).
'</span>';
1422 print
'<td class="nowrap">';
1423 print $form->textwithpicto($langs->trans(
'DateDebCP'), $langs->trans(
"FirstDayOfHoliday"));
1426 $tmpdate =
GETPOSTDATE(
'date_debut_',
'00:00:00');
1427 print $form->selectDate($tmpdate ? $tmpdate :
$object->date_debut,
'date_debut_');
1428 print
' ';
1429 print $form->selectarray(
'starthalfday', $listhalfday, (
GETPOST(
'starthalfday') ?
GETPOST(
'starthalfday') : $starthalfday));
1436 print
'<td class="nowrap">';
1437 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1439 print
'<td>'.dol_print_date(
$object->date_fin,
'day');
1440 print
' ';
1441 print
'<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).
'</span>';
1446 print
'<td class="nowrap">';
1447 print $form->textwithpicto($langs->trans(
'DateFinCP'), $langs->trans(
"LastDayOfHoliday"));
1450 print $form->selectDate(
$object->date_fin,
'date_fin_');
1451 print
' ';
1452 print $form->selectarray(
'endhalfday', $listhalfday, (
GETPOST(
'endhalfday') ?
GETPOST(
'endhalfday') : $endhalfday));
1460 $htmlhelp = $langs->trans(
'NbUseDaysCPHelp');
1461 $includesaturday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1);
1462 $includesunday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1);
1463 if ($includesaturday) {
1464 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Saturday"));
1466 if ($includesunday) {
1467 $htmlhelp .=
'<br>'.$langs->trans(
"DayIsANonWorkingDay", $langs->trans(
"Sunday"));
1469 print $form->textwithpicto($langs->trans(
'NbUseDaysCP'), $htmlhelp);
1478 print
'<td>'.$langs->trans(
'DetailRefusCP').
'</td>';
1479 print
'<td>'.$object->detail_refuse.
'</td>';
1486 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1487 print
'<td>'.nl2br(
$object->description).
'</td>';
1491 print
'<td>'.$langs->trans(
'DescCP').
'</td>';
1492 print
'<td class="tdtop">';
1493 $doleditor =
new DolEditor(
'description',
$object->description,
'', 80,
'dolibarr_notes',
'In',
false,
false,
isModEnabled(
'fckeditor'), ROWS_3,
'90%');
1494 print $doleditor->Create(1);
1499 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1502 print
'</table>'.
"\n";
1505 print
'<div class="fichehalfright">';
1507 print
'<div class="underbanner clearboth"></div>';
1510 print
'<table class="border tableforfield centpercent">'.
"\n";
1513 if (!empty(
$object->fk_user_create)) {
1515 $userCreate->fetch(
$object->fk_user_create);
1517 print
'<td class="titlefield">'.$langs->trans(
'RequestByCP').
'</td>';
1518 print
'<td>'.$userCreate->getNomUrl(-1).
'</td>';
1523 if (!$edit && $action !=
'editvalidator') {
1525 print
'<td class="titlefield">';
1527 print $langs->trans(
'ApprovedBy');
1529 print $langs->trans(
'ReviewedByCP');
1534 if (
$object->fk_user_approve > 0) {
1535 $approverdone =
new User(
$db);
1536 $approverdone->fetch(
$object->fk_user_approve);
1537 print $approverdone->getNomUrl(-1);
1540 print $approverexpected->getNomUrl(-1);
1542 $include_users =
$object->fetch_users_approver_holiday();
1544 print
'<a class="editfielda paddingleft" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=editvalidator">'.
img_edit($langs->trans(
"Edit")).
'</a>';
1550 print
'<td class="titlefield">'.$langs->trans(
'ReviewedByCP').
'</td>';
1552 $include_users =
$object->fetch_users_approver_holiday();
1553 if (!in_array(
$object->fk_validator, $include_users)) {
1554 $include_users[] =
$object->fk_validator;
1556 if (empty($include_users)) {
1557 print
img_warning().
' '.$langs->trans(
"NobodyHasPermissionToValidateHolidays");
1559 $arrayofvalidatorstoexclude = (($user->admin || ($user->id != $userRequest->id)) ?
'' : array($user->id));
1560 $s = $form->select_dolusers(
$object->fk_validator,
"valideur", (($action ==
'editvalidator') ? 0 : 1), $arrayofvalidatorstoexclude, 0, $include_users);
1561 print $form->textwithpicto($s, $langs->trans(
"AnyOtherInThisListCanValidate"));
1563 if ($action ==
'editvalidator') {
1564 print
'<input type="submit" class="button button-save" name="savevalidator" value="'.$langs->trans(
"Save").
'">';
1565 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1572 print
'<td>'.$langs->trans(
'DateCreation').
'</td>';
1573 print
'<td>'.dol_print_date(
$object->date_create,
'dayhour',
'tzuser').
'</td>';
1577 print
'<td>'.$langs->trans(
'DateValidCP').
'</td>';
1578 print
'<td>'.dol_print_date(
$object->date_approval,
'dayhour',
'tzuser').
'</td>';
1583 print
'<td>'.$langs->trans(
'DateCancelCP').
'</td>';
1584 print
'<td>'.dol_print_date(
$object->date_cancel,
'dayhour',
'tzuser').
'</td>';
1589 print
'<td>'.$langs->trans(
'DateRefusCP').
'</td>';
1590 print
'<td>'.dol_print_date(
$object->date_refuse,
'dayhour',
'tzuser').
'</td>';
1599 print
'<div class="clearboth"></div>';
1605 if ($action ==
'delete') {
1607 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleDeleteCP"), $langs->trans(
"ConfirmDeleteCP"),
"confirm_delete",
'', 0, 1);
1613 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleToValidCP"), $langs->trans(
"ConfirmToValidCP"),
"confirm_send",
'', 1, 1);
1617 if ($action ==
'valid') {
1618 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleValidCP"), $langs->trans(
"ConfirmValidCP"),
"confirm_valid",
'', 1, 1);
1622 if ($action ==
'refuse') {
1623 $array_input = array(array(
'type' =>
"text",
'label' => $langs->trans(
'DetailRefusCP'),
'name' =>
"detail_refuse",
'size' =>
"50",
'value' =>
""));
1624 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id.
"&action=confirm_refuse", $langs->trans(
"TitleRefuseCP"), $langs->trans(
'ConfirmRefuseCP'),
"confirm_refuse", $array_input, 1, 0);
1628 if ($action ==
'cancel') {
1629 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleCancelCP"), $langs->trans(
"ConfirmCancelCP"),
"confirm_cancel",
'', 1, 1);
1633 if ($action ==
'backtodraft') {
1634 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
"TitleSetToDraft"), $langs->trans(
"ConfirmSetToDraft"),
"confirm_draft",
'', 1, 1);
1640 print $form->buttonsSaveCancel();
1650 print
'<div class="tabsAction">';
1653 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=edit&token='.
newToken().
'" class="butAction">'.$langs->trans(
"EditCP").
'</a>';
1657 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=sendToValidate&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Validate").
'</a>';
1662 if (($user->id ==
$object->fk_validator || $permissiontoaddall) && $permissiontoapprove) {
1663 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=valid&token='.
newToken().
'" class="butAction">'.$langs->trans(
"Approve").
'</a>';
1664 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=refuse&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1666 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"Approve").
'</a>';
1667 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotTheAssignedApprover").
'">'.$langs->trans(
"ActionRefuseCP").
'</a>';
1670 if ($permissiontoadd || $permissiontoaddall) {
1672 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1674 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1680 if ($user->id ==
$object->fk_validator || $user->id ==
$object->fk_user_approve || $permissiontoadd || $permissiontoaddall || $permissiontoapprove) {
1681 if (((
$object->date_fin >
dol_now()) && $permissiontoapprove) || $user->id ==
$object->fk_user_approve) {
1682 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1685 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=cancel&token='.
newToken().
'" class="butAction">'.$langs->trans(
"ActionCancelCP").
'</a>';
1687 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"HolidayStarted").
' - '.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1691 print
'<a href="#" class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotAllowed").
'">'.$langs->trans(
"ActionCancelCP").
'</a>';
1696 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=backtodraft&token='.
newToken().
'" class="butAction">'.$langs->trans(
"SetToDraft").
'</a>';
1699 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.
newToken().
'" class="butActionDelete">'.$langs->trans(
"DeleteCP").
'</a>';
1705 print
'<div class="tabBar">';
1706 print $langs->trans(
'ErrorUserViewCP');
1707 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1711 print
'<div class="tabBar">';
1712 print $langs->trans(
'ErrorIDFicheCP');
1713 print
'<br><br><input type="button" value="'.$langs->trans(
"ReturnCP").
'" class="button" onclick="history.go(-1)" />';
1719 if (
GETPOST(
'modelselected')) {
1720 $action =
'presend';
1723 if ($action !=
'presend' && $action !=
'edit') {
1724 print
'<div class="fichecenter"><div class="fichehalfleft">';
1725 print
'<a name="builddoc"></a>';
1744 print
'</div><div class="fichehalfright">';
1750 $morehtmlcenter =
'';
1753 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
1755 $somethingshown = $formactions->showactions($object,
$object->element, (is_object(
$object->thirdparty) ?
$object->thirdparty->id : 0), 1,
'', $MAXEVENT,
'', $morehtmlcenter);
1757 print
'</div></div>';
1765if (is_object(
$db)) {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $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, $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.
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...
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.
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.
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).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
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.
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
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.