34require
'../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';
57$action =
GETPOST(
'action',
'aZ09');
58$cancel =
GETPOST(
'cancel',
'alpha');
59$confirm =
GETPOST(
'confirm',
'alpha');
60$backtopage =
GETPOST(
'backtopage',
'alpha');
61$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
66$users = (
GETPOST(
'users',
'array') ?
GETPOST(
'users',
'array') : array($user->id));
67$groups =
GETPOST(
'groups',
'array');
73$langs->loadLangs(array(
"other",
"holiday",
"mails",
"trips"));
79$childids = $user->getAllChildIds(1);
83 $morefilter =
'AND employee = 1';
89$extrafields->fetch_name_optionals_label(
$object->table_element);
91if (($id > 0) || $ref) {
96 if ($user->hasRight(
'holiday',
'readall')) {
99 if ($user->hasRight(
'holiday',
'read') && in_array(
$object->fk_user, $childids)) {
108$hookmanager->initHooks(array(
'holidaycard',
'globalcard'));
111$permissiontoaddall = 0;
112if ($user->hasRight(
'holiday',
'write') && in_array($fuserid, $childids)) {
113 $permissiontoadd = 1;
115if ($user->hasRight(
'holiday',
'writeall')) {
116 $permissiontoadd = 1;
117 $permissiontoaddall = 1;
121if ($user->hasRight(
'holiday',
'delete')) {
130 $socid = $user->socid;
139$parameters = array(
'socid' => $socid);
140$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
142 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
145if (empty($reshook)) {
146 $backurlforlist = DOL_URL_ROOT.
'/holiday/list.php';
148 if (empty($backtopage) || ($cancel && empty($id))) {
149 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
150 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
151 $backtopage = $backurlforlist;
153 $backtopage = DOL_URL_ROOT.
'/holiday/card_group.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
159 if (!empty($backtopageforcancel)) {
160 header(
"Location: ".$backtopageforcancel);
162 } elseif (!empty($backtopage)) {
163 header(
"Location: ".$backtopage);
170 if ($action ==
'add' && $permissiontoadd) {
171 $users =
GETPOST(
'users',
'array');
172 $groups =
GETPOST(
'groups',
'array');
178 $starthalfday =
GETPOST(
'starthalfday');
179 $endhalfday =
GETPOST(
'endhalfday');
183 if ($starthalfday ==
'afternoon' && $endhalfday ==
'morning') {
185 } elseif ($starthalfday ==
'afternoon') {
187 } elseif ($endhalfday ==
'morning') {
192 $description = trim(
GETPOST(
'description',
'restricthtml'));
195 if (!$permissiontoaddall) {
197 if (!$user->hasRight(
'holiday',
'write')) {
199 setEventMessages($langs->trans(
"NotEnoughPermissions"),
null,
'errors');
200 } elseif (!in_array($fuserid, $childids)) {
202 setEventMessages($langs->trans(
"UserNotInHierachy"),
null,
'errors');
206 if (!$user->hasRight(
'holiday',
'write') && !$user->hasRight(
'holiday',
'writeall')) {
208 setEventMessages($langs->trans(
"NotEnoughPermissions"),
null,
'errors');
209 } elseif (!$user->hasRight(
'holiday',
'writeall') && !in_array($fuserid, $childids)) {
211 setEventMessages($langs->trans(
"UserNotInHierachy"),
null,
'errors');
217 if (empty($groups) && empty($users)) {
218 setEventMessages($langs->trans(
"ErrorFieldRequiredUserOrGroup"),
null,
'errors');
226 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Type")),
null,
'errors');
232 if (empty($date_debut)) {
233 setEventMessages($langs->trans(
"NoDateDebut"),
null,
'errors');
238 if (empty($date_fin)) {
239 setEventMessages($langs->trans(
"NoDateFin"),
null,
'errors');
244 if ($date_debut > $date_fin) {
245 setEventMessages($langs->trans(
"ErrorEndDateCP"),
null,
'errors');
251 $nbopenedday =
num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday,
$mysoc->country_id);
252 if ($nbopenedday < 0.5) {
253 setEventMessages($langs->trans(
"ErrorDureeCP"),
null,
'errors');
259 if ($approverid < 1) {
260 setEventMessages($langs->transnoentitiesnoconv(
'InvalidValidatorCP'),
null,
'errors');
268 $TusersToProcess = array();
272 if (is_array($groups) && count($groups) > 0) {
273 $sql =
' SELECT DISTINCT u.rowid,u.lastname,u.firstname from ' . MAIN_DB_PREFIX .
'user as u';
274 $sql .=
' LEFT JOIN ' . MAIN_DB_PREFIX .
'usergroup_user as ug on ug.fk_user = u.rowid ';
275 $sql .=
' WHERE fk_usergroup in (' .$db->sanitize(implode(
',', $groups)) .
')';
276 $resql = $db->query($sql);
279 while ($obj = $db->fetch_object($resql)) {
280 $TusersToProcess[$obj->rowid] = $obj->rowid;
285 if (is_array($users) && count($users) > 0) {
286 foreach ($users as $u) {
287 $TusersToProcess[$u] = $u;
290 foreach ($TusersToProcess as $u) {
292 $verifCP =
$object->verifDateHolidayCP($u, $date_debut, $date_fin, $halfday);
296 $userError =
new User($db);
297 $result = $userError->fetch($u);
300 setEventMessages($langs->trans(
"UseralreadyCPexist", $userError->firstname .
' '. $userError->lastname),
null,
'errors');
302 setEventMessages($langs->trans(
"ErrorUserFetch", $u),
null,
'errors');
313 foreach ($TusersToProcess as $u) {
316 $object->description = $description;
317 $object->fk_validator = $approverid;
319 $object->date_debut = $date_debut;
323 $result =
$object->create($user);
329 if ($autoValidation) {
331 $htemp->fetch($result);
334 $approver =
new User($db);
335 $approver->fetch($approverid);
336 $resultValidated = $htemp->validate($approver);
338 if ($resultValidated < 0) {
344 if ($AutoSendMail && !$error) {
346 $returnSendMail =
sendMail($result, $permissiontoadd, $now, $autoValidation);
347 if (!empty($returnSendMail->msg)) {
348 setEventMessage($returnSendMail->msg, $returnSendMail->style);
358 header(
'Location: '.DOL_URL_ROOT.
'/holiday/list.php');
373$form =
new Form($db);
376$listhalfday = array(
'morning' => $langs->trans(
"Morning"),
"afternoon" => $langs->trans(
"Afternoon"));
378$title = $langs->trans(
'Leave');
379$help_url =
'EN:Module_Holiday';
382llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-holiday page-card_group');
384if ((empty($id) && empty($ref)) || $action ==
'create' || $action ==
'add') {
386 if ((in_array($fuserid, $childids) && !$user->hasRight(
'holiday',
'writeall')) || (!in_array($fuserid, $childids) && (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || !$user->hasRight(
'holiday',
'writeall')))) {
387 $errors[] = $langs->trans(
'CantCreateCP');
390 print
load_fiche_titre($langs->trans(
'MenuCollectiveAddCP'),
'',
'title_hrm.png');
396 $errors[] = $langs->trans(
'ErrorEndDateCP');
399 $errors[] = $langs->trans(
'ErrorSQLCreateCP');
402 $errors[] = $langs->trans(
'CantCreateCP');
405 $errors[] = $langs->trans(
'InvalidValidatorCP');
408 $errors[] = $langs->trans(
'NoDateDebut');
411 $errors[] = $langs->trans(
'NoDateFin');
414 $errors[] = $langs->trans(
'ErrorDureeCP');
417 $errors[] = $langs->trans(
'alreadyCPexist');
421 setEventMessages(
'', $errors,
'errors');
425 print
'<script type="text/javascript">
426 $( document ).ready(function() {
428 if( $("input[name=autoValidation]").is(":checked") ){
429 $("#AutoSendMail").prop("disabled", false);
430 $("#AutoSendMail").prop("checked", true);
433 $("#AutoSendMail").prop("disabled", true);
434 $("#AutoSendMail").prop("checked", false);
437 $("input[name=autoValidation]").click( function(e) {
440 if( $("input[name=autoValidation]").is(":checked") ){
441 $("#AutoSendMail").prop("disabled", false);
442 $("#AutoSendMail").prop("checked", true);
444 $("#AutoSendMail").prop("disabled", true);
445 $("#AutoSendMail").prop("checked", false);
451 $("input.button-save").click("submit", function(e) {
452 console.log("Call valider()");
453 if (document.demandeCP.date_debut_.value != "")
455 if(document.demandeCP.date_fin_.value != "")
457 if(document.demandeCP.valideur.value != "-1") {
461 alert(\''.dol_escape_js($langs->transnoentities(
'InvalidValidatorCP')).
'\');
467 alert(\
''.
dol_escape_js($langs->transnoentities(
'NoDateFin')).
'\');
473 alert(\
''.
dol_escape_js($langs->transnoentities(
'NoDateDebut')).
'\');
478 $(
"#autoValidation").change(
function(){
479 if( $(
"input[name=autoValidation]").is(
":checked") ){
480 $(
"#AutoSendMail").prop(
"disabled",
false);
482 $(
"#AutoSendMail").prop(
"disabled",
true);
483 $(
"#AutoSendMail").prop(
"checked",
false);
490 // Leave request form
491 print '<form method=
"POST" action=
"'.$_SERVER['PHP_SELF'].'" name=
"demandeCP">
'."\n";
492 print '<input
type=
"hidden" name=
"token" value=
"'.newToken().'" />
'."\n";
493 print '<input
type=
"hidden" name=
"action" value=
"add" />
'."\n";
495 print dol_get_fiche_head();
497 print '<
table class=
"border centpercent">
';
502 print '<td
class=
"titlefield fieldrequired">
';
503 print $form->textwithpicto($langs->trans("groups"), $langs->trans("fusionGroupsUsers"));
506 print img_picto($langs->trans("groups"), 'group
', 'class=
"pictofixedwidth"');
508 $sql = ' SELECT rowid, nom from
'.MAIN_DB_PREFIX.'usergroup WHERE entity IN (
'.getEntity('usergroup
').')
';
509 $resql = $db->query($sql);
511 while ($obj = $db->fetch_object($resql)) {
512 $Tgroup[$obj->rowid] = $obj->nom;
515 print $form->multiselectarray('groups
', $Tgroup, GETPOST('groups
', 'array
'), 0, 0, 'quatrevingtpercent widthcentpercentminusx
', 0, 0);
521 print '<td
class=
"titlefield fieldrequired">
';
522 print $form->textwithpicto($langs->trans("users"), $langs->trans("fusionGroupsUsers"));
524 print img_picto($langs->trans("users"), 'user', 'class=
"pictofixedwidth"');
526 $sql = 'SELECT u.rowid, u.lastname, u.firstname, u.login, u.photo FROM
'.MAIN_DB_PREFIX.'user as u
';
527 $sql .= ' WHERE 1 = 1
';
528 $sql .= empty($morefilter) ? '' : $morefilter;
531 $userstatic = new User($db);
533 $resql = $db->query($sql);
535 while ($obj = $db->fetch_object($resql)) {
536 $userstatic->id = $obj->rowid;
537 $userstatic->login = $obj->login;
538 $userstatic->firstname = $obj->firstname;
539 $userstatic->lastname = $obj->lastname;
540 $userstatic->photo = $obj->photo;
542 $userlist[$obj->rowid] = array(
544 'label
' => dolGetFirstLastname($obj->firstname, $obj->lastname),
545 'data-html
' => $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login
', '', 1).' '.dolGetFirstLastname($obj->firstname, $obj->lastname)
550 print img_picto('', 'users
', 'class=
"pictofixedwidth"') . $form->multiselectarray('users
', $userlist, GETPOST('users
', 'array
'), 0, 0, 'quatrevingtpercent widthcentpercentminusx
', 0, 0);
555 print '<td
class=
"fieldrequired">
'.$langs->trans("Type").'</td>
';
557 $typeleaves = $object->getTypes(1, -1);
558 $arraytypeleaves = array();
559 foreach ($typeleaves as $key => $val) {
560 $labeltoshow = ($langs->trans($val['code
']) != $val['code
'] ? $langs->trans($val['code
']) : $val['label
']);
561 $labeltoshow .= ($val['delay
'] > 0 ? ' (
'.$langs->trans("NoticePeriod").':
'.$val['delay
'].' '.$langs->trans("days").')
' : '');
562 $arraytypeleaves[$val['rowid
']] = $labeltoshow;
564 print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha
') ? GETPOST('type', 'alpha
') : ''), 1, 0, 0, '', 0, 0, 0, '', '', 1);
566 print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
573 print '<td
class=
"fieldrequired">
';
574 print $form->textwithpicto($langs->trans("DateDebCP"), $langs->trans("FirstDayOfHoliday"));
577 // If the request does not come from the agenda
578 if (!GETPOST('date_debut_
')) {
579 print $form->selectDate(-1, 'date_debut_
', 0, 0, 0, '', 1, 1);
581 $tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_debut_month
'), GETPOSTINT('date_debut_day
'), GETPOSTINT('date_debut_year
'));
582 print $form->selectDate($tmpdate, 'date_debut_
', 0, 0, 0, '', 1, 1);
584 print '
';
585 print $form->selectarray('starthalfday
', $listhalfday, (GETPOST('starthalfday
', 'alpha
') ? GETPOST('starthalfday
', 'alpha
') : 'morning
'));
591 print '<td
class=
"fieldrequired">
';
592 print $form->textwithpicto($langs->trans("DateFinCP"), $langs->trans("LastDayOfHoliday"));
595 if (!GETPOST('date_fin_
')) {
596 print $form->selectDate(-1, 'date_fin_
', 0, 0, 0, '', 1, 1);
598 $tmpdate = dol_mktime(0, 0, 0, GETPOSTINT('date_fin_month
'), GETPOSTINT('date_fin_day
'), GETPOSTINT('date_fin_year
'));
599 print $form->selectDate($tmpdate, 'date_fin_
', 0, 0, 0, '', 1, 1);
601 print '
';
602 print $form->selectarray('endhalfday
', $listhalfday, (GETPOST('endhalfday
', 'alpha
') ? GETPOST('endhalfday
', 'alpha
') : 'afternoon
'));
608 print '<td
class=
"fieldrequired">
'.$langs->trans("ReviewedByCP").'</td>
';
611 $object = new Holiday($db);
612 $include_users = $object->fetch_users_approver_holiday();
613 if (empty($include_users)) {
614 print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
616 // Defined default approver (the forced approver of user or the supervisor if no forced value defined)
617 // Note: This use will be set only if the defined approver has permission to approve so is inside include_users
618 $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
619 if (getDolGlobalString('HOLIDAY_DEFAULT_VALIDATOR
')) {
620 $defaultselectuser = getDolGlobalString('HOLIDAY_DEFAULT_VALIDATOR
'); // Can force default approver
622 if (GETPOSTINT('valideur
') > 0) {
623 $defaultselectuser = GETPOSTINT('valideur
');
625 $s = $form->select_dolusers($defaultselectuser, "valideur", 1, null, 0, $include_users, '', '0,
'.$conf->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500
');
626 print img_picto('', 'user').$form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
633 //auto validation ON CREATE
634 print '<tr><td>
'.$langs->trans("AutoValidationOnCreate").'</td><td>
';
635 print '<input
type=
"checkbox" id=
"autoValidation" name=
"autoValidation" value=
"1"'.($autoValidation ? ' checked=
"checked"' : '').'>
';
636 print '</td></tr>
'."\n";
640 print '<tr><td>
'.$langs->trans("AutoSendMail").'</td><td>
';
641 print '<input
type=
"checkbox" id=
"AutoSendMail" name=
"AutoSendMail" value=
"1"'.($AutoSendMail ? ' checked=
"checked"' : '').'>
';
642 print '</td></tr>
'."\n";
646 print '<td>
'.$langs->trans("DescCP").'</td>
';
647 print '<td
class=
"tdtop">
';
648 $doleditor = new DolEditor('description', GETPOST('description', 'restricthtml
'), '', 80, 'dolibarr_notes
', 'In
', false, false, isModEnabled('fckeditor
'), ROWS_3, '90%
');
649 print $doleditor->Create(1);
653 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php
';
658 print dol_get_fiche_end();
660 print $form->buttonsSaveCancel("SendRequestCollectiveCP");
662 print '</from>
'."\n";
666 print '<div
class=
"tabBar">
';
668 print '<br><br><input
type=
"button" value=
"'.$langs->trans("ReturnCP
").'" class=
"button" onclick=
"history.go(-1)" />
';
691function sendMail($id, $cancreate, $now, $autoValidation)
693 $objStd = new stdClass();
695 $objStd->status = 'success
';
699 global $db, $user, $langs;
701 $object = new Holiday($db);
703 $result = $object->fetch($id);
706 // If draft and owner of leave
707 if ($object->status == Holiday::STATUS_VALIDATED && $cancreate) {
708 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
710 //if ($autoValidation) $object->status = Holiday::STATUS_VALIDATED;
712 $verif = $object->validate($user);
716 $destinataire = new User($db);
717 $destinataire->fetch($object->fk_validator);
718 $emailTo = $destinataire->email;
722 dol_syslog("Expected validator has no email, so we redirect directly to finished page without sending email");
725 $objStd->msg = $langs->trans('ErrorMailRecipientIsEmpty
');
726 $objStd->status = 'error
';
727 $objStd->style = "warnings";
732 $expediteur = new User($db);
733 $expediteur->fetch($object->fk_user);
735 //$emailFrom = $expediteur->email; Email of user can be an email into another company. Sending will fails, we must use the generic email.
736 $emailFrom = getDolGlobalString('MAIN_MAIL_EMAIL_FROM
');
739 $societeName = getDolGlobalString('MAIN_INFO_SOCIETE_NOM
');
740 if (getDolGlobalString('MAIN_APPLICATION_TITLE
')) {
741 $societeName = getDolGlobalString('MAIN_APPLICATION_TITLE
');
744 $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate");
747 $message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
749 $message .= "<p>".$langs->transnoentities("HolidaysToValidateBody")."</p>\n";
752 // option to warn the validator in case of too short delay
753 if (!getDolGlobalString('HOLIDAY_HIDE_APPROVER_ABOUT_TOO_LOW_DELAY
')) {
754 $delayForRequest = 0; // TODO Set delay depending of holiday leave type
755 if ($delayForRequest) {
756 $nowplusdelay = dol_time_plus_duree($now, $delayForRequest, 'd
');
758 if ($object->date_debut < $nowplusdelay) {
759 $message = "<p>".$langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."</p>\n";
764 // option to notify the validator if the balance is less than the request
765 // (only for leave types that actually use the balance counter)
766 if (!getDolGlobalString('HOLIDAY_HIDE_APPROVER_ABOUT_NEGATIVE_BALANCE
')) {
767 $affectingtypes = $object->getTypes(1, 1);
768 if (!empty($affectingtypes[$object->fk_type])) {
769 $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday, $expediteur->country_id, $object->fk_user);
771 if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
772 $message .= "<p>".$langs->transnoentities("HolidaysToValidateAlertSolde")."</p>\n";
777 $typeleaves = $object->getTypes(1, -1);
778 $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
']);
780 if ($object->halfday == 2) {
781 $starthalfdaykey = "Afternoon";
782 $endhalfdaykey = "Morning";
783 } elseif ($object->halfday == -1) {
784 $starthalfdaykey = "Afternoon";
785 $endhalfdaykey = "Afternoon";
786 } elseif ($object->halfday == 1) {
787 $starthalfdaykey = "Morning";
788 $endhalfdaykey = "Morning";
789 } elseif ($object->halfday == 0 || $object->halfday == 2) {
790 $starthalfdaykey = "Morning";
791 $endhalfdaykey = "Afternoon";
793 // For static analysis, ensure variables are defined
794 $starthalfdaykey = "InvalidHalfday";
795 $endhalfdaykey = "InvalidHalfday";
798 $link = dol_buildpath("/holiday/card.php", 3) . '?
id=
'.$object->id;
801 $message .= "<li>".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
802 $message .= "<li>".$langs->transnoentitiesnoconv("Type")." : ".(empty($labeltoshow) ? $langs->trans("TypeWasDisabledOrRemoved", $object->fk_type) : $labeltoshow)."</li>\n";
803 $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";
804 $message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href=
"'.$link.'" target=
"_blank">
'.$link."</a></li>\n";
805 $message .= "</ul>\n";
807 $trackid = 'leav
'.$object->id;
809 $sendtobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_HOLIDAY_TO
');
811 $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', $sendtobcc, 0, 1, '', '', $trackid);
814 $result = $mail->sendfile();
818 $objStd->msg = $langs->trans('ErrorMailNotSend
');
819 $objStd->style = "warnings";
820 $objStd->status = 'error
';
822 $objStd->msg = $langs->trans('MailSent
');
828 $objStd->msg = $langs->trans('ErrorVerif
');
829 $objStd->status = 'error
';
830 $objStd->style = "errors";
836 $objStd->msg = $langs->trans('ErrorloadUserOnSendingMail
');
837 $objStd->status = 'error
';
838 $objStd->style = "warnings";
$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]]]',...
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(is_object( $db)) sendMail($id, $cancreate, $now, $autoValidation)
send email to validator for current leave represented by (id)
Class of the module paid holiday.
const STATUS_VALIDATED
Validated status.
const STATUS_DRAFT
Draft status.
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)
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.
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...
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
treeview li table
No Email.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
$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.