34require
'../../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
54$disabledefaultvalues =
GETPOSTINT(
'disabledefaultvalues');
56$action =
GETPOST(
'action',
'aZ09');
59$filter =
GETPOST(
"search_filter",
'alpha', 3) ?
GETPOST(
"search_filter",
'alpha', 3) :
GETPOST(
"filter",
'alpha', 3);
60$filtert =
GETPOST(
"search_filtert",
"intcomma", 3) ?
GETPOST(
"search_filtert",
"intcomma", 3) :
GETPOST(
"filtert",
"intcomma", 3);
66$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
67$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
69if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
73$offset = $limit * $page;
78 $sortfield =
"a.datec";
84 $socid = $user->socid;
91if (!$user->hasRight(
'agenda',
'myactions',
'read')) {
94if (!$user->hasRight(
'agenda',
'allactions',
'read')) {
97if (!$user->hasRight(
'agenda',
'allactions',
'read') || $filter ==
'mine') {
98 $filtert = (string) $user->id;
101$mode =
'show_peruser';
111$optioncss =
GETPOST(
'optioncss',
'aZ');
114if (
GETPOST(
'search_actioncode',
'array:aZ09')) {
115 $actioncode =
GETPOST(
'search_actioncode',
'array:aZ09', 3);
116 if (!count($actioncode)) {
120 $actioncode =
GETPOST(
"search_actioncode",
"alpha", 3) ?
GETPOST(
"search_actioncode",
"alpha", 3) : (
GETPOST(
"search_actioncode",
"alpha") ==
'0' ?
'0' : ((!
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ?
'' :
getDolGlobalString(
'AGENDA_DEFAULT_FILTER_TYPE')));
124if ($dateselect > 0) {
132$tmp = str_replace(
' ',
'', $tmp);
133$tmparray = explode(
'-', $tmp);
136if ($begin_h < 0 || $begin_h > 23) {
139if ($end_h < 1 || $end_h > 24) {
142if ($end_h <= $begin_h) {
143 $end_h = $begin_h + 1;
148$tmp = str_replace(
' ',
'', $tmp);
149$tmparray = explode(
'-', $tmp);
152if ($begin_d < 1 || $begin_d > 7) {
155if ($end_d < 1 || $end_d > 7) {
158if ($end_d < $begin_d) {
159 $end_d = $begin_d + 1;
171if (
GETPOST(
'viewcal',
'alpha') && $mode !=
'show_day' && $mode !=
'show_week' && $mode !=
'show_peruser') {
172 $mode =
'show_month';
176if (
GETPOST(
'viewweek',
'alpha') || $mode ==
'show_week') {
178 $week = ($week ? $week :
date(
"W"));
179 $day = ($day ? $day :
date(
"d"));
182if (
GETPOST(
'viewday',
'alpha') || $mode ==
'show_day') {
184 $day = ($day ? $day :
date(
"d"));
187$labelbytype = array();
192$langs->loadLangs(array(
'users',
'agenda',
'other',
'commercial'));
195$hookmanager->initHooks(array(
'agenda'));
197$result =
restrictedArea($user,
'agenda', 0,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id');
198if ($user->socid && $socid) {
202$search_status = $status;
223 'maxprint' => $maxprint,
225 'filtert' => $filtert,
226 'showbirthday' => $showbirthday,
227 'canedit' => $canedit,
228 'optioncss' => $optioncss,
229 'actioncode' => $actioncode,
231 'resourceid' => $resourceid,
232 'usergroup' => $usergroup,
234$reshook = $hookmanager->executeHooks(
'beforeAgendaPerUser', $parameters, $object, $action);
236 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
239$form =
new Form($db);
240$companystatic =
new Societe($db);
242$help_url =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
243llxHeader(
'', $langs->trans(
"Agenda"), $help_url);
247$nowyear = $nowarray[
'year'];
248$nowmonth = $nowarray[
'mon'];
249$nowday = $nowarray[
'mday'];
252$listofextcals = array();
256while ($i < $MAXAGENDA) {
258 $source =
'AGENDA_EXT_SRC'.$i;
259 $name =
'AGENDA_EXT_NAME'.$i;
260 $offsettz =
'AGENDA_EXT_OFFSETTZ'.$i;
261 $color =
'AGENDA_EXT_COLOR'.$i;
262 $enabled =
'AGENDA_EXT_ENABLED'.$i;
263 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT'.$i;
264 $buggedfile =
'AGENDA_EXT_BUGGEDFILE'.$i;
267 $listofextcals[] = array(
268 'type' =>
'globalsetup',
283while ($i < $MAXAGENDA) {
285 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
286 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
287 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
288 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
289 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
290 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
291 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
295 $listofextcals[] = array(
296 'type' =>
'usersetup',
299 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
301 'cachedelay' =>
getDolUserInt(
'AGENDA_EXT_CACHE_'.$user->id.
'_'.$i, 0),
311$first_day = $prev[
'first_day'];
312$first_month = $prev[
'first_month'];
313$first_year = $prev[
'first_year'];
315$week = $prev[
'week'];
319$next_year = $next[
'year'];
320$next_month = $next[
'month'];
321$next_day = $next[
'day'];
323$max_day_in_month =
date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year));
329$title = $langs->trans(
"DoneAndToDoActions");
330if ($status ==
'done') {
331 $title = $langs->trans(
"DoneActions");
333if ($status ==
'todo') {
334 $title = $langs->trans(
"ToDoActions");
338if (($actioncode && $actioncode !==
'-1') ||
GETPOSTISSET(
'search_actioncode')) {
339 if (is_array($actioncode)) {
340 foreach ($actioncode as $str_action) {
341 if ($str_action !=
'-1') {
342 $param .=
"&search_actioncode[]=".urlencode($str_action);
346 $param .=
"&search_actioncode=".urlencode($actioncode);
349if ($resourceid > 0) {
350 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
354 $param .=
"&search_status=".urlencode($status);
357 $param .=
"&search_filter=".urlencode((
string) $filter);
360 $param .=
"&search_filtert=".urlencode((
string) $filtert);
363 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
366 $param .=
"&search_socid=".urlencode((
string) ($socid));
369 $param .=
"&search_showbirthday=1";
372 $param .=
"&search_projectid=".urlencode((
string) ($pid));
375 $param .=
"&search_type=".urlencode($type);
377if ($mode !=
'show_peruser') {
378 $param .=
'&mode='.urlencode((
string) $mode);
381 $param .=
'&begin_h='.((int) $begin_h);
384 $param .=
'&end_h='.((int) $end_h);
387 $param .=
'&begin_d='.((int) $begin_d);
390 $param .=
'&end_d='.((int) $end_d);
392if ($search_categ_cus != 0) {
393 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
396 $param .=
'&check_holiday=1';
398$param .=
"&maxprint=".urlencode((
string) ($maxprint));
400$paramnoactionodate = $param;
405$prev_year = $prev[
'prev_year'];
406$prev_month = $prev[
'prev_month'];
407$prev_day = $prev[
'prev_day'];
408$first_day = $prev[
'first_day'];
409$first_month = $prev[
'first_month'];
410$first_year = $prev[
'first_year'];
412$week = $prev[
'week'];
416$next_year = $next[
'year'];
417$next_month = $next[
'month'];
418$next_day = $next[
'day'];
422$firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
423$nb_weeks_to_show = (
getDolGlobalString(
'AGENDA_NB_WEEKS_IN_VIEW_PER_USER')) ? ((
int)
$conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7;
429$max_day_in_month = idate(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
432$picto =
'calendarweek';
435$nav =
'<div class="navselectiondate inline-block nowraponall">';
436$nav .=
"<a href=\"?year=".$prev_year.
"&month=".$prev_month.
"&day=".$prev_day.$param.
"\"><i class=\"fa fa-chevron-left\" title=\"".
dol_escape_htmltag($langs->trans(
"Previous")).
"\"></i></a> \n";
437$nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
439$nav .=
" <a href=\"?year=".$next_year.
"&month=".$next_month.
"&day=".$next_day.$param.
"\"><i class=\"fa fa-chevron-right\" title=\"".
dol_escape_htmltag($langs->trans(
"Next")).
"\"></i></a>\n";
440if (empty(
$conf->dol_optimize_smallscreen)) {
441 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans(
"Today").
'</a> ';
444$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
446$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
449$paramnodate = $param;
450$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
454$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
455$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
459print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">'.
"\n";
460if ($optioncss !=
'') {
461 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
463print
'<input type="hidden" name="token" value="'.newToken().
'">';
464print
'<input type="hidden" name="mode" value="'.$mode.
'">';
467$mode =
'show_peruser';
468$massactionbutton =
'';
471$viewmode =
'<div class="navmode inline-block">';
473$viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
475$viewmode .= img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
477$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
481$viewmode .= img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
483$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
487$viewmode .= img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
489$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
493$viewmode .= img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
495$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
499$viewmode .= img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
501$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
504$parameters = array();
506$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
507if (empty($reshook)) {
508 $viewmode .= $hookmanager->resPrint;
509} elseif ($reshook > 1) {
510 $viewmode = $hookmanager->resPrint;
513$viewmode .=
'</div>';
515$viewmode .=
'<span class="marginrightonly"></span>';
520if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
523 $newparam .=
'&month='.urlencode(str_pad((
string) $month, 2,
"0", STR_PAD_LEFT)).
'&year='.((int) $tmpforcreatebutton[
'year']);
524 if ($begin_h !==
'') {
525 $newparam .=
'&begin_h='.((int) $begin_h);
528 $newparam .=
'&end_h='.((int) $end_h);
530 if ($begin_d !==
'') {
531 $newparam .=
'&begin_d='.((int) $begin_d);
534 $newparam .=
'&end_d='.((int) $end_d);
537 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
538 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
539 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$newparam);
541 $newcardbutton .=
dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
550$showextcals = $listofextcals;
551$bookcalcalendars = array();
555 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
556 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
557 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
558 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
559 $sql .=
" WHERE bc.status = 1";
560 $sql .=
" AND ba.status = 1";
561 $sql .=
" AND bc.entity IN (".getEntity(
'agenda').
")";
562 if (!empty($filtert) && $filtert !=
'-1' && $filtert !=
'-2') {
563 $sql .=
" AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).
")";
565 $resql = $db->query($sql);
567 $num = $db->num_rows($resql);
570 $objp = $db->fetch_object($resql);
571 $label = !empty($objp->label) ? $objp->label : $objp->ref;
572 $bookcalcalendars[
"calendars"][$objp->id_cal] = array(
"id" => $objp->id_cal,
"label" => $label);
573 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
577 dol_print_error($db);
581if (!empty(
$conf->use_javascript_ajax)) {
582 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
584 $s .=
'<script type="text/javascript">'.
"\n";
585 $s .=
'jQuery(document).ready(function () {'.
"\n";
586 $s .=
'jQuery(".check_birthday").click(function() { console.log("Click on .check_birthday so we toggle class .peruser_birthday"); jQuery(".peruser_birthday").addClass("peruser_birthday_imp"); });'.
"\n";
588 $s .=
'jQuery(".check_holiday").click(function() {';
589 $s .=
' console.log("Click on .check_holiday so we toggle class .peruser_holiday");';
590 $s .=
' if (jQuery(".peruser_holiday").hasClass("peruser_holiday_imp")) {';
591 $s .=
' jQuery(".peruser_holiday").removeClass("peruser_holiday_imp");';
593 $s .=
' jQuery(".peruser_holiday").addClass("peruser_holiday_imp");';
596 $s .=
' var checkHoliday = jQuery(this).is(":checked") ? 1 : 0;';
597 $s .=
' jQuery(".navselectiondate a, .navmode a").each(function(index, elem) { ';
598 $s .=
' var navLinkElem = jQuery(elem);';
599 $s .=
' var navLinkHref = navLinkElem.attr("href");';
600 $s .=
' var navLinkParts = navLinkHref.split("?");';
601 $s .=
' var navLinkPath = navLinkParts[0];';
602 $s .=
' var navLinkParams = new URLSearchParams(navLinkParts[1] || "");';
603 $s .=
' navLinkParams.set("check_holiday", checkHoliday);';
604 $s .=
' navLinkElem.attr("href", navLinkPath + "?" + navLinkParams.toString());';
608 if (
isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
609 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
610 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
614 $s .=
'</script>'.
"\n";
617 $s .=
'<div class="nowrap inline-block minheight30 hideonsmartphone"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" class="check_mytasks" checked disabled><label class="labelcalendar"><span class="check_local_text small"> '.$langs->trans(
"LocalAgenda").
' </span></label></div>';
620 if ($user->hasRight(
"holiday",
"read")) {
622 <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday small" value="1" class="marginleftonly check_holiday"' . ($check_holiday ?
' checked' :
'') .
'>
623 <label for="check_holiday" class="labelcalendar">
624 <span class="check_holiday_text small">' . $langs->trans(
"Holidays") .
'</span>
630 if (is_array($showextcals) && count($showextcals) > 0) {
631 $s .=
'<script type="text/javascript">'.
"\n";
632 $s .=
'jQuery(document).ready(function () {
633 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
634 var name = jQuery(elem).attr("name");
635 if (jQuery(elem).is(":checked")) {
636 jQuery(".family_ext" + name.replace("check_ext", "")).show();
638 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
642 jQuery("div input[name^=\"check_ext\"]").click(function() {
643 var name = $(this).attr("name");
644 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
647 $s .=
'</script>'.
"\n";
649 foreach ($showextcals as $val) {
650 $htmlname = md5($val[
'name']);
652 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
653 $default =
"checked";
658 $cachedelayshown = (!empty($val[
'cachedelay']) && $val[
'cachedelay'] > 0 ? (int) $val[
'cachedelay'] : $DELAYFORCACHE);
659 $tooltip = $langs->trans(
"Cache").
' '.($cachedelayshown < 120 ? $cachedelayshown.
's' : round($cachedelayshown / 60).
'mn');
661 $s .=
'<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.
'" class="marginleftonly check_ext_'.$htmlname.
'" name="check_ext'.$htmlname.
'" value="1" '.$default.
'><label for="check_ext'.$htmlname.
'" title="'.
dol_escape_htmltag($tooltip).
'" class="labelcalendar"><span class="check_ext_text small">'.
dol_escape_htmltag($val[
'name']).
'</small></label> </div>';
685 $parameters = array();
686 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
687 if (empty($reshook)) {
688 $s .= $hookmanager->resPrint;
689 } elseif ($reshook > 1) {
690 $s = $hookmanager->resPrint;
693 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
696 $newparam = preg_replace(
'/showbirthday=[0-1]/i',
'showbirthday='.($showbirthday ?
'1' :
'0'), $newparam);
697 if (!preg_match(
'/showbirthday=/i', $newparam)) {
698 $newparam .=
'&showbirthday=1';
703 $link .= $langs->trans(
"AgendaShowBirthdayEvents");
705 $link .= $langs->trans(
"AgendaHideBirthdayEvents");
712$eventarray = array();
720$sql .=
" a.id, a.label,";
723$sql .=
" a.percent,";
724$sql .=
" a.fk_user_author, a.fk_user_action,";
725$sql .=
" a.transparency, a.priority, a.fulldayevent, a.location,";
726$sql .=
" a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,";
727$sql .=
" a.fk_element, a.elementtype,";
728$sql .=
" ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto";
731$parameters = array();
732$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
733$sql .= $hookmanager->resPrint;
737$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm as ca, ".MAIN_DB_PREFIX.
"actioncomm as a";
739if ($resourceid > 0) {
740 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
744if (($filtert !=
'-1' && $filtert !=
'-2') || $usergroup > 0) {
746 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
747 $sql .=
" ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
748 if ($filtert !=
'' && $filtert !=
'-1' && $filtert !=
'-2' && $filtert !=
'-3') {
749 $sql .=
" AND ar.fk_element IN (".$db->sanitize($filtert).
")";
750 } elseif ($filtert ==
'-3') {
751 $sql .=
" AND ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
753 if ($usergroup > 0) {
754 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
759$parameters = array();
760$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
761$sql .= $hookmanager->resPrint;
763$sql .=
" WHERE a.fk_action = ca.id";
764$sql .=
" AND a.entity IN (".getEntity(
'agenda').
")";
767if (!empty($actioncode)) {
769 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ==
'AC_NON_AUTO') {
770 $sql .=
" AND ca.type != 'systemauto'";
771 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ==
'AC_ALL_AUTO') {
772 $sql .=
" AND ca.type = 'systemauto'";
774 if ((is_array($actioncode) && in_array(
'AC_OTH', $actioncode)) || $actioncode ==
'AC_OTH') {
775 $sql .=
" AND ca.type != 'systemauto'";
777 if ((is_array($actioncode) && in_array(
'AC_OTH_AUTO', $actioncode)) || $actioncode ==
'AC_OTH_AUTO') {
778 $sql .=
" AND ca.type = 'systemauto'";
782 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ===
'AC_NON_AUTO') {
783 $sql .=
" AND ca.type != 'systemauto'";
784 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ===
'AC_ALL_AUTO') {
785 $sql .=
" AND ca.type = 'systemauto'";
786 } elseif ((is_array($actioncode) && !in_array(
'-1', $actioncode) && !in_array(
'-3', $actioncode)) || ($actioncode !==
'-1' && $actioncode !==
'-3')) {
787 if (is_array($actioncode)) {
788 foreach ($actioncode as $key => $val) {
789 if ($val ==
'-1' || $val ==
'-2') {
790 unset($actioncode[$key]);
793 if (!empty($actioncode)) {
794 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
797 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
802if ($resourceid > 0) {
803 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
806 $sql .=
" AND a.fk_project = ".((int) $pid);
810if (
isModEnabled(
"societe") && !$user->hasRight(
'societe',
'client',
'voir')) {
811 $search_sale = $user->id;
814if ($search_sale && $search_sale !=
'-1') {
815 if ($search_sale == -2) {
816 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
817 } elseif ($search_sale > 0) {
818 $sql .=
" AND (a.fk_soc IS NULL OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc AND sc.fk_user = ".((int) $search_sale).
"))";
823 $sql .=
" AND a.fk_soc = ".((int) $socid);
826if ($mode ==
'show_day') {
828 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
829 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
831 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
832 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
834 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
835 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
840 $sql .=
" (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
841 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
843 $sql .=
" (a.datep2 BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
844 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
846 $sql .=
" (a.datep < '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
847 $sql .=
" AND a.datep2 > '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
851 $sql .=
" AND ca.id = ".((int) $type);
855 $sql .=
" AND a.percent = 0";
857if ($status ===
'na') {
859 $sql .=
" AND a.percent = -1";
861if ($status ==
'50') {
863 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
865if ($status ==
'done' || $status ==
'100') {
866 $sql .=
" AND (a.percent = 100)";
868if ($status ==
'todo') {
869 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
872if (($filtert > 0 || $filtert == -3) || $usergroup > 0) {
876 $sql .=
"ar.fk_element = ".((int) $filtert);
877 } elseif ($filtert == -3) {
878 $sql .=
"ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
880 if ($usergroup > 0) {
881 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
887if ($search_categ_cus != -1) {
888 if ($search_categ_cus == -2) {
889 $sql .=
" AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
890 } elseif ($search_categ_cus > 0) {
891 $sql .=
" AND EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id AND ca.fk_categorie IN (".$db->sanitize((
string) $search_categ_cus).
"))";
895$sql .= $db->order(
"fk_user_action, datep");
898dol_syslog(
"comm/action/peruser.php", LOG_DEBUG);
899$resql = $db->query($sql);
901 $num = $db->num_rows($resql);
905 while ($i < $num && $i < $MAXONSAMEPAGE) {
906 $obj = $db->fetch_object($resql);
910 if (
getDolGlobalString(
'AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code ==
'AC_OTH_AUTO') {
915 $datep = $db->jdate($obj->datep);
916 $datep2 = $db->jdate($obj->datep2);
922 $event->id = $obj->id;
923 $event->ref = (string) $event->id;
925 $event->fulldayevent = $obj->fulldayevent;
928 if ($event->fulldayevent) {
930 $event->datep = $db->jdate($obj->datep, $tzforfullday ?
'tzuser' :
'tzserver');
931 $event->datef = $db->jdate($obj->datep2, $tzforfullday ?
'tzuser' :
'tzserver');
934 $event->datep = $db->jdate($obj->datep,
'tzserver');
935 $event->datef = $db->jdate($obj->datep2,
'tzserver');
941 $event->type_code = $obj->type_code;
942 $event->type_label = $obj->type_label;
943 $event->type_color = $obj->type_color;
944 $event->type = $obj->type_type;
945 $event->type_picto = $obj->type_picto;
947 $event->label = $obj->label;
948 $event->percentage = $obj->percent;
949 $event->authorid = $obj->fk_user_author;
950 $event->userownerid = $obj->fk_user_action;
951 $event->fetch_userassigned();
953 $event->priority = $obj->priority;
954 $event->location = $obj->location;
955 $event->transparency = $obj->transparency;
956 $event->fk_element = $obj->fk_element;
957 $event->elementid = $obj->fk_element;
958 $event->elementtype = $obj->elementtype;
960 $event->fk_project = $obj->fk_project;
962 $event->socid = $obj->fk_soc;
963 $event->contact_id = $obj->fk_contact;
964 $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar;
965 if (!empty($event->fk_bookcal_calendar)) {
966 $event->type =
"bookcal_calendar";
971 $event->date_start_in_calendar = $event->datep;
972 if ($event->datef !=
'' && $event->datef >= $event->datep) {
973 $event->date_end_in_calendar = $event->datef;
975 $event->date_end_in_calendar = $event->datep;
981 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
985 if ($event->date_start_in_calendar < $firstdaytoshow) {
986 $event->date_start_in_calendar = $firstdaytoshow;
988 if ($event->date_end_in_calendar >= $lastdaytoshow) {
989 $event->date_end_in_calendar = ($lastdaytoshow - 1);
993 $daycursor = $event->date_start_in_calendar;
998 $daycursorend = $event->date_end_in_calendar;
999 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
1000 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
1001 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1006 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1007 $daykeyend =
dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend,
'gmt');
1021 $eventarray[$daykey][] = $event;
1024 $daykey += 60 * 60 * 24;
1026 if ($daykey > $daykeyend) {
1035 $parameters[
'obj'] = $obj;
1036 $reshook = $hookmanager->executeHooks(
'hookEventElements', $parameters, $event, $action);
1037 $event = $hookmanager->resPrint;
1039 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1046 dol_print_error($db);
1054 agenda_get_birthday_events($db, $langs, $user, $mode, $month, $day, $year, $eventarray, $nbevents, $firstdaytoshow, $lastdaytoshow);
1058if ($user->hasRight(
"holiday",
"read")) {
1059 $sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
1060 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
1061 $sql .=
" WHERE u.rowid = x.fk_user";
1062 $sql .=
" AND u.statut = '1'";
1063 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
1065 $sql .=
" AND x.date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1066 $sql .=
" AND x.date_fin >= '".$db->idate(
dol_get_first_day($year, $month)).
"'";
1067 if (!$user->hasRight(
'holiday',
'readall')) {
1068 $sql .=
" AND x.fk_user IN(".$db->sanitize(implode(
", ", $user->getAllChildIds(1))).
") ";
1071 $resql = $db->query($sql);
1073 $num = $db->num_rows($resql);
1077 $obj = $db->fetch_object($resql);
1082 $event->id = $obj->rowid;
1083 $event->ref = (string) $event->id;
1085 $event->type_code =
'HOLIDAY';
1086 $event->type_label =
'';
1087 $event->type_color =
'';
1088 $event->type =
'holiday';
1089 $event->type_picto =
'holiday';
1093 $event->datep = (int) $db->jdate($obj->date_start,
'gmt') + ((empty($obj->halfday) || $obj->halfday == 1) ? 0 : 12) * 60 * 60;
1094 $event->datef = (int) $db->jdate($obj->date_end,
'gmt') + ((empty($obj->halfday) || $obj->halfday == -1) ? 24 : 12) * 60 * 60 - 1;
1095 $event->date_start_in_calendar = $event->datep;
1096 $event->date_end_in_calendar = $event->datef;
1098 $event->transparency = 1;
1100 $event->userownerid = $obj->uid;
1101 $event->userassigned = array($obj->uid => array(
'id' => $obj->uid,
'transparency' => 1));
1103 if ($obj->status == 3) {
1105 $event->percentage = -1;
1106 } elseif ($obj->status == 2) {
1108 $event->percentage = 0;
1112 $daycursor = $event->date_start_in_calendar;
1117 $daycursorend = $event->date_end_in_calendar;
1123 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1124 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1129 $firstdayofholiday = ($ifornbofdays == 1);
1130 $lastdayofholiday = ($daykeygmt ==
dol_get_first_hour($event->date_end_in_calendar,
'gmt'));
1134 if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) {
1137 if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) {
1138 $newevent->label .=
' ('.$langs->trans(
"Morning").
')';
1139 } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) {
1140 $newevent->label .=
' ('.$langs->trans(
"Afternoon").
')';
1142 $eventarray[$daykey][] = $newevent;
1144 $eventarray[$daykey][] = $event;
1147 $daykey += 60 * 60 * 24;
1148 $daykeygmt += 60 * 60 * 24;
1149 }
while ($daykey <= $event->date_end_in_calendar);
1158if (count($listofextcals)) {
1159 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
1161 foreach ($listofextcals as $key => $extcal) {
1162 $url = $extcal[
'src'];
1163 $namecal = $extcal[
'name'];
1164 $offsettz = $extcal[
'offsettz'];
1165 $colorcal = $extcal[
'color'];
1166 $buggedfile = $extcal[
'buggedfile'];
1168 if ($extcal[
'type'] ==
'globalsetup') {
1179 $ical->parse($url, $pathforcachefile, (!empty($extcal[
'cachedelay']) && $extcal[
'cachedelay'] > 0 ? (
int) $extcal[
'cachedelay'] : $DELAYFORCACHE));
1182 $listofextcals[$key][
'error'] = $ical->error;
1183 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
1188 $icalevents = array();
1189 if (is_array($ical->get_event_list())) {
1190 $icalevents = array_merge($icalevents, $ical->get_event_list());
1192 if (is_array($ical->get_freebusy_list())) {
1193 $icalevents = array_merge($icalevents, $ical->get_freebusy_list());
1196 $icalevents = array_merge($icalevents, $ical->getTodoAndJournalAsEvents());
1199 if (count($icalevents) > 0) {
1201 $moreicalevents = array();
1202 foreach ($icalevents as $icalkey => $icalevent) {
1203 if (!$ical->hasStartDate($icalevent)) {
1204 dol_syslog(
"Skip external calendar component without a valid DTSTART", LOG_WARNING);
1208 $hasrrule = (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE']));
1211 if ($hasrrule || !empty($icalevent[
'RDATE'])) {
1214 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1216 $datecurend = (empty($icalevent[
'DTEND;VALUE=DATE']) ? $datecurstart + 86400 :
dol_stringtotime($icalevent[
'DTEND;VALUE=DATE'], 1)) - 1;
1217 } elseif (isset($icalevent[
'DTSTART']) && !is_array($icalevent[
'DTSTART'])) {
1218 $datecurstart = $icalevent[
'DTSTART'];
1219 $datecurend = empty($icalevent[
'DTEND']) ? $datecurstart : $icalevent[
'DTEND'];
1220 } elseif (is_array($icalevent[
'DTSTART']) && isset($icalevent[
'DTSTART'][
'unixtime']) && $icalevent[
'DTSTART'][
'unixtime'] !==
'') {
1221 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
1222 $datecurend = empty($icalevent[
'DTEND'][
'unixtime']) ? $datecurstart : $icalevent[
'DTEND'][
'unixtime'];
1223 $tzidname = (string) ($icalevent[
'DTSTART'][
'TZID'] ??
'');
1224 $tzidwall = (empty($buggedfile) && $ical->isTzidKnown($tzidname));
1225 if (!$tzidwall && !empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) ) {
1227 $tmpcurstart = $datecurstart;
1228 $tmpcurend = $datecurend;
1229 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
1230 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
1233 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1234 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1236 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1238 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1239 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1241 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1248 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
1254 $exdates = (isset($icalevent[
'EXDATE']) && is_array($icalevent[
'EXDATE'])) ? $icalevent[
'EXDATE'] : [];
1255 $exdateshift = (isset($icalevent[
'DTSTART']) && is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) ? ((
int) $icalevent[
'DTSTART'][
'unixtime'] - (int) $datecurstart) : 0;
1256 $firstdatecurstart = $datecurstart;
1257 $occurrenceduration = $datecurend - $datecurstart;
1265 $unsupportedrule = !$ical->isRRuleSupported($icalevent[
'RRULE']);
1266 if ($unsupportedrule) {
1267 dol_syslog(
"Found a repeatable record with a rule not managed by dolibarr code (".json_encode($icalevent[
'RRULE']).
"). Only first occurrence is shown.", LOG_WARNING);
1268 unset($icalevents[$icalkey][
'RRULE']);
1274 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
1275 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
1276 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
1277 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
1280 if ($datecurstart >= $lastdaytoshow + ($tzidwall ? 86400 : 0)) {
1285 if ($hasrrule && ($tzidwall || in_array($icalevent[
'RRULE'][
'FREQ'] ??
'', [
'MINUTELY',
'HOURLY']) || count(array_filter(array_keys($icalevent[
'RRULE']),
function (
string $rulekey): bool {
1286 return strpos($rulekey,
'BY') === 0;
1289 foreach ($ical->expandRRule($icalevent[
'RRULE'], (
int) $datecurstart + $exdateshift, (int) $lastdaytoshow + $exdateshift, ($until ? (
int) $until + $exdateshift : 0), (
int) $firstdaytoshow + $exdateshift - $occurrenceduration - 86400) as $occurrencewall) {
1292 $occurrencestart = (int) $ical->tzidToTimestamp($occurrencewall, $tzidname);
1293 $occurrenceend = (int) $ical->tzidToTimestamp($occurrencewall + $occurrenceduration, $tzidname);
1295 $occurrencestart = $occurrencewall - $exdateshift;
1296 $occurrenceend = $occurrencestart + $occurrenceduration;
1298 if ($occurrenceend < $firstdaytoshow || in_array(gmdate(
'Ymd', $occurrencewall), $exdates)) {
1301 $newevent = $icalevent;
1302 unset($newevent[
'RRULE']);
1303 if (!empty($icalevent[
'DTSTART;VALUE=DATE'])) {
1304 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($occurrencestart,
'%Y%m%d');
1305 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($occurrenceend + 1,
'%Y%m%d');
1307 $newevent[
'DTSTART'] = $occurrencestart;
1308 $newevent[
'DTEND'] = $occurrenceend;
1310 $moreicalevents[] = $newevent;
1312 } elseif ($hasrrule) {
1314 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat)) && (empty($until) || $datecurstart <= $until)) {
1315 if ($datecurend >= $firstdaytoshow && !in_array(gmdate(
'Ymd', (
int) $datecurstart + $exdateshift), $exdates)) {
1316 $newevent = $icalevent;
1317 unset($newevent[
'RRULE']);
1318 if (!empty($icalevent[
'DTSTART;VALUE=DATE'])) {
1319 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
1320 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
1322 $newevent[
'DTSTART'] = $datecurstart;
1323 $newevent[
'DTEND'] = $datecurend;
1325 $moreicalevents[] = $newevent;
1329 $savdatecurstart = $datecurstart;
1330 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1334 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1337 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1340 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1345 if ($savdatecurstart >= $datecurstart) {
1346 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1347 $datecurstart += 3600 * 24 * 7;
1348 $datecurend += 3600 * 24 * 7;
1354 if (!empty($icalevent[
'RDATE']) && is_array($icalevent[
'RDATE'])) {
1356 foreach ($icalevent[
'RDATE'] as $rdate) {
1357 if (!empty($icalevent[
'DTSTART;VALUE=DATE'])) {
1360 $rdatewall = $ical->ical_date_to_unix($rdate);
1361 $rdatestart = ($tzidwall ? (int) $ical->tzidToTimestamp($rdatewall, $tzidname) : $rdatewall - $exdateshift);
1363 $rdateend = $rdatestart + $occurrenceduration;
1364 if (($tzidwall ? $rdatewall : $rdatestart) == $firstdatecurstart || $rdateend < $firstdaytoshow || $rdatestart >= $lastdaytoshow || in_array(gmdate(
'Ymd', ($tzidwall ? $rdatewall : $rdatestart + $exdateshift)), $exdates)) {
1367 $newevent = $icalevent;
1368 unset($newevent[
'RRULE'], $newevent[
'RDATE']);
1369 if (!empty($icalevent[
'DTSTART;VALUE=DATE'])) {
1370 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($rdatestart,
'%Y%m%d');
1371 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($rdateend + 1,
'%Y%m%d');
1373 $newevent[
'DTSTART'] = $rdatestart;
1374 $newevent[
'DTEND'] = $rdateend;
1376 $moreicalevents[] = $newevent;
1381 $icalevents = array_merge($icalevents, $moreicalevents);
1384 foreach ($icalevents as $icalevent) {
1389 if (!empty($icalevent[
'RRULE'])) {
1398 if (!$ical->hasStartDate($icalevent)) {
1402 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1405 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1406 $dateend = $datestart + 86400 - 1;
1412 $event->fulldayevent = 1;
1414 } elseif (!is_array($icalevent[
'DTSTART'])) {
1415 $datestart = $icalevent[
'DTSTART'];
1416 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1418 $datestart += +($offsettz * 3600);
1419 $dateend += +($offsettz * 3600);
1424 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1425 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1426 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1429 $tzidconverted =
false;
1430 if (empty($buggedfile)) {
1431 $tzidstart = $ical->tzidToTimestamp((
int) $datestart, (
string) ($icalevent[
'DTSTART'][
'TZID'] ??
''));
1432 if ($tzidstart !==
null) {
1433 $tzidend = $ical->tzidToTimestamp((
int) $dateend, (
string) ($icalevent[
'DTEND'][
'TZID'] ?? ($icalevent[
'DTSTART'][
'TZID'] ??
'')));
1434 $datestart = $tzidstart;
1435 $dateend = ($tzidend !==
null ? $tzidend : $tzidstart + ((int) $dateend - (
int) $icalevent[
'DTSTART'][
'unixtime']));
1436 $tzidconverted =
true;
1440 $datestart += +($offsettz * 3600);
1441 $dateend += +($offsettz * 3600);
1444 if (!$tzidconverted && $buggedfile ===
'uselocalandtznodaylight') {
1448 if (!$tzidconverted && $buggedfile ===
'uselocalandtzdaylight') {
1449 $localtzs =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1450 $localtze =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1451 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1452 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1453 $tmps = -1 * $localtzs->getOffset($localdts);
1454 $tmpe = -1 * $localtze->getOffset($localdte);
1455 $datestart += $tmps;
1462 if ($addevent && $datestart !==
null && $dateend !==
null) {
1463 $event->id = $icalevent[
'UID'];
1464 $event->ref = (string) $event->id;
1465 $userstatic =
new User($db);
1466 $userId = $userstatic->findUserIdByEmail($namecal);
1467 if (!empty($userId) && $userId > 0) {
1468 $event->userassigned[$userId] = [
1470 'transparency' => 1,
1472 $event->percentage = -1;
1475 $event->type_code =
"ICALEVENT";
1476 $event->type_label = $namecal;
1477 $event->type_color = $colorcal;
1478 $event->type =
'icalevent';
1479 $event->type_picto =
'rss';
1481 $event->icalname = $namecal;
1482 $event->icalcolor = $colorcal;
1484 $event->datep = (int) ($datestart + $usertime);
1485 $event->datef = (int) ($dateend + $usertime);
1488 $isprivate = (isset($icalevent[
'CLASS']) && is_string($icalevent[
'CLASS']) && in_array(strtoupper(trim($icalevent[
'CLASS'])), [
'PRIVATE',
'CONFIDENTIAL']) && !
getDolGlobalString(
'AGENDA_EXT_SHOW_PRIVATE'));
1491 $event->label = $langs->trans(
"Private");
1492 } elseif (isset($icalevent[
'SUMMARY']) && $icalevent[
'SUMMARY']) {
1494 } elseif (isset($icalevent[
'DESCRIPTION']) && $icalevent[
'DESCRIPTION']) {
1497 $event->label = $langs->trans(
"ExtSiteNoLabel");
1504 if (!empty($icalevent[
'PRIORITY'])) {
1505 $event->priority = $icalevent[
'PRIORITY'];
1509 if (!empty($icalevent[
'TRANSP'])) {
1510 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1511 $event->transparency = 0;
1513 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1514 $event->transparency = 1;
1525 if (!empty($icalevent[
'LOCATION']) && !$isprivate) {
1526 $event->location = $icalevent[
'LOCATION'];
1530 $event->icaldetails = array();
1532 foreach (array(
'DESCRIPTION' =>
'description',
'ORGANIZER' =>
'organizer',
'URL' =>
'url',
'CATEGORIES' =>
'categories',
'GEO' =>
'geo') as $icalproperty => $detailkey) {
1533 if (!empty($icalevent[$icalproperty]) && is_string($icalevent[$icalproperty])) {
1534 $event->icaldetails[$detailkey] = $icalevent[$icalproperty];
1537 if (!empty($icalevent[
'ATTENDEE']) && is_array($icalevent[
'ATTENDEE'])) {
1538 $event->icaldetails[
'attendees'] = $icalevent[
'ATTENDEE'];
1542 $event->date_start_in_calendar = $event->datep;
1544 if ((
int) $event->datef != 0 && $event->datef >= $event->datep) {
1545 $event->date_end_in_calendar = $event->datef;
1547 $event->date_end_in_calendar = $event->datep;
1551 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1557 if ($event->date_start_in_calendar < $firstdaytoshow) {
1558 $event->date_start_in_calendar = $firstdaytoshow;
1560 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1561 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1565 $daycursor = $event->date_start_in_calendar;
1574 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1575 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1578 $eventarray[$daykey][] = $event;
1579 $daykey += 60 * 60 * 24;
1580 $daykeygmt += 60 * 60 * 24;
1581 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1593$parameters = array();
1595$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1596if (!empty($hookmanager->resArray[
'eventarray'])) {
1597 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1598 if (!isset($eventarray[$keyDate])) {
1599 $eventarray[$keyDate] = array();
1601 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1613$cachethirdparties = array();
1614$cachecontacts = array();
1618 array(137, 86, 161),
1619 array(60, 147, 183),
1620 array(250, 190, 80),
1622 array(190, 190, 100),
1623 array(91, 115, 247),
1624 array(140, 140, 220),
1625 array(190, 120, 120),
1626 array(115, 125, 150),
1627 array(100, 170, 20),
1628 array(150, 135, 125),
1629 array(85, 135, 150),
1630 array(150, 135, 80),
1635if ($color_file && is_readable($color_file)) {
1636 include $color_file;
1640$massactionbutton =
'';
1644print_barre_liste($langs->trans(
"Agenda"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1,
'object_action', 0, $nav.
'<span class="marginleftonly"></span>'.$newcardbutton,
'', $limit, 1, 0, 1, $viewmode);
1652print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1653print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday,
'', (
string) $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid, $search_categ_cus);
1658$newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1659$newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1660$newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1661$newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1662$newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1663$newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1664$newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1665$newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1666$newparam .=
'&viewweek=1';
1668echo
'<input type="hidden" name="actionmove" value="mupdate">';
1669echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1670echo
'<input type="hidden" name="newdate" id="newdate">';
1677$currentdaytoshow = $firstdaytoshow;
1678echo
'<div class="div-table-responsive">';
1681$colorsbytype = array();
1683while ($currentdaytoshow < $lastdaytoshow) {
1684 echo
'<table class="centpercent noborder nocellnopadd cal_month cal_peruser listwithfilterbefore">';
1686 echo
'<tr class="liste_titre">';
1687 echo
'<td class="nopaddingtopimp nopaddingbottomimp nowraponsmartphone">';
1691 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleDaysRange").
'">';
1692 print img_picto(
'',
'clock',
'class="fawidth30 inline-block marginleftonly"');
1693 print $langs->trans(
"DaysOfWeek").
'</span>';
1695 print
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
1696 print
'<input type="number" class="shortbis" name="begin_d" value="'.$begin_d.
'" min="1" max="7">';
1697 if (empty(
$conf->dol_use_jmobile)) {
1700 print
'</div><div class="ui-block-b">';
1702 print
'<input type="number" class="shortbis" name="end_d" value="'.$end_d.
'" min="1" max="7">';
1703 print
'</div></div>';
1709 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1713 echo
'<td align="center" colspan="'.($end_h - $begin_h).
'">';
1714 echo
'<span class="bold spandayofweek">'.$langs->trans(
"Day".(($i +
getDolGlobalInt(
'MAIN_START_WEEK', 1)) % 7)).
'</span>';
1719 $valtoshow = $currentdaytoshow;
1722 echo
'<span class="badgeliketopmenu">';
1724 print
dol_print_date($valtoshow,
'dayreduceformat',
'tzuserrel');
1733 echo
'<tr class="liste_titre">';
1737 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleTimeRange").
'">';
1738 print img_picto(
'',
'clock',
'class="fawidth30 inline-block marginleftonly"');
1739 print $langs->trans(
"Hours").
'</span>';
1741 print
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
1742 print
'<input type="number" class="shortbis" name="begin_h" value="'.$begin_h.
'" min="0" max="23">';
1743 if (empty(
$conf->dol_use_jmobile)) {
1746 print
'</div><div class="ui-block-b">';
1748 print
'<input type="number" class="shortbis" name="end_h" value="'.$end_h.
'" min="1" max="24">';
1749 if (empty(
$conf->dol_use_jmobile)) {
1750 print
' '.$langs->trans(
"HourShort");
1752 print
'</div></div>';
1757 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1761 for ($h = $begin_h; $h < $end_h; $h++) {
1762 echo
'<td class="center">';
1763 print
'<small style="font-family: courier">'.sprintf(
"%02d", $h).
'</small>';
1773 $usernames = array();
1774 $usernamesid = array();
1777 foreach ($eventarray as $daykey => $notused) {
1779 foreach ($eventarray[$daykey] as $index => $event) {
1780 $event->fetch_userassigned();
1781 $listofuserid = $event->userassigned;
1782 foreach ($listofuserid as $userid => $tmp) {
1783 if (!in_array($userid, $usernamesid)) {
1784 $usernamesid[$userid] = $userid;
1791 $sql =
"SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
1792 $sql .=
" FROM ".$db->prefix().
"user as u";
1794 $sql .=
" WHERE u.rowid IN (";
1795 $sql .=
" SELECT ug.fk_user FROM ".$db->prefix().
"usergroup_user as ug";
1796 $sql .=
" WHERE ug.entity IN (".getEntity(
'usergroup').
")";
1797 if ($usergroup > 0) {
1798 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1802 if ($usergroup > 0) {
1803 $sql .=
" LEFT JOIN ".$db->prefix().
"usergroup_user as ug ON u.rowid = ug.fk_user";
1805 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
1806 if ($usergroup > 0) {
1807 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1810 $sql .=
" AND u.statut = 1";
1812 $sql .=
" AND u.rowid = ".((int) $filtert);
1814 if ($usergroup > 0) {
1815 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1817 if ($user->socid > 0) {
1819 $sql .=
" AND u.fk_soc = ".((int) $user->socid);
1822 if (!$canedit || $filtert ==
'-3') {
1823 if (!$user->hasRight(
'user',
'user',
'lire') || $filtert ==
'-3') {
1824 $usersInHierarchy = $user->getAllChildIds(1);
1825 $sql .=
" AND u.rowid IN (".$db->sanitize(implode(
',', $usersInHierarchy)).
")";
1830 $resql = $db->query($sql);
1832 $num = $db->num_rows($resql);
1836 $obj = $db->fetch_object($resql);
1837 $usernamesid[$obj->rowid] = $obj->rowid;
1842 dol_print_error($db);
1846 foreach ($usernamesid as
$id) {
1847 $tmpuser =
new User($db);
1848 $result = $tmpuser->fetch(
$id);
1849 $usernames[] = $tmpuser;
1853 $labelbytype = array();
1854 $sql =
"SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX.
"c_actioncomm ORDER BY position";
1855 $resql = $db->query($sql);
1856 while ($obj = $db->fetch_object($resql)) {
1857 $colorsbytype[$obj->code] = $obj->color;
1858 $labelbytype[$obj->code] = $obj->label;
1866 foreach ($usernames as $username) {
1872 echo
'<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var ?
' cal_impair' :
'').
' nopaddingtopimp nopaddingbottomimp noheightimp">';
1873 print
'<span class="paddingrightimp">';
1874 print $username->getNomUrl(-1,
'', 0, 0, 20, 1,
'',
'paddingleft');
1881 for ($iter_day = 0; $iter_day < 8; $iter_day++) {
1882 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1895 $style =
'cal_current_month';
1896 if ($iter_day == 6) {
1897 $style .=
' cal_other_month';
1900 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1904 $style =
'cal_today_peruser';
1907 show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
1912 $showheader =
false;
1924 $langs->load(
"commercial");
1925 print
'<br>'.$langs->trans(
"Legend").
': <br>';
1926 foreach ($colorsbytype as $code => $color) {
1928 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #'.$color.
'; width:16px; float: left; margin-right: 4px;"> </div>';
1929 print $langs->trans(
"Action".$code) !=
"Action".$code ? $langs->trans(
"Action".$code) : $labelbytype[$code];
1935 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
1936 print $langs->trans(
"Other");
1945print
"\n".
'</form>';
1950print
'<script type="text/javascript">
1951jQuery(document).ready(function() {
1952 jQuery(".onclickopenref").click(function() {
1953 var ref=$(this).attr(\'ref\');
1954 var res = ref.split("_");
1956 var userid = res[1];
1964 console.log("We click on a class onclickopenref in page peruser with ref="+ref+" type="+type);
1966 if (ids == \'none\') /* No event */
1968 /* alert(\'no event\'); */
1969 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?year='.$year.
'&month='.$month.
'&day='.$day.($begin_h !==
'' ?
'&begin_h='.$begin_h :
'').($end_h !==
'' ?
'&end_h='.$end_h :
'').($begin_d !==
'' ?
'&begin_d='.$begin_d :
'').($end_d !==
'' ?
'&end_d='.$end_d :
'')).
'"
1970 window.location.href = url;
1972 else if (ids.indexOf(",") > -1) /* There is several events */
1974 /* alert(\'several events\'); */
1975 url = "'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&search_actioncode="+jQuery("#search_actioncode").val()+"&search_status="+jQuery("#selectsearch_status").val()+"&filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
1976 window.location.href = url;
1977 } else { /* One event */
1978 /* alert(\'one event\'); */
1979 if (type == \'holiday\') {
1980 url = "'.DOL_URL_ROOT.
'/holiday/card.php?id="+ids
1982 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=view&id="+ids
1984 window.location.href = url;
2017function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam =
'', $showinfo = 0, $minheight = 60, $showheader =
false, $colorsbytype = array(), $var =
false)
2020 global $user,
$conf, $langs, $hookmanager, $action;
2021 global $filter, $filtert, $status, $actioncode;
2023 global $cachethirdparties, $cachecontacts,
$cacheusers, $cacheprojects, $colorindexused;
2024 global $begin_h, $end_h;
2038 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases1
2039 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases2
2040 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases3
2041 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases4
2048 $numicals = array();
2051 $colorindexused[$user->id] = 0;
2052 $nextindextouse = count($colorindexused);
2059 foreach ($eventarray as $daykey => $notused) {
2066 if ($day == $jour && (
int) $month == $mois && $year == $annee) {
2070 foreach ($eventarray[$daykey] as $index => $event) {
2074 $keysofuserassigned = array_keys($event->userassigned);
2076 if (!in_array($username->id, $keysofuserassigned)) {
2081 $parameters = array();
2082 $reshook = $hookmanager->executeHooks(
'formatEvent', $parameters, $event, $action);
2084 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
2092 if ($event->type_code ==
'HOLIDAY') {
2093 $cssclass =
'family_holiday';
2096 if (in_array($user->id, $keysofuserassigned)) {
2097 $cssclass =
'family_mytasks';
2099 if (empty($cacheusers[$event->userownerid])) {
2100 $newuser =
new User($db);
2101 $newuser->fetch($event->userownerid);
2107 if (!empty($cacheusers[$event->userownerid]->color)) {
2112 $color = $event->type_color;
2114 } elseif ($event->type_code ==
'ICALEVENT') {
2116 if (!empty($event->icalname)) {
2123 $color = $event->icalcolor;
2124 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other unsortable');
2125 } elseif ($event->type_code ==
'BIRTHDAY') {
2128 $cssclass =
'family_birthday unsortable';
2129 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2132 $color = ($event->icalcolor ? $event->icalcolor : -1);
2133 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other');
2135 if (empty($cacheusers[$event->userownerid])) {
2136 $newuser =
new User($db);
2137 $newuser->fetch($event->userownerid);
2143 if (!empty($cacheusers[$event->userownerid]->color)) {
2148 $color = $event->type_color;
2154 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
2155 if (isset($colorindexused[$idusertouse])) {
2156 $colorindex = $colorindexused[$idusertouse];
2158 $colorindex = $nextindextouse;
2159 $colorindexused[$idusertouse] = $colorindex;
2160 if (!empty($theme_datacolor[$nextindextouse + 1])) {
2165 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2169 for ($h = $begin_h; $h < $end_h; $h++) {
2172 if (empty($event->fulldayevent)) {
2173 $a =
dol_mktime((
int) $h, 0, 0, $month, $day, $year,
'tzuserrel', 0);
2174 $b =
dol_mktime((
int) $h, 15, 0, $month, $day, $year,
'tzuserrel', 0);
2175 $b1 =
dol_mktime((
int) $h, 30, 0, $month, $day, $year,
'tzuserrel', 0);
2176 $b2 =
dol_mktime((
int) $h, 45, 0, $month, $day, $year,
'tzuserrel', 0);
2177 $c =
dol_mktime((
int) $h + 1, 0, 0, $month, $day, $year,
'tzuserrel', 0);
2179 $dateendtouse = $event->date_end_in_calendar;
2180 if ($dateendtouse == $event->date_start_in_calendar) {
2185 if ($event->date_start_in_calendar < $b && $dateendtouse > $a) {
2186 $busy = $event->transparency;
2187 $cases1[$h][$event->id][
'busy'] = $busy;
2188 $cases1[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2189 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2190 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2191 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2192 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2193 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2195 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2198 if ($event->label) {
2199 $cases1[$h][$event->id][
'string'] .=
' - '.$event->label;
2201 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
2202 if ($event->type_code ==
'HOLIDAY') {
2203 $cases1[$h][$event->id][
'css'] =
'peruser_holiday ';
2205 $cases1[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2208 $cases1[$h][$event->id][
'color'] = $color;
2210 if ($event->fk_project > 0) {
2211 if (empty($cacheprojects[$event->fk_project])) {
2213 $tmpproj->fetch($event->fk_project);
2214 $cacheprojects[$event->fk_project] = $tmpproj;
2216 $cases1[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2218 if ($event->socid > 0) {
2219 if (empty($cachethirdparties[$event->socid])) {
2220 $tmpthirdparty =
new Societe($db);
2221 $tmpthirdparty->fetch($event->socid);
2222 $cachethirdparties[$event->socid] = $tmpthirdparty;
2224 $cases1[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2226 if ($event->contact_id > 0) {
2227 if (empty($cachecontacts[$event->contact_id])) {
2228 $tmpcontact =
new Contact($db);
2229 $tmpcontact->fetch($event->contact_id);
2230 $cachecontacts[$event->contact_id] = $tmpcontact;
2232 $cases1[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2236 if ($event->date_start_in_calendar < $b1 && $dateendtouse > $b) {
2237 $busy = $event->transparency;
2238 $cases2[$h][$event->id][
'busy'] = $busy;
2239 $cases2[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2240 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2241 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2242 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2243 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2244 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2246 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2249 if ($event->label) {
2250 $cases2[$h][$event->id][
'string'] .=
' - '.$event->label;
2252 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
2253 if ($event->type_code ==
'HOLIDAY') {
2254 $cases2[$h][$event->id][
'css'] =
'peruser_holiday ';
2256 $cases2[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2259 $cases2[$h][$event->id][
'color'] = $color;
2261 if ($event->fk_project > 0) {
2262 if (empty($cacheprojects[$event->fk_project])) {
2264 $tmpproj->fetch($event->fk_project);
2265 $cacheprojects[$event->fk_project] = $tmpproj;
2267 $cases2[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2269 if ($event->socid > 0) {
2270 if (empty($cachethirdparties[$event->socid])) {
2271 $tmpthirdparty =
new Societe($db);
2272 $tmpthirdparty->fetch($event->socid);
2273 $cachethirdparties[$event->socid] = $tmpthirdparty;
2275 $cases2[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2277 if ($event->contact_id > 0) {
2278 if (empty($cachecontacts[$event->contact_id])) {
2279 $tmpcontact =
new Contact($db);
2280 $tmpcontact->fetch($event->contact_id);
2281 $cachecontacts[$event->contact_id] = $tmpcontact;
2283 $cases2[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2287 if ($event->date_start_in_calendar < $b2 && $dateendtouse > $b1) {
2288 $busy = $event->transparency;
2289 $cases3[$h][$event->id][
'busy'] = $busy;
2290 $cases3[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2291 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2292 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2293 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2294 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2295 $cases3[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2297 $cases3[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2300 if ($event->label) {
2301 $cases3[$h][$event->id][
'string'] .=
' - '.$event->label;
2303 $cases3[$h][$event->id][
'typecode'] = $event->type_code;
2304 if ($event->type_code ==
'HOLIDAY') {
2305 $cases3[$h][$event->id][
'css'] .=
'peruser_holiday ';
2307 $cases3[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2310 $cases3[$h][$event->id][
'color'] = $color;
2312 if ($event->fk_project > 0) {
2313 if (empty($cacheprojects[$event->fk_project])) {
2315 $tmpproj->fetch($event->fk_project);
2316 $cacheprojects[$event->fk_project] = $tmpproj;
2318 $cases3[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2320 if ($event->socid > 0) {
2321 if (empty($cachethirdparties[$event->socid])) {
2322 $tmpthirdparty =
new Societe($db);
2323 $tmpthirdparty->fetch($event->socid);
2324 $cachethirdparties[$event->socid] = $tmpthirdparty;
2326 $cases3[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2328 if ($event->contact_id > 0) {
2329 if (empty($cachecontacts[$event->contact_id])) {
2330 $tmpcontact =
new Contact($db);
2331 $tmpcontact->fetch($event->contact_id);
2332 $cachecontacts[$event->contact_id] = $tmpcontact;
2334 $cases3[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2338 if ($event->date_start_in_calendar <
$c && $dateendtouse > $b2) {
2339 $busy = $event->transparency;
2340 $cases4[$h][$event->id][
'busy'] = $busy;
2341 $cases4[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2342 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2343 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2344 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2345 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2346 $cases4[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2348 $cases4[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2351 if ($event->label) {
2352 $cases4[$h][$event->id][
'string'] .=
' - '.$event->label;
2354 $cases4[$h][$event->id][
'typecode'] = $event->type_code;
2355 if ($event->type_code ==
'HOLIDAY') {
2356 $cases4[$h][$event->id][
'css'] =
'peruser_holiday ';
2358 $cases4[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2361 $cases4[$h][$event->id][
'color'] = $color;
2363 if ($event->fk_project > 0) {
2364 if (empty($cacheprojects[$event->fk_project])) {
2366 $tmpproj->fetch($event->fk_project);
2367 $cacheprojects[$event->fk_project] = $tmpproj;
2369 $cases4[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2371 if ($event->socid > 0) {
2372 if (empty($cachethirdparties[$event->socid])) {
2373 $tmpthirdparty =
new Societe($db);
2374 $tmpthirdparty->fetch($event->socid);
2375 $cachethirdparties[$event->socid] = $tmpthirdparty;
2377 $cases4[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2379 if ($event->contact_id > 0) {
2380 if (empty($cachecontacts[$event->contact_id])) {
2381 $tmpcontact =
new Contact($db);
2382 $tmpcontact->fetch($event->contact_id);
2383 $cachecontacts[$event->contact_id] = $tmpcontact;
2385 $cases4[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2390 $busy = $event->transparency;
2391 $cases1[$h][$event->id][
'busy'] = $busy;
2392 $cases2[$h][$event->id][
'busy'] = $busy;
2393 $cases3[$h][$event->id][
'busy'] = $busy;
2394 $cases4[$h][$event->id][
'busy'] = $busy;
2395 $cases1[$h][$event->id][
'string'] = $event->label;
2396 $cases2[$h][$event->id][
'string'] = $event->label;
2397 $cases3[$h][$event->id][
'string'] = $event->label;
2398 $cases4[$h][$event->id][
'string'] = $event->label;
2399 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
2400 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
2401 $cases3[$h][$event->id][
'typecode'] = $event->type_code;
2402 $cases4[$h][$event->id][
'typecode'] = $event->type_code;
2403 $cases1[$h][$event->id][
'color'] = $color;
2404 $cases2[$h][$event->id][
'color'] = $color;
2405 $cases3[$h][$event->id][
'color'] = $color;
2406 $cases4[$h][$event->id][
'color'] = $color;
2407 $cases1[$h][$event->id][
'css'] =
'';
2408 $cases2[$h][$event->id][
'css'] =
'';
2409 $cases3[$h][$event->id][
'css'] =
'';
2410 $cases4[$h][$event->id][
'css'] =
'';
2421 for ($h = $begin_h; $h < $end_h; $h++) {
2426 $style1 =
'onclickopenref ';
2427 $style2 =
'onclickopenref ';
2428 $style3 =
'onclickopenref ';
2429 $style4 =
'onclickopenref ';
2430 $string1 =
' ';
2431 $string2 =
' ';
2432 $string3 =
' ';
2433 $string4 =
' ';
2438 if (isset($cases1[$h])) {
2440 if (count($cases1[$h]) > 1) {
2441 $title1 .= count($cases1[$h]).
' '.(count($cases1[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2444 $peruserbusyadded = 0;
2445 $perusernotbusyadded = 0;
2446 foreach ($cases1[$h] as
$id => $ev) {
2447 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2448 $style1 .= $peruserbusyadded ?
'' :
' peruser_busy';
2449 $peruserbusyadded++;
2451 $style1 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2452 $perusernotbusyadded++;
2454 if (!empty($ev[
'css'])) {
2455 $style1 .= $ev[
'css'].
' ';
2459 if (isset($cases2[$h])) {
2461 if (count($cases2[$h]) > 1) {
2462 $title2 .= count($cases2[$h]).
' '.(count($cases2[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2465 $peruserbusyadded = 0;
2466 $perusernotbusyadded = 0;
2467 foreach ($cases2[$h] as
$id => $ev) {
2468 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2469 $style2 .= $peruserbusyadded ?
'' :
' peruser_busy';
2470 $peruserbusyadded++;
2472 $style2 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2473 $perusernotbusyadded++;
2475 if (!empty($ev[
'css'])) {
2476 $style2 .= $ev[
'css'].
' ';
2480 if (isset($cases3[$h])) {
2482 if (count($cases3[$h]) > 1) {
2483 $title3 .= count($cases3[$h]).
' '.(count($cases3[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2486 $peruserbusyadded = 0;
2487 $perusernotbusyadded = 0;
2488 foreach ($cases3[$h] as
$id => $ev) {
2489 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2490 $style3 .= $peruserbusyadded ?
'' :
' peruser_busy';
2491 $peruserbusyadded++;
2493 $style3 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2494 $perusernotbusyadded++;
2496 if (!empty($ev[
'css'])) {
2497 $style3 .= $ev[
'css'].
' ';
2501 if (isset($cases4[$h])) {
2503 if (count($cases4[$h]) > 1) {
2504 $title4 .= count($cases4[$h]).
' '.(count($cases4[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2507 $peruserbusyadded = 0;
2508 $perusernotbusyadded = 0;
2509 foreach ($cases4[$h] as
$id => $ev) {
2510 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2511 $style4 .= $peruserbusyadded ?
'' :
' peruser_busy';
2512 $peruserbusyadded++;
2514 $style4 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2515 $perusernotbusyadded++;
2517 if (!empty($ev[
'css'])) {
2518 $style4 .= $ev[
'css'].
' ';
2527 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
2528 $ids1 = implode(
', ', array_keys($cases1[$h]));
2530 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
2531 $ids2 = implode(
', ', array_keys($cases2[$h]));
2533 if (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) && array_keys($cases3[$h])) {
2534 $ids3 = implode(
',', array_keys($cases3[$h]));
2536 if (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) && array_keys($cases4[$h])) {
2537 $ids4 = implode(
',', array_keys($cases4[$h]));
2540 if ($h == $begin_h) {
2541 echo
'<td class="'.$style.
'_peruserleft cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
2543 echo
'<td class="'.$style.
' cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
2548 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) {
2549 $output = array_values(array_slice($cases1[$h], 0, 1));
2550 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2552 $title1 = $langs->trans(
"Holiday");
2554 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
2555 if ($output[0][
'string']) {
2556 $title1 .=
' - '.$output[0][
'string'];
2559 if ($output[0][
'color']) {
2560 $color1 = $output[0][
'color'];
2562 } elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
2563 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
2569 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) {
2570 $output = array_values(array_slice($cases2[$h], 0, 1));
2571 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2573 $title2 = $langs->trans(
"Holiday");
2575 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
2576 if ($output[0][
'string']) {
2577 $title2 .=
' - '.$output[0][
'string'];
2580 if ($output[0][
'color']) {
2581 $color2 = $output[0][
'color'];
2583 } elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
2584 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
2590 if (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) == 1) {
2591 $output = array_values(array_slice($cases3[$h], 0, 1));
2592 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2594 $title3 = $langs->trans(
"Holiday");
2596 $title3 = $langs->trans(
"Ref").
' '.$ids3.($title3 ?
' - '.$title3 :
'');
2597 if ($output[0][
'string']) {
2598 $title3 .=
' - '.$output[0][
'string'];
2601 if ($output[0][
'color']) {
2602 $color3 = $output[0][
'color'];
2604 } elseif (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) > 1) {
2605 $title3 = $langs->trans(
"Ref").
' '.$ids3.($title3 ?
' - '.$title3 :
'');
2611 if (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) == 1) {
2612 $output = array_values(array_slice($cases4[$h], 0, 1));
2613 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2615 $title4 = $langs->trans(
"Holiday");
2617 $title4 = $langs->trans(
"Ref").
' '.$ids4.($title4 ?
' - '.$title4 :
'');
2618 if ($output[0][
'string']) {
2619 $title4 .=
' - '.$output[0][
'string'];
2622 if ($output[0][
'color']) {
2623 $color4 = $output[0][
'color'];
2625 } elseif (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) > 1) {
2626 $title4 = $langs->trans(
"Ref").
' '.$ids4.($title4 ?
' - '.$title4 :
'');
2630 print
'<table class="nobordernopadding case centpercent">';
2633 if (preg_match(
'/peruser_notbusy/', $style1)) {
2634 print
'style="border: 1px solid #'.($color1 ? $color1 :
"888").
' !important" ';
2635 } elseif ($color1) {
2636 print
'style="background: #'.$color1.
'; "';
2640 print
'center'.($title1 ?
' classfortooltip' :
'').($title1 ?
' cursorpointer' :
'').
'"';
2641 print
'ref="'.$ref1.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_00_'.($ids1 ? $ids1 :
'none').
'"';
2642 print ($title1 ?
' title="'.$title1.
'"' :
'').
'>';
2647 if (preg_match(
'/peruser_notbusy/', $style2)) {
2648 print
'style="border: 1px solid #'.($color2 ? $color2 :
"888").
' !important" ';
2649 } elseif ($color2) {
2650 print
'style="background: #'.$color2.
'; "';
2654 print
'center'.($title2 ?
' classfortooltip' :
'').($title2 ?
' cursorpointer' :
'').
'"';
2655 print
' ref="'.$ref2.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_15_'.($ids2 ? $ids2 :
'none').
'"';
2656 print ($title2 ?
' title="'.$title2.
'"' :
'').
'>';
2661 if (preg_match(
'/peruser_notbusy/', $style3)) {
2662 print
'style="border: 1px solid #'.($color3 ? $color3 :
"888").
' !important" ';
2663 } elseif ($color3) {
2664 print
'style="background: #'.$color3.
'; "';
2668 print
'center'.($title3 ?
' classfortooltip' :
'').($title3 ?
' cursorpointer' :
'').
'"';
2669 print
' ref="'.$ref3.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_30_'.($ids3 ? $ids3 :
'none').
'"';
2670 print ($title3 ?
' title="'.$title3.
'"' :
'').
'>';
2675 if (preg_match(
'/peruser_notbusy/', $style4)) {
2676 print
'style="border: 1px solid #'.($color4 ? $color4 :
"888").
' !important" ';
2677 } elseif ($color4) {
2678 print
'style="background: #'.$color4.
'; "';
2682 print
'center'.($title4 ?
' classfortooltip' :
'').($title4 ?
' cursorpointer' :
'').
'"';
2683 print
' ref="'.$ref4.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_45_'.($ids4 ? $ids4 :
'none').
'"';
2684 print ($title4 ?
' title="'.$title4.
'"' :
'').
'>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
agenda_get_birthday_events($db, $langs, $user, $mode, $month, $day, $year, &$eventarray, &$nbevents, $firstdaytoshow, $lastdaytoshow)
Complete an agenda calendar event array with contact birthday pseudo-events.
print_actions_filter( $form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filtered, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid=0, $excludetype='', $resourceid=0, $search_categ_cus=0, $search_import_key='')
Show filter form in agenda view.
calendars_prepare_head($param)
Define head array for tabs of agenda setup pages.
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 manage agenda events (actions)
Class to read/parse ICal calendars.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
dol_get_next_week($day, $week, $month, $year)
Return next week.
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0, $tz='')
Add a delay to a date.
dol_stringtotime($string, $gm=1, $processnotimeasnoon=0)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
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...
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_getThemeFilePath($file, $theme='')
Return the full filesystem path of a file located in the currently selected theme directory.
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
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.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
conf($dolibarr_main_document_root, $realpathconf=null)
Load conf file (file must exists)
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.