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';
107$pid = GETPOSTISSET(
"search_projectid") ?
GETPOSTINT(
"search_projectid", 3) :
GETPOSTINT(
"projectid", 3);
108$status = GETPOSTISSET(
"search_status") ?
GETPOST(
"search_status",
'aZ09') :
GETPOST(
"status",
'aZ09');
109$type = GETPOSTISSET(
"search_type") ?
GETPOST(
"search_type",
'aZ09') :
GETPOST(
"type",
'aZ09');
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);
134$begin_h = GETPOSTISSET(
'begin_h') ?
GETPOSTINT(
'begin_h') : ($tmparray[0] !=
'' ? $tmparray[0] : 9);
135$end_h = GETPOSTISSET(
'end_h') ?
GETPOSTINT(
'end_h') : ($tmparray[1] !=
'' ? $tmparray[1] : 18);
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);
150$begin_d = GETPOSTISSET(
'begin_d') ?
GETPOSTINT(
'begin_d') : ($tmparray[0] !=
'' ? $tmparray[0] : 1);
151$end_d = GETPOSTISSET(
'end_d') ?
GETPOSTINT(
'end_d') : ($tmparray[1] !=
'' ? $tmparray[1] : 5);
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;
162if ($status ==
'' && !GETPOSTISSET(
'search_status')) {
166if (empty($mode) && !GETPOSTISSET(
'mode')) {
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);
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',
282while ($i < $MAXAGENDA) {
284 $source =
'AGENDA_EXT_SRC_'.$user->id.
'_'.$i;
285 $name =
'AGENDA_EXT_NAME_'.$user->id.
'_'.$i;
286 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$user->id.
'_'.$i;
287 $color =
'AGENDA_EXT_COLOR_'.$user->id.
'_'.$i;
288 $enabled =
'AGENDA_EXT_ENABLED_'.$user->id.
'_'.$i;
289 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT_'.$user->id.
'_'.$i;
290 $buggedfile =
'AGENDA_EXT_BUGGEDFILE_'.$user->id.
'_'.$i;
294 $listofextcals[] = array(
295 'type' =>
'usersetup',
298 'offsettz' => (
int) (empty($user->conf->$offsettz) ? 0 : $user->
conf->$offsettz),
309$first_day = $prev[
'first_day'];
310$first_month = $prev[
'first_month'];
311$first_year = $prev[
'first_year'];
313$week = $prev[
'week'];
317$next_year = $next[
'year'];
318$next_month = $next[
'month'];
319$next_day = $next[
'day'];
321$max_day_in_month =
date(
"t",
dol_mktime(0, 0, 0, $month, 1, $year));
327$title = $langs->trans(
"DoneAndToDoActions");
328if ($status ==
'done') {
329 $title = $langs->trans(
"DoneActions");
331if ($status ==
'todo') {
332 $title = $langs->trans(
"ToDoActions");
336if (($actioncode && $actioncode !==
'-1') || GETPOSTISSET(
'search_actioncode')) {
337 if (is_array($actioncode)) {
338 foreach ($actioncode as $str_action) {
339 if ($str_action !=
'-1') {
340 $param .=
"&search_actioncode[]=".urlencode($str_action);
344 $param .=
"&search_actioncode=".urlencode($actioncode);
347if ($resourceid > 0) {
348 $param .=
"&search_resourceid=".urlencode((
string) ($resourceid));
351if ($status || GETPOSTISSET(
'status') || GETPOSTISSET(
'search_status')) {
352 $param .=
"&search_status=".urlencode($status);
355 $param .=
"&search_filter=".urlencode((
string) $filter);
358 $param .=
"&search_filtert=".urlencode((
string) $filtert);
361 $param .=
"&search_usergroup=".urlencode((
string) ($usergroup));
364 $param .=
"&search_socid=".urlencode((
string) ($socid));
367 $param .=
"&search_showbirthday=1";
370 $param .=
"&search_projectid=".urlencode((
string) ($pid));
373 $param .=
"&search_type=".urlencode($type);
375if ($mode !=
'show_peruser') {
376 $param .=
'&mode='.urlencode((
string) $mode);
379 $param .=
'&begin_h='.((int) $begin_h);
382 $param .=
'&end_h='.((int) $end_h);
385 $param .=
'&begin_d='.((int) $begin_d);
388 $param .=
'&end_d='.((int) $end_d);
390if ($search_categ_cus != 0) {
391 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
393$param .=
"&maxprint=".urlencode((
string) ($maxprint));
395$paramnoactionodate = $param;
400$prev_year = $prev[
'prev_year'];
401$prev_month = $prev[
'prev_month'];
402$prev_day = $prev[
'prev_day'];
403$first_day = $prev[
'first_day'];
404$first_month = $prev[
'first_month'];
405$first_year = $prev[
'first_year'];
407$week = $prev[
'week'];
411$next_year = $next[
'year'];
412$next_month = $next[
'month'];
413$next_day = $next[
'day'];
417$firstdaytoshow =
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year,
'tzuserrel');
418$nb_weeks_to_show = (
getDolGlobalString(
'AGENDA_NB_WEEKS_IN_VIEW_PER_USER')) ? ((
int)
$conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7;
424$max_day_in_month = idate(
"t",
dol_mktime(0, 0, 0, $month, 1, $year,
'gmt'));
427$picto =
'calendarweek';
430$nav =
'<div class="navselectiondate inline-block nowraponall">';
431$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";
432$nav .=
" <span id=\"month_name\">".dol_print_date(
dol_mktime(0, 0, 0, $first_month, $first_day, $first_year),
"%Y").
", ".$langs->trans(
"WeekShort").
" ".$week;
434$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";
435if (empty(
$conf->dol_optimize_smallscreen)) {
436 $nav .=
' <a href="?year='.$nowyear.
'&month='.$nowmonth.
'&day='.$nowday.$param.
'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans(
"Today").
'</a> ';
439$nav .= $form->selectDate($dateselect,
'dateselect', 0, 0, 1,
'', 1, 0);
441$nav .=
'<button type="submit" class="liste_titre button_search valignmiddle" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
444$paramnodate = $param;
445$param .=
'&year='.$year.
'&month='.$month.($day ?
'&day='.$day :
'');
449$paramnoaction = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $param));
450$paramnoactionodate = preg_replace(
'/mode=[a-z_]+/',
'', preg_replace(
'/action=[a-z_]+/',
'', $paramnodate));
454print
'<form method="POST" id="searchFormList" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
455if ($optioncss !=
'') {
456 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
458print
'<input type="hidden" name="token" value="'.newToken().
'">';
459print
'<input type="hidden" name="mode" value="'.$mode.
'">';
462$mode =
'show_peruser';
463$massactionbutton =
'';
466$viewmode =
'<div class="navmode inline-block">';
468$viewmode .=
'<a class="btnTitle reposition" href="'.DOL_URL_ROOT.
'/comm/action/list.php?mode=show_list&restore_lastsearch_values=1'.$paramnoactionodate.
'">';
470$viewmode .=
img_picto($langs->trans(
"List"),
'object_calendarlist',
'class="imgforviewmode pictoactionview block"');
472$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewList").
'</span></a>';
476$viewmode .=
img_picto($langs->trans(
"ViewCal"),
'object_calendarmonth',
'class="pictoactionview block"');
478$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewCal").
'</span></a>';
482$viewmode .=
img_picto($langs->trans(
"ViewWeek"),
'object_calendarweek',
'class="pictoactionview block"');
484$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewWeek").
'</span></a>';
488$viewmode .=
img_picto($langs->trans(
"ViewDay"),
'object_calendarday',
'class="pictoactionview block"');
490$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow">'.$langs->trans(
"ViewDay").
'</span></a>';
494$viewmode .=
img_picto($langs->trans(
"ViewPerUser"),
'object_calendarperuser',
'class="pictoactionview block"');
496$viewmode .=
'<span class="valignmiddle text-plus-circle btnTitle-label hideonsmartphone inline-block width75 divoverflow" title="'.dolPrintHTML($langs->trans(
"ViewPerUser")).
'">'.$langs->trans(
"ViewPerUser").
'</span></a>';
499$parameters = array();
501$reshook = $hookmanager->executeHooks(
'addCalendarView', $parameters, $object, $action);
502if (empty($reshook)) {
503 $viewmode .= $hookmanager->resPrint;
504} elseif ($reshook > 1) {
505 $viewmode = $hookmanager->resPrint;
508$viewmode .=
'</div>';
510$viewmode .=
'<span class="marginrightonly"></span>';
515if ($user->hasRight(
'agenda',
'myactions',
'create') || $user->hasRight(
'agenda',
'allactions',
'create')) {
518 $newparam .=
'&month='.urlencode(str_pad((
string) $month, 2,
"0", STR_PAD_LEFT)).
'&year='.((int) $tmpforcreatebutton[
'year']);
519 if ($begin_h !==
'') {
520 $newparam .=
'&begin_h='.((int) $begin_h);
523 $newparam .=
'&end_h='.((int) $end_h);
525 if ($begin_d !==
'') {
526 $newparam .=
'&begin_d='.((int) $begin_d);
529 $newparam .=
'&end_d='.((int) $end_d);
532 $urltocreateaction = DOL_URL_ROOT.
'/comm/action/card.php?action=create';
533 $urltocreateaction .=
'&apyear='.$tmpforcreatebutton[
'year'].
'&apmonth='.$tmpforcreatebutton[
'mon'].
'&apday='.$tmpforcreatebutton[
'mday'].
'&aphour='.$tmpforcreatebutton[
'hours'].
'&apmin='.$tmpforcreatebutton[
'minutes'];
534 $urltocreateaction .=
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?'.$newparam);
536 $newcardbutton .= dolGetButtonTitle($langs->trans(
"AddAction"),
'',
'fa fa-plus-circle', $urltocreateaction);
545$showextcals = $listofextcals;
546$bookcalcalendars = array();
550 $sql =
"SELECT ba.rowid, bc.label, bc.ref, bc.rowid as id_cal";
551 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bookcal_availabilities as ba";
552 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"bookcal_calendar as bc";
553 $sql .=
" ON bc.rowid = ba.fk_bookcal_calendar";
554 $sql .=
" WHERE bc.status = 1";
555 $sql .=
" AND ba.status = 1";
556 $sql .=
" AND bc.entity IN (".getEntity(
'agenda').
")";
557 if (!empty($filtert) && $filtert !=
'-1' && $filtert !=
'-2') {
558 $sql .=
" AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).
")";
560 $resql =
$db->query($sql);
562 $num =
$db->num_rows($resql);
565 $objp =
$db->fetch_object($resql);
566 $label = !empty($objp->label) ? $objp->label : $objp->ref;
567 $bookcalcalendars[
"calendars"][$objp->id_cal] = array(
"id" => $objp->id_cal,
"label" => $label);
568 $bookcalcalendars[
"availabilitieslink"][$objp->rowid] = $objp->id_cal;
576if (!empty(
$conf->use_javascript_ajax)) {
577 $s .=
"\n".
'<!-- Div to calendars selectors -->'.
"\n";
579 $s .=
'<script type="text/javascript">'.
"\n";
580 $s .=
'jQuery(document).ready(function () {'.
"\n";
581 $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";
582 $s .=
'jQuery(".check_holiday").click(function() { console.log("Click on .check_holiday so we toggle class .peruser_holiday"); if (jQuery(".peruser_holiday").hasClass("peruser_holiday_imp")) { jQuery(".peruser_holiday").removeClass("peruser_holiday_imp"); } else { jQuery(".peruser_holiday").addClass("peruser_holiday_imp"); } });'.
"\n";
583 if (
isModEnabled(
"bookcal") && !empty($bookcalcalendars[
"calendars"])) {
584 foreach ($bookcalcalendars[
"calendars"] as $key => $value) {
585 $s .=
'jQuery(".check_bookcal_calendar_'.$value[
'id'].
'").click(function() { console.log("Toggle Bookcal Calendar '.$value[
'id'].
'"); jQuery(".family_bookcal_calendar_'.$value[
'id'].
'").toggle(); });'.
"\n";
589 $s .=
'</script>'.
"\n";
592 $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>';
595 if ($user->hasRight(
"holiday",
"read")) {
597 <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' :
'') .
'>
598 <label for="check_holiday" class="labelcalendar">
599 <span class="check_holiday_text small">' . $langs->trans(
"Holidays") .
'</span>
605 if (is_array($showextcals) && count($showextcals) > 0) {
606 $s .=
'<script type="text/javascript">'.
"\n";
607 $s .=
'jQuery(document).ready(function () {
608 jQuery("div input[name^=\"check_ext\"]").each(function(index, elem) {
609 var name = jQuery(elem).attr("name");
610 if (jQuery(elem).is(":checked")) {
611 jQuery(".family_ext" + name.replace("check_ext", "")).show();
613 jQuery(".family_ext" + name.replace("check_ext", "")).hide();
617 jQuery("div input[name^=\"check_ext\"]").click(function() {
618 var name = $(this).attr("name");
619 jQuery(".family_ext" + name.replace("check_ext", "")).toggle();
622 $s .=
'</script>'.
"\n";
624 foreach ($showextcals as $val) {
625 $htmlname = md5($val[
'name']);
627 if (!empty($val[
'default']) ||
GETPOSTINT(
'check_ext'.$htmlname)) {
628 $default =
"checked";
633 $tooltip = $langs->trans(
"Cache").
' '.round($DELAYFORCACHE / 60).
'mn';
635 $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>';
659 $parameters = array();
660 $reshook = $hookmanager->executeHooks(
'addCalendarChoice', $parameters, $object, $action);
661 if (empty($reshook)) {
662 $s .= $hookmanager->resPrint;
663 } elseif ($reshook > 1) {
664 $s = $hookmanager->resPrint;
667 $s .=
"\n".
'<!-- End div to calendars selectors -->'.
"\n";
670 $newparam = preg_replace(
'/showbirthday=[0-1]/i',
'showbirthday='.($showbirthday ?
'1' :
'0'), $newparam);
671 if (!preg_match(
'/showbirthday=/i', $newparam)) {
672 $newparam .=
'&showbirthday=1';
677 $link .= $langs->trans(
"AgendaShowBirthdayEvents");
679 $link .= $langs->trans(
"AgendaHideBirthdayEvents");
686$eventarray = array();
694$sql .=
" a.id, a.label,";
697$sql .=
" a.percent,";
698$sql .=
" a.fk_user_author, a.fk_user_action,";
699$sql .=
" a.transparency, a.priority, a.fulldayevent, a.location,";
700$sql .=
" a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,";
701$sql .=
" a.fk_element, a.elementtype,";
702$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";
705$parameters = array();
706$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
707$sql .= $hookmanager->resPrint;
711$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm as ca, ".MAIN_DB_PREFIX.
"actioncomm as a";
713if ($resourceid > 0) {
714 $sql .=
", ".MAIN_DB_PREFIX.
"element_resources as r";
718if (($filtert !=
'-1' && $filtert !=
'-2') || $usergroup > 0) {
720 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm_resources as ar";
721 $sql .=
" ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
722 if ($filtert !=
'' && $filtert !=
'-1' && $filtert !=
'-2' && $filtert !=
'-3') {
723 $sql .=
" AND ar.fk_element IN (".$db->sanitize($filtert).
")";
724 } elseif ($filtert ==
'-3') {
725 $sql .=
" AND ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
727 if ($usergroup > 0) {
728 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
732$sql .=
" WHERE a.fk_action = ca.id";
733$sql .=
" AND a.entity IN (".getEntity(
'agenda').
")";
736if (!empty($actioncode)) {
738 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ==
'AC_NON_AUTO') {
739 $sql .=
" AND ca.type != 'systemauto'";
740 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ==
'AC_ALL_AUTO') {
741 $sql .=
" AND ca.type = 'systemauto'";
743 if ((is_array($actioncode) && in_array(
'AC_OTH', $actioncode)) || $actioncode ==
'AC_OTH') {
744 $sql .=
" AND ca.type != 'systemauto'";
746 if ((is_array($actioncode) && in_array(
'AC_OTH_AUTO', $actioncode)) || $actioncode ==
'AC_OTH_AUTO') {
747 $sql .=
" AND ca.type = 'systemauto'";
751 if ((is_array($actioncode) && in_array(
'AC_NON_AUTO', $actioncode)) || $actioncode ===
'AC_NON_AUTO') {
752 $sql .=
" AND ca.type != 'systemauto'";
753 } elseif ((is_array($actioncode) && in_array(
'AC_ALL_AUTO', $actioncode)) || $actioncode ===
'AC_ALL_AUTO') {
754 $sql .=
" AND ca.type = 'systemauto'";
755 } elseif ((is_array($actioncode) && !in_array(
'-1', $actioncode) && !in_array(
'-3', $actioncode)) || ($actioncode !==
'-1' && $actioncode !==
'-3')) {
756 if (is_array($actioncode)) {
757 foreach ($actioncode as $key => $val) {
758 if ($val ==
'-1' || $val ==
'-2') {
759 unset($actioncode[$key]);
762 if (!empty($actioncode)) {
763 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", $actioncode).
"'", 1).
")";
766 $sql .=
" AND ca.code IN (".$db->sanitize(
"'".implode(
"','", explode(
',', $actioncode)).
"'", 1).
")";
771if ($resourceid > 0) {
772 $sql .=
" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
775 $sql .=
" AND a.fk_project = ".((int) $pid);
779if (
isModEnabled(
"societe") && !$user->hasRight(
'societe',
'client',
'voir')) {
780 $search_sale = $user->id;
783if ($search_sale && $search_sale !=
'-1') {
784 if ($search_sale == -2) {
785 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = a.fk_soc)";
786 } elseif ($search_sale > 0) {
787 $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).
"))";
792 $sql .=
" AND a.fk_soc = ".((int) $socid);
795if ($mode ==
'show_day') {
797 $sql .=
" (a.datep BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
798 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
800 $sql .=
" (a.datep2 BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
801 $sql .=
" AND '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
803 $sql .=
" (a.datep < '".$db->idate(
dol_mktime(0, 0, 0, $month, $day, $year,
'tzuserrel')).
"'";
804 $sql .=
" AND a.datep2 > '".$db->idate(
dol_mktime(23, 59, 59, $month, $day, $year,
'tzuserrel')).
"')";
809 $sql .=
" (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
810 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
812 $sql .=
" (a.datep2 BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
813 $sql .=
" AND '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
815 $sql .=
" (a.datep < '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2)).
"'";
816 $sql .=
" AND a.datep2 > '".$db->idate($lastdaytoshow + (60 * 60 * 24 * 2)).
"')";
820 $sql .=
" AND ca.id = ".((int) $type);
824 $sql .=
" AND a.percent = 0";
826if ($status ===
'na') {
828 $sql .=
" AND a.percent = -1";
830if ($status ==
'50') {
832 $sql .=
" AND (a.percent > 0 AND a.percent < 100)";
834if ($status ==
'done' || $status ==
'100') {
835 $sql .=
" AND (a.percent = 100)";
837if ($status ==
'todo') {
838 $sql .=
" AND (a.percent >= 0 AND a.percent < 100)";
841if (($filtert > 0 || $filtert == -3) || $usergroup > 0) {
845 $sql .=
"ar.fk_element = ".((int) $filtert);
846 } elseif ($filtert == -3) {
847 $sql .=
"ar.fk_element IN (".$db->sanitize(implode(
',', $user->getAllChildIds(1))).
")";
849 if ($usergroup > 0) {
850 $sql .= ($filtert > 0 ?
" OR " :
"").
" ugu.fk_usergroup = ".((
int) $usergroup);
856if ($search_categ_cus != -1) {
857 if ($search_categ_cus == -2) {
858 $sql .=
" AND NOT EXISTS (SELECT ca.fk_actioncomm FROM ".MAIN_DB_PREFIX.
"categorie_actioncomm as ca WHERE ca.fk_actioncomm = a.id)";
859 } elseif ($search_categ_cus > 0) {
860 $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).
"))";
864$sql .=
$db->order(
"fk_user_action, datep");
867dol_syslog(
"comm/action/peruser.php", LOG_DEBUG);
868$resql =
$db->query($sql);
870 $num =
$db->num_rows($resql);
872 $MAXONSAMEPAGE = 10000;
874 while ($i < $num && $i < $MAXONSAMEPAGE) {
875 $obj =
$db->fetch_object($resql);
879 if (
getDolGlobalString(
'AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code ==
'AC_OTH_AUTO') {
884 $datep =
$db->jdate($obj->datep);
885 $datep2 =
$db->jdate($obj->datep2);
891 $event->id = $obj->id;
892 $event->ref = (
string) $event->id;
894 $event->fulldayevent = $obj->fulldayevent;
897 if ($event->fulldayevent) {
899 $event->datep =
$db->jdate($obj->datep, $tzforfullday ?
'tzuser' :
'tzserver');
900 $event->datef =
$db->jdate($obj->datep2, $tzforfullday ?
'tzuser' :
'tzserver');
903 $event->datep =
$db->jdate($obj->datep,
'tzserver');
904 $event->datef =
$db->jdate($obj->datep2,
'tzserver');
910 $event->type_code = $obj->type_code;
911 $event->type_label = $obj->type_label;
912 $event->type_color = $obj->type_color;
913 $event->type = $obj->type_type;
914 $event->type_picto = $obj->type_picto;
916 $event->label = $obj->label;
917 $event->percentage = $obj->percent;
918 $event->authorid = $obj->fk_user_author;
919 $event->userownerid = $obj->fk_user_action;
920 $event->fetch_userassigned();
922 $event->priority = $obj->priority;
923 $event->location = $obj->location;
924 $event->transparency = $obj->transparency;
925 $event->fk_element = $obj->fk_element;
926 $event->elementid = $obj->fk_element;
927 $event->elementtype = $obj->elementtype;
929 $event->fk_project = $obj->fk_project;
931 $event->socid = $obj->fk_soc;
932 $event->contact_id = $obj->fk_contact;
933 $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar;
934 if (!empty($event->fk_bookcal_calendar)) {
935 $event->type =
"bookcal_calendar";
940 $event->date_start_in_calendar = $event->datep;
941 if ($event->datef !=
'' && $event->datef >= $event->datep) {
942 $event->date_end_in_calendar = $event->datef;
944 $event->date_end_in_calendar = $event->datep;
950 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
954 if ($event->date_start_in_calendar < $firstdaytoshow) {
955 $event->date_start_in_calendar = $firstdaytoshow;
957 if ($event->date_end_in_calendar >= $lastdaytoshow) {
958 $event->date_end_in_calendar = ($lastdaytoshow - 1);
962 $daycursor = $event->date_start_in_calendar;
967 $daycursorend = $event->date_end_in_calendar;
968 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
969 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
970 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
975 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
976 $daykeyend =
dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend,
'gmt');
990 $eventarray[$daykey][] = $event;
993 $daykey += 60 * 60 * 24;
995 if ($daykey > $daykeyend) {
1004 $parameters[
'obj'] = $obj;
1005 $reshook = $hookmanager->executeHooks(
'hookEventElements', $parameters, $event, $action);
1006 $event = $hookmanager->resPrint;
1024 $sql =
'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
1025 $sql .=
' FROM '.MAIN_DB_PREFIX.
'socpeople as sp';
1026 $sql .=
' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).
'))';
1027 $sql .=
" AND sp.entity IN (".getEntity(
'contact').
")";
1028 if ($mode ==
'show_day') {
1029 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1030 $sql .=
' AND DAY(birthday) = '.((int) $day);
1032 $sql .=
' AND MONTH(birthday) = '.((int) $month);
1034 $sql .=
' ORDER BY birthday';
1036 dol_syslog(
"comm/action/index.php", LOG_DEBUG);
1037 $resql =
$db->query($sql);
1039 $num =
$db->num_rows($resql);
1042 $obj =
$db->fetch_object($resql);
1046 $event->id = $obj->rowid;
1047 $event->ref = (
string) $event->id;
1052 $event->datep =
dol_mktime(0, 0, 0, $datearray[
'mon'], $datearray[
'mday'], $year,
true);
1053 $event->datef = $event->datep;
1055 $event->type_code =
'BIRTHDAY';
1056 $event->type_label =
'';
1057 $event->type_color =
'';
1058 $event->type =
'birthdate';
1059 $event->type_picto =
'birthdate';
1061 $event->label = $langs->trans(
"Birthday").
' '.
dolGetFirstLastname($obj->firstname, $obj->lastname);
1062 $event->percentage = 100;
1063 $event->fulldayevent = 1;
1065 $event->contact_id = $obj->rowid;
1067 $event->date_start_in_calendar =
$db->jdate($event->datep);
1068 $event->date_end_in_calendar =
$db->jdate($event->datef);
1071 $daycursor = $event->datep;
1076 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1078 $eventarray[$daykey][] = $event;
1096if ($user->hasRight(
"holiday",
"read")) {
1097 $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";
1098 $sql .=
" FROM ".MAIN_DB_PREFIX.
"holiday as x, ".MAIN_DB_PREFIX.
"user as u";
1099 $sql .=
" WHERE u.rowid = x.fk_user";
1100 $sql .=
" AND u.statut = '1'";
1101 $sql .=
" AND (x.statut = '2' OR x.statut = '3')";
1103 $sql .=
" AND x.date_debut < '".$db->idate(
dol_get_last_day($year, $month)).
"'";
1104 $sql .=
" AND x.date_fin >= '".$db->idate(
dol_get_first_day($year, $month)).
"'";
1105 if (!$user->hasRight(
'holiday',
'readall')) {
1106 $sql .=
" AND x.fk_user IN(".$db->sanitize(implode(
", ", $user->getAllChildIds(1))).
") ";
1109 $resql =
$db->query($sql);
1111 $num =
$db->num_rows($resql);
1115 $obj =
$db->fetch_object($resql);
1120 $event->id = $obj->rowid;
1121 $event->ref = (
string) $event->id;
1123 $event->type_code =
'HOLIDAY';
1124 $event->type_label =
'';
1125 $event->type_color =
'';
1126 $event->type =
'holiday';
1127 $event->type_picto =
'holiday';
1129 $event->datep =
$db->jdate($obj->date_start) + (int) ((empty($obj->halfday) || $obj->halfday == 1 ? 0 : 12) * 60 * 60);
1130 $event->datef =
$db->jdate($obj->date_end) + (int) ((empty($obj->halfday) || $obj->halfday == -1 ? 24 : 12) * 60 * 60 - 1);
1131 $event->date_start_in_calendar = $event->datep;
1132 $event->date_end_in_calendar = $event->datef;
1134 $event->transparency = 1;
1136 $event->userownerid = $obj->uid;
1137 $event->userassigned = array($obj->uid => array(
'id' => $obj->uid,
'transparency' => 1));
1139 if ($obj->status == 3) {
1141 $event->percentage = -1;
1142 } elseif ($obj->status == 2) {
1144 $event->percentage = 0;
1148 $daycursor = $event->date_start_in_calendar;
1153 $daycursorend = $event->date_end_in_calendar;
1154 $anneeend = (int)
dol_print_date($daycursorend,
'%Y',
'tzuserrel');
1155 $moisend = (int)
dol_print_date($daycursorend,
'%m',
'tzuserrel');
1156 $jourend = (int)
dol_print_date($daycursorend,
'%d',
'tzuserrel');
1159 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1160 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1165 $firstdayofholiday = ($ifornbofdays == 1);
1166 $lastdayofholiday = ($daykeygmt ==
dol_get_first_hour($event->date_end_in_calendar,
'gmt'));
1170 if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) {
1173 if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) {
1174 $newevent->label .=
' ('.$langs->trans(
"Morning").
')';
1175 } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) {
1176 $newevent->label .=
' ('.$langs->trans(
"Afternoon").
')';
1178 $eventarray[$daykey][] = $newevent;
1180 $eventarray[$daykey][] = $event;
1183 $daykey += 60 * 60 * 24;
1184 $daykeygmt += 60 * 60 * 24;
1185 }
while ($daykey <= $event->date_end_in_calendar);
1194if (count($listofextcals)) {
1195 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/ical.class.php';
1197 foreach ($listofextcals as $key => $extcal) {
1198 $url = $extcal[
'src'];
1199 $namecal = $extcal[
'name'];
1200 $offsettz = $extcal[
'offsettz'];
1201 $colorcal = $extcal[
'color'];
1202 $buggedfile = $extcal[
'buggedfile'];
1208 $ical->parse($url, $pathforcachefile, $DELAYFORCACHE);
1211 $listofextcals[$key][
'error'] = $ical->error;
1212 $s .=
'<br><div class="warning">'.dol_escape_htmltag($listofextcals[$key][
'name']).
': '.$url.
'<br>Error message: '.
dol_escape_htmltag($ical->error).
'</div>';
1217 $icalevents = array();
1218 if (is_array($ical->get_event_list())) {
1219 $icalevents = array_merge($icalevents, $ical->get_event_list());
1221 if (is_array($ical->get_freebusy_list())) {
1222 $icalevents = array_merge($icalevents, $ical->get_freebusy_list());
1225 if (count($icalevents) > 0) {
1227 $moreicalevents = array();
1228 foreach ($icalevents as $icalevent) {
1229 if (isset($icalevent[
'RRULE']) && is_array($icalevent[
'RRULE'])) {
1232 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1235 } elseif (is_array($icalevent[
'DTSTART']) && !empty($icalevent[
'DTSTART'][
'unixtime'])) {
1236 $datecurstart = $icalevent[
'DTSTART'][
'unixtime'];
1237 $datecurend = $icalevent[
'DTEND'][
'unixtime'];
1238 if (!empty($ical->cal[
'DAYLIGHT'][
'DTSTART']) ) {
1240 $tmpcurstart = $datecurstart;
1241 $tmpcurend = $datecurend;
1242 $tmpdaylightstart =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'DAYLIGHT'][
'DTSTART'];
1243 $tmpdaylightend =
dol_mktime(0, 0, 0, 1, 1, 1970, 1) + (int) $ical->cal[
'STANDARD'][
'DTSTART'];
1246 if ($tmpcurstart >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1247 $datecurstart -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1249 $datecurstart -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1251 if ($tmpcurend >= $tmpdaylightstart && $tmpcurstart < $tmpdaylightend) {
1252 $datecurend -= ((int) $ical->cal[
'DAYLIGHT'][
'TZOFFSETTO']) * 36;
1254 $datecurend -= ((int) $ical->cal[
'STANDARD'][
'TZOFFSETTO']) * 36;
1261 dol_syslog(
"Found a not recognized repeatable record with unknown date start", LOG_ERR);
1266 $interval = (empty($icalevent[
'RRULE'][
'INTERVAL']) ? 1 : $icalevent[
'RRULE'][
'INTERVAL']);
1267 $until = empty($icalevent[
'RRULE'][
'UNTIL']) ? 0 :
dol_stringtotime($icalevent[
'RRULE'][
'UNTIL'], 1);
1268 $maxrepeat = empty($icalevent[
'RRULE'][
'COUNT']) ? 0 : $icalevent[
'RRULE'][
'COUNT'];
1269 if ($until && ($until + ($datecurend - $datecurstart)) < $firstdaytoshow) {
1272 if ($datecurstart >= $lastdaytoshow) {
1277 while (($datecurstart < $lastdaytoshow) && (empty($maxrepeat) || ($numofevent < $maxrepeat))) {
1278 if ($datecurend >= $firstdaytoshow) {
1279 $newevent = $icalevent;
1280 unset($newevent[
'RRULE']);
1281 if ($icalevent[
'DTSTART;VALUE=DATE']) {
1282 $newevent[
'DTSTART;VALUE=DATE'] =
dol_print_date($datecurstart,
'%Y%m%d');
1283 $newevent[
'DTEND;VALUE=DATE'] =
dol_print_date($datecurend + 1,
'%Y%m%d');
1285 $newevent[
'DTSTART'] = $datecurstart;
1286 $newevent[
'DTEND'] = $datecurend;
1288 $moreicalevents[] = $newevent;
1292 $savdatecurstart = $datecurstart;
1293 if ($icalevent[
'RRULE'][
'FREQ'] ==
'DAILY') {
1297 if ($icalevent[
'RRULE'][
'FREQ'] ==
'WEEKLY') {
1300 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'MONTHLY') {
1303 } elseif ($icalevent[
'RRULE'][
'FREQ'] ==
'YEARLY') {
1308 if ($savdatecurstart >= $datecurstart) {
1309 dol_syslog(
"Found a rule freq ".$icalevent[
'RRULE'][
'FREQ'].
" not managed by dolibarr code. Assume 1 week frequency.", LOG_ERR);
1310 $datecurstart += 3600 * 24 * 7;
1311 $datecurend += 3600 * 24 * 7;
1316 $icalevents = array_merge($icalevents, $moreicalevents);
1319 foreach ($icalevents as $icalevent) {
1324 if (!empty($icalevent[
'RRULE'])) {
1333 if (isset($icalevent[
'DTSTART;VALUE=DATE'])) {
1336 if (empty($icalevent[
'DTEND;VALUE=DATE'])) {
1337 $dateend = $datestart + 86400 - 1;
1343 $event->fulldayevent = 1;
1345 } elseif (!is_array($icalevent[
'DTSTART'])) {
1346 $datestart = $icalevent[
'DTSTART'];
1347 $dateend = empty($icalevent[
'DTEND']) ? $datestart : $icalevent[
'DTEND'];
1349 $datestart += +($offsettz * 3600);
1350 $dateend += +($offsettz * 3600);
1355 } elseif (isset($icalevent[
'DTSTART'][
'unixtime'])) {
1356 $datestart = $icalevent[
'DTSTART'][
'unixtime'];
1357 $dateend = $icalevent[
'DTEND'][
'unixtime'];
1359 $datestart += +($offsettz * 3600);
1360 $dateend += +($offsettz * 3600);
1363 if ($buggedfile ===
'uselocalandtznodaylight') {
1367 if ($buggedfile ===
'uselocalandtzdaylight') {
1368 $localtzs =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTSTART'][
'TZID']));
1369 $localtze =
new DateTimeZone((
string) preg_replace(
'/"/',
'', $icalevent[
'DTEND'][
'TZID']));
1370 $localdts =
new DateTime(
dol_print_date($datestart,
'dayrfc',
'gmt'), $localtzs);
1371 $localdte =
new DateTime(
dol_print_date($dateend,
'dayrfc',
'gmt'), $localtze);
1372 $tmps = -1 * $localtzs->getOffset($localdts);
1373 $tmpe = -1 * $localtze->getOffset($localdte);
1374 $datestart += $tmps;
1381 if ($addevent && $datestart !==
null && $dateend !==
null) {
1382 $event->id = $icalevent[
'UID'];
1383 $event->ref = (
string) $event->id;
1385 $userId = $userstatic->findUserIdByEmail($namecal);
1386 if (!empty($userId) && $userId > 0) {
1387 $event->userassigned[$userId] = [
1389 'transparency' => 1,
1391 $event->percentage = -1;
1394 $event->type_code =
"ICALEVENT";
1395 $event->type_label = $namecal;
1396 $event->type_color = $colorcal;
1397 $event->type =
'icalevent';
1398 $event->type_picto =
'rss';
1400 $event->icalname = $namecal;
1401 $event->icalcolor = $colorcal;
1403 $event->datep = (int) ($datestart + $usertime);
1404 $event->datef = (int) ($dateend + $usertime);
1406 if (isset($icalevent[
'SUMMARY']) && $icalevent[
'SUMMARY']) {
1408 } elseif (isset($icalevent[
'DESCRIPTION']) && $icalevent[
'DESCRIPTION']) {
1411 $event->label = $langs->trans(
"ExtSiteNoLabel");
1418 if (!empty($icalevent[
'PRIORITY'])) {
1419 $event->priority = $icalevent[
'PRIORITY'];
1423 if (!empty($icalevent[
'TRANSP'])) {
1424 if ($icalevent[
'TRANSP'] ==
"TRANSPARENT") {
1425 $event->transparency = 0;
1427 if ($icalevent[
'TRANSP'] ==
"OPAQUE") {
1428 $event->transparency = 1;
1439 if (!empty($icalevent[
'LOCATION'])) {
1440 $event->location = $icalevent[
'LOCATION'];
1443 $event->date_start_in_calendar = $event->datep;
1445 if ((
int) $event->datef != 0 && $event->datef >= $event->datep) {
1446 $event->date_end_in_calendar = $event->datef;
1448 $event->date_end_in_calendar = $event->datep;
1452 if ($event->date_end_in_calendar < $firstdaytoshow || $event->date_start_in_calendar >= $lastdaytoshow) {
1458 if ($event->date_start_in_calendar < $firstdaytoshow) {
1459 $event->date_start_in_calendar = $firstdaytoshow;
1461 if ($event->date_end_in_calendar >= $lastdaytoshow) {
1462 $event->date_end_in_calendar = ($lastdaytoshow - 1);
1466 $daycursor = $event->date_start_in_calendar;
1475 $daykey =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1476 $daykeygmt =
dol_mktime(0, 0, 0, $mois, $jour, $annee,
'gmt');
1479 $eventarray[$daykey][] = $event;
1480 $daykey += 60 * 60 * 24;
1481 $daykeygmt += 60 * 60 * 24;
1482 if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) {
1494$parameters = array();
1496$reshook = $hookmanager->executeHooks(
'getCalendarEvents', $parameters, $object, $action);
1497if (!empty($hookmanager->resArray[
'eventarray'])) {
1498 foreach ($hookmanager->resArray[
'eventarray'] as $keyDate => $events) {
1499 if (!isset($eventarray[$keyDate])) {
1500 $eventarray[$keyDate] = array();
1502 $eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
1514$cachethirdparties = array();
1515$cachecontacts = array();
1519 array(137, 86, 161),
1520 array(60, 147, 183),
1521 array(250, 190, 80),
1523 array(190, 190, 100),
1524 array(91, 115, 247),
1525 array(140, 140, 220),
1526 array(190, 120, 120),
1527 array(115, 125, 150),
1528 array(100, 170, 20),
1529 array(150, 135, 125),
1530 array(85, 135, 150),
1531 array(150, 135, 80),
1535$color_file = DOL_DOCUMENT_ROOT.
"/theme/".
$conf->theme.
"/theme_vars.inc.php";
1536if (is_readable($color_file)) {
1537 include $color_file;
1541$massactionbutton =
'';
1545print_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);
1553print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1554print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday,
'', (
string) $filtert,
'', $pid, $socid, $action, -1, $actioncode, $usergroup,
'', $resourceid, $search_categ_cus);
1559$newparam = preg_replace(
'/showbirthday=/i',
'showbirthday_=', $newparam);
1560$newparam = preg_replace(
'/mode=show_month&?/i',
'', $newparam);
1561$newparam = preg_replace(
'/mode=show_week&?/i',
'', $newparam);
1562$newparam = preg_replace(
'/day=[0-9]+&?/i',
'', $newparam);
1563$newparam = preg_replace(
'/month=[0-9]+&?/i',
'', $newparam);
1564$newparam = preg_replace(
'/year=[0-9]+&?/i',
'', $newparam);
1565$newparam = preg_replace(
'/viewweek=[0-9]+&?/i',
'', $newparam);
1566$newparam = preg_replace(
'/showbirthday_=/i',
'showbirthday=', $newparam);
1567$newparam .=
'&viewweek=1';
1569echo
'<input type="hidden" name="actionmove" value="mupdate">';
1570echo
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($_SERVER[
'PHP_SELF']).
'?'.
dol_escape_htmltag($_SERVER[
'QUERY_STRING']).
'">';
1571echo
'<input type="hidden" name="newdate" id="newdate">';
1578$currentdaytoshow = $firstdaytoshow;
1579echo
'<div class="div-table-responsive">';
1582$colorsbytype = array();
1584while ($currentdaytoshow < $lastdaytoshow) {
1585 echo
'<table class="centpercent noborder nocellnopadd cal_month cal_peruser listwithfilterbefore">';
1587 echo
'<tr class="liste_titre">';
1588 echo
'<td class="nopaddingtopimp nopaddingbottomimp nowraponsmartphone">';
1592 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleDaysRange").
'">';
1593 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block marginleftonly"');
1594 print $langs->trans(
"DaysOfWeek").
'</span>';
1596 print
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
1597 print
'<input type="number" class="shortbis" name="begin_d" value="'.$begin_d.
'" min="1" max="7">';
1598 if (empty(
$conf->dol_use_jmobile)) {
1601 print
'</div><div class="ui-block-b">';
1603 print
'<input type="number" class="shortbis" name="end_d" value="'.$end_d.
'" min="1" max="7">';
1604 print
'</div></div>';
1610 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1614 echo
'<td align="center" colspan="'.($end_h - $begin_h).
'">';
1615 echo
'<span class="bold spandayofweek">'.$langs->trans(
"Day".(($i +
getDolGlobalInt(
'MAIN_START_WEEK', 1)) % 7)).
'</span>';
1620 $valtoshow = $currentdaytoshow;
1623 echo
'<span class="badgeliketopmenu">';
1625 print
dol_print_date($valtoshow,
'dayreduceformat',
'tzuserrel');
1634 echo
'<tr class="liste_titre">';
1638 print
'<span class="hideonsmartphone" title="'.$langs->trans(
"VisibleTimeRange").
'">';
1639 print
img_picto(
'',
'clock',
'class="fawidth30 inline-block marginleftonly"');
1640 print $langs->trans(
"Hours").
'</span>';
1642 print
'<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
1643 print
'<input type="number" class="shortbis" name="begin_h" value="'.$begin_h.
'" min="0" max="23">';
1644 if (empty(
$conf->dol_use_jmobile)) {
1647 print
'</div><div class="ui-block-b">';
1649 print
'<input type="number" class="shortbis" name="end_h" value="'.$end_h.
'" min="1" max="24">';
1650 if (empty(
$conf->dol_use_jmobile)) {
1651 print
' '.$langs->trans(
"HourShort");
1653 print
'</div></div>';
1658 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1662 for ($h = $begin_h; $h < $end_h; $h++) {
1663 echo
'<td class="center">';
1664 print
'<small style="font-family: courier">'.sprintf(
"%02d", $h).
'</small>';
1674 $usernames = array();
1675 $usernamesid = array();
1678 foreach ($eventarray as $daykey => $notused) {
1680 foreach ($eventarray[$daykey] as $index => $event) {
1681 $event->fetch_userassigned();
1682 $listofuserid = $event->userassigned;
1683 foreach ($listofuserid as $userid => $tmp) {
1684 if (!in_array($userid, $usernamesid)) {
1685 $usernamesid[$userid] = $userid;
1692 $sql =
"SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
1693 $sql .=
" FROM ".$db->prefix().
"user as u";
1695 $sql .=
" WHERE u.rowid IN (";
1696 $sql .=
" SELECT ug.fk_user FROM ".$db->prefix().
"usergroup_user as ug";
1697 $sql .=
" WHERE ug.entity IN (".getEntity(
'usergroup').
")";
1698 if ($usergroup > 0) {
1699 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1703 if ($usergroup > 0) {
1704 $sql .=
" LEFT JOIN ".$db->prefix().
"usergroup_user as ug ON u.rowid = ug.fk_user";
1706 $sql .=
" WHERE u.entity IN (".getEntity(
'user').
")";
1707 if ($usergroup > 0) {
1708 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1711 $sql .=
" AND u.statut = 1";
1713 $sql .=
" AND u.rowid = ".((int) $filtert);
1715 if ($usergroup > 0) {
1716 $sql .=
" AND ug.fk_usergroup = ".((int) $usergroup);
1718 if ($user->socid > 0) {
1720 $sql .=
" AND u.fk_soc = ".((int) $user->socid);
1723 if (!$canedit || $filtert ==
'-3') {
1724 if (!$user->hasRight(
'user',
'user',
'lire') || $filtert ==
'-3') {
1725 $usersInHierarchy = $user->getAllChildIds(1);
1726 $sql .=
" AND u.rowid IN (".$db->sanitize(implode(
',', $usersInHierarchy)).
")";
1731 $resql =
$db->query($sql);
1733 $num =
$db->num_rows($resql);
1737 $obj =
$db->fetch_object($resql);
1738 $usernamesid[$obj->rowid] = $obj->rowid;
1747 foreach ($usernamesid as
$id) {
1749 $result = $tmpuser->fetch(
$id);
1750 $usernames[] = $tmpuser;
1754 $labelbytype = array();
1755 $sql =
"SELECT code, color, libelle as label FROM ".MAIN_DB_PREFIX.
"c_actioncomm ORDER BY position";
1756 $resql =
$db->query($sql);
1757 while ($obj =
$db->fetch_object($resql)) {
1758 $colorsbytype[$obj->code] = $obj->color;
1759 $labelbytype[$obj->code] = $obj->label;
1767 foreach ($usernames as $username) {
1773 echo
'<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var ?
' cal_impair' :
'').
' nopaddingtopimp nopaddingbottomimp noheightimp">';
1774 print
'<span class="paddingrightimp">';
1775 print $username->getNomUrl(-1,
'', 0, 0, 20, 1,
'',
'paddingleft');
1782 for ($iter_day = 0; $iter_day < 8; $iter_day++) {
1783 if (($i + 1) < $begin_d || ($i + 1) > $end_d) {
1796 $style =
'cal_current_month';
1797 if ($iter_day == 6) {
1798 $style .=
' cal_other_month';
1801 if ($todayarray[
'mday'] == $tmpday && $todayarray[
'mon'] == $tmpmonth && $todayarray[
'year'] == $tmpyear) {
1805 $style =
'cal_today_peruser';
1808 show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, 0, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
1813 $showheader =
false;
1825 $langs->load(
"commercial");
1826 print
'<br>'.$langs->trans(
"Legend").
': <br>';
1827 foreach ($colorsbytype as $code => $color) {
1829 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #'.$color.
'; width:16px; float: left; margin-right: 4px;"> </div>';
1830 print $langs->trans(
"Action".$code) !=
"Action".$code ? $langs->trans(
"Action".$code) : $labelbytype[$code];
1836 print
'<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
1837 print $langs->trans(
"Other");
1846print
"\n".
'</form>';
1851print
'<script type="text/javascript">
1852jQuery(document).ready(function() {
1853 jQuery(".onclickopenref").click(function() {
1854 var ref=$(this).attr(\'ref\');
1855 var res = ref.split("_");
1857 var userid = res[1];
1865 console.log("We click on a class onclickopenref in page peruser with ref="+ref+" type="+type);
1867 if (ids == \'none\') /* No event */
1869 /* alert(\'no event\'); */
1870 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 :
'')).
'"
1871 window.location.href = url;
1873 else if (ids.indexOf(",") > -1) /* There is several events */
1875 /* alert(\'several events\'); */
1876 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;
1877 window.location.href = url;
1878 } else { /* One event */
1879 /* alert(\'one event\'); */
1880 if (type == \'holiday\') {
1881 url = "'.DOL_URL_ROOT.
'/holiday/card.php?id="+ids
1883 url = "'.DOL_URL_ROOT.
'/comm/action/card.php?action=view&id="+ids
1885 window.location.href = url;
1918function 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)
1921 global $user,
$conf, $langs, $hookmanager, $action;
1922 global $filter, $filtert, $status, $actioncode;
1924 global $cachethirdparties, $cachecontacts,
$cacheusers, $cacheprojects, $colorindexused;
1925 global $begin_h, $end_h;
1939 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases1
1940 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases2
1941 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases3
1942 @phan-var-force array<int,array<int,array<string,string|int|bool>>> $cases4
1949 $numicals = array();
1952 $colorindexused[$user->id] = 0;
1953 $nextindextouse = count($colorindexused);
1960 foreach ($eventarray as $daykey => $notused) {
1967 if ($day == $jour && (
int) $month == $mois && $year == $annee) {
1971 foreach ($eventarray[$daykey] as $index => $event) {
1975 $keysofuserassigned = array_keys($event->userassigned);
1977 if (!in_array($username->id, $keysofuserassigned)) {
1982 $parameters = array();
1983 $reshook = $hookmanager->executeHooks(
'formatEvent', $parameters, $event, $action);
1993 if ($event->type_code ==
'HOLIDAY') {
1994 $cssclass =
'family_holiday';
1997 if (in_array($user->id, $keysofuserassigned)) {
1998 $cssclass =
'family_mytasks';
2000 if (empty($cacheusers[$event->userownerid])) {
2002 $newuser->fetch($event->userownerid);
2008 if (!empty($cacheusers[$event->userownerid]->color)) {
2013 $color = $event->type_color;
2015 } elseif ($event->type_code ==
'ICALEVENT') {
2017 if (!empty($event->icalname)) {
2024 $color = $event->icalcolor;
2025 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other unsortable');
2026 } elseif ($event->type_code ==
'BIRTHDAY') {
2029 $cssclass =
'family_birthday unsortable';
2030 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2033 $color = ($event->icalcolor ? $event->icalcolor : -1);
2034 $cssclass = (!empty($event->icalname) ?
'family_ext'.md5($event->icalname) :
'family_other');
2036 if (empty($cacheusers[$event->userownerid])) {
2038 $newuser->fetch($event->userownerid);
2044 if (!empty($cacheusers[$event->userownerid]->color)) {
2049 $color = $event->type_color;
2055 $idusertouse = ($event->userownerid ? $event->userownerid : 0);
2056 if (isset($colorindexused[$idusertouse])) {
2057 $colorindex = $colorindexused[$idusertouse];
2059 $colorindex = $nextindextouse;
2060 $colorindexused[$idusertouse] = $colorindex;
2061 if (!empty($theme_datacolor[$nextindextouse + 1])) {
2066 $color = sprintf(
"%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]);
2070 for ($h = $begin_h; $h < $end_h; $h++) {
2073 if (empty($event->fulldayevent)) {
2074 $a =
dol_mktime((
int) $h, 0, 0, $month, $day, $year,
'tzuserrel', 0);
2075 $b =
dol_mktime((
int) $h, 15, 0, $month, $day, $year,
'tzuserrel', 0);
2076 $b1 =
dol_mktime((
int) $h, 30, 0, $month, $day, $year,
'tzuserrel', 0);
2077 $b2 =
dol_mktime((
int) $h, 45, 0, $month, $day, $year,
'tzuserrel', 0);
2078 $c =
dol_mktime((
int) $h + 1, 0, 0, $month, $day, $year,
'tzuserrel', 0);
2080 $dateendtouse = $event->date_end_in_calendar;
2081 if ($dateendtouse == $event->date_start_in_calendar) {
2086 if ($event->date_start_in_calendar < $b && $dateendtouse > $a) {
2087 $busy = $event->transparency;
2088 $cases1[$h][$event->id][
'busy'] = $busy;
2089 $cases1[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2090 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2091 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2092 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2093 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2094 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2096 $cases1[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2099 if ($event->label) {
2100 $cases1[$h][$event->id][
'string'] .=
' - '.$event->label;
2102 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
2103 if ($event->type_code ==
'HOLIDAY') {
2104 $cases1[$h][$event->id][
'css'] =
'peruser_holiday ';
2106 $cases1[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2109 $cases1[$h][$event->id][
'color'] = $color;
2111 if ($event->fk_project > 0) {
2112 if (empty($cacheprojects[$event->fk_project])) {
2114 $tmpproj->fetch($event->fk_project);
2115 $cacheprojects[$event->fk_project] = $tmpproj;
2117 $cases1[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2119 if ($event->socid > 0) {
2120 if (empty($cachethirdparties[$event->socid])) {
2122 $tmpthirdparty->fetch($event->socid);
2123 $cachethirdparties[$event->socid] = $tmpthirdparty;
2125 $cases1[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2127 if ($event->contact_id > 0) {
2128 if (empty($cachecontacts[$event->contact_id])) {
2130 $tmpcontact->fetch($event->contact_id);
2131 $cachecontacts[$event->contact_id] = $tmpcontact;
2133 $cases1[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2137 if ($event->date_start_in_calendar < $b1 && $dateendtouse > $b) {
2138 $busy = $event->transparency;
2139 $cases2[$h][$event->id][
'busy'] = $busy;
2140 $cases2[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2141 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2142 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2143 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2144 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2145 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2147 $cases2[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2150 if ($event->label) {
2151 $cases2[$h][$event->id][
'string'] .=
' - '.$event->label;
2153 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
2154 if ($event->type_code ==
'HOLIDAY') {
2155 $cases2[$h][$event->id][
'css'] =
'peruser_holiday ';
2157 $cases2[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2160 $cases2[$h][$event->id][
'color'] = $color;
2162 if ($event->fk_project > 0) {
2163 if (empty($cacheprojects[$event->fk_project])) {
2165 $tmpproj->fetch($event->fk_project);
2166 $cacheprojects[$event->fk_project] = $tmpproj;
2168 $cases2[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2170 if ($event->socid > 0) {
2171 if (empty($cachethirdparties[$event->socid])) {
2173 $tmpthirdparty->fetch($event->socid);
2174 $cachethirdparties[$event->socid] = $tmpthirdparty;
2176 $cases2[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2178 if ($event->contact_id > 0) {
2179 if (empty($cachecontacts[$event->contact_id])) {
2181 $tmpcontact->fetch($event->contact_id);
2182 $cachecontacts[$event->contact_id] = $tmpcontact;
2184 $cases2[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2188 if ($event->date_start_in_calendar < $b2 && $dateendtouse > $b1) {
2189 $busy = $event->transparency;
2190 $cases3[$h][$event->id][
'busy'] = $busy;
2191 $cases3[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2192 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2193 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2194 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2195 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2196 $cases3[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2198 $cases3[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2201 if ($event->label) {
2202 $cases3[$h][$event->id][
'string'] .=
' - '.$event->label;
2204 $cases3[$h][$event->id][
'typecode'] = $event->type_code;
2205 if ($event->type_code ==
'HOLIDAY') {
2206 $cases3[$h][$event->id][
'css'] .=
'peruser_holiday ';
2208 $cases3[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2211 $cases3[$h][$event->id][
'color'] = $color;
2213 if ($event->fk_project > 0) {
2214 if (empty($cacheprojects[$event->fk_project])) {
2216 $tmpproj->fetch($event->fk_project);
2217 $cacheprojects[$event->fk_project] = $tmpproj;
2219 $cases3[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2221 if ($event->socid > 0) {
2222 if (empty($cachethirdparties[$event->socid])) {
2224 $tmpthirdparty->fetch($event->socid);
2225 $cachethirdparties[$event->socid] = $tmpthirdparty;
2227 $cases3[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2229 if ($event->contact_id > 0) {
2230 if (empty($cachecontacts[$event->contact_id])) {
2232 $tmpcontact->fetch($event->contact_id);
2233 $cachecontacts[$event->contact_id] = $tmpcontact;
2235 $cases3[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2239 if ($event->date_start_in_calendar <
$c && $dateendtouse > $b2) {
2240 $busy = $event->transparency;
2241 $cases4[$h][$event->id][
'busy'] = $busy;
2242 $cases4[$h][$event->id][
'string'] =
dol_print_date($event->date_start_in_calendar,
'dayhour',
'tzuserrel');
2243 if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar) {
2244 $tmpa =
dol_getdate($event->date_start_in_calendar,
true);
2245 $tmpb =
dol_getdate($event->date_end_in_calendar,
true);
2246 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
2247 $cases4[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'hour',
'tzuserrel');
2249 $cases4[$h][$event->id][
'string'] .=
'-'.dol_print_date($event->date_end_in_calendar,
'dayhour',
'tzuserrel');
2252 if ($event->label) {
2253 $cases4[$h][$event->id][
'string'] .=
' - '.$event->label;
2255 $cases4[$h][$event->id][
'typecode'] = $event->type_code;
2256 if ($event->type_code ==
'HOLIDAY') {
2257 $cases4[$h][$event->id][
'css'] =
'peruser_holiday ';
2259 $cases4[$h][$event->id][
'css'] .=
'peruser_holiday_imp ';
2262 $cases4[$h][$event->id][
'color'] = $color;
2264 if ($event->fk_project > 0) {
2265 if (empty($cacheprojects[$event->fk_project])) {
2267 $tmpproj->fetch($event->fk_project);
2268 $cacheprojects[$event->fk_project] = $tmpproj;
2270 $cases4[$h][$event->id][
'string'] .=
', '.$langs->trans(
"Project").
': '.$cacheprojects[$event->fk_project]->ref.
' - '.$cacheprojects[$event->fk_project]->title;
2272 if ($event->socid > 0) {
2273 if (empty($cachethirdparties[$event->socid])) {
2275 $tmpthirdparty->fetch($event->socid);
2276 $cachethirdparties[$event->socid] = $tmpthirdparty;
2278 $cases4[$h][$event->id][
'string'] .=
', '.$cachethirdparties[$event->socid]->name;
2280 if ($event->contact_id > 0) {
2281 if (empty($cachecontacts[$event->contact_id])) {
2283 $tmpcontact->fetch($event->contact_id);
2284 $cachecontacts[$event->contact_id] = $tmpcontact;
2286 $cases4[$h][$event->id][
'string'] .=
', '.$cachecontacts[$event->contact_id]->getFullName($langs);
2291 $busy = $event->transparency;
2292 $cases1[$h][$event->id][
'busy'] = $busy;
2293 $cases2[$h][$event->id][
'busy'] = $busy;
2294 $cases3[$h][$event->id][
'busy'] = $busy;
2295 $cases4[$h][$event->id][
'busy'] = $busy;
2296 $cases1[$h][$event->id][
'string'] = $event->label;
2297 $cases2[$h][$event->id][
'string'] = $event->label;
2298 $cases3[$h][$event->id][
'string'] = $event->label;
2299 $cases4[$h][$event->id][
'string'] = $event->label;
2300 $cases1[$h][$event->id][
'typecode'] = $event->type_code;
2301 $cases2[$h][$event->id][
'typecode'] = $event->type_code;
2302 $cases3[$h][$event->id][
'typecode'] = $event->type_code;
2303 $cases4[$h][$event->id][
'typecode'] = $event->type_code;
2304 $cases1[$h][$event->id][
'color'] = $color;
2305 $cases2[$h][$event->id][
'color'] = $color;
2306 $cases3[$h][$event->id][
'color'] = $color;
2307 $cases4[$h][$event->id][
'color'] = $color;
2308 $cases1[$h][$event->id][
'css'] =
'';
2309 $cases2[$h][$event->id][
'css'] =
'';
2310 $cases3[$h][$event->id][
'css'] =
'';
2311 $cases4[$h][$event->id][
'css'] =
'';
2322 for ($h = $begin_h; $h < $end_h; $h++) {
2327 $style1 =
'onclickopenref ';
2328 $style2 =
'onclickopenref ';
2329 $style3 =
'onclickopenref ';
2330 $style4 =
'onclickopenref ';
2331 $string1 =
' ';
2332 $string2 =
' ';
2333 $string3 =
' ';
2334 $string4 =
' ';
2339 if (isset($cases1[$h])) {
2341 if (count($cases1[$h]) > 1) {
2342 $title1 .= count($cases1[$h]).
' '.(count($cases1[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2345 $peruserbusyadded = 0;
2346 $perusernotbusyadded = 0;
2347 foreach ($cases1[$h] as
$id => $ev) {
2348 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2349 $style1 .= $peruserbusyadded ?
'' :
' peruser_busy';
2350 $peruserbusyadded++;
2352 $style1 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2353 $perusernotbusyadded++;
2355 if (!empty($ev[
'css'])) {
2356 $style1 .= $ev[
'css'].
' ';
2360 if (isset($cases2[$h])) {
2362 if (count($cases2[$h]) > 1) {
2363 $title2 .= count($cases2[$h]).
' '.(count($cases2[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2366 $peruserbusyadded = 0;
2367 $perusernotbusyadded = 0;
2368 foreach ($cases2[$h] as
$id => $ev) {
2369 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2370 $style2 .= $peruserbusyadded ?
'' :
' peruser_busy';
2371 $peruserbusyadded++;
2373 $style2 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2374 $perusernotbusyadded++;
2376 if (!empty($ev[
'css'])) {
2377 $style2 .= $ev[
'css'].
' ';
2381 if (isset($cases3[$h])) {
2383 if (count($cases3[$h]) > 1) {
2384 $title3 .= count($cases3[$h]).
' '.(count($cases3[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2387 $peruserbusyadded = 0;
2388 $perusernotbusyadded = 0;
2389 foreach ($cases3[$h] as
$id => $ev) {
2390 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2391 $style3 .= $peruserbusyadded ?
'' :
' peruser_busy';
2392 $peruserbusyadded++;
2394 $style3 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2395 $perusernotbusyadded++;
2397 if (!empty($ev[
'css'])) {
2398 $style3 .= $ev[
'css'].
' ';
2402 if (isset($cases4[$h])) {
2404 if (count($cases4[$h]) > 1) {
2405 $title4 .= count($cases4[$h]).
' '.(count($cases4[$h]) == 1 ? $langs->trans(
"Event") : $langs->trans(
"Events"));
2408 $peruserbusyadded = 0;
2409 $perusernotbusyadded = 0;
2410 foreach ($cases4[$h] as
$id => $ev) {
2411 if (!empty($ev[
'busy']) && !
getDolGlobalString(
'AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) {
2412 $style4 .= $peruserbusyadded ?
'' :
' peruser_busy';
2413 $peruserbusyadded++;
2415 $style4 .= $perusernotbusyadded ?
'' :
'peruser_notbusy ';
2416 $perusernotbusyadded++;
2418 if (!empty($ev[
'css'])) {
2419 $style4 .= $ev[
'css'].
' ';
2428 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
2429 $ids1 = implode(
', ', array_keys($cases1[$h]));
2431 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
2432 $ids2 = implode(
', ', array_keys($cases2[$h]));
2434 if (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) && array_keys($cases3[$h])) {
2435 $ids3 = implode(
',', array_keys($cases3[$h]));
2437 if (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) && array_keys($cases4[$h])) {
2438 $ids4 = implode(
',', array_keys($cases4[$h]));
2441 if ($h == $begin_h) {
2442 echo
'<td class="'.$style.
'_peruserleft cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
2444 echo
'<td class="'.$style.
' cal_peruser'.($var ?
' cal_impair '.$style.
'_impair' :
'').
'">';
2449 if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) == 1) {
2450 $output = array_slice($cases1[$h], 0, 1);
2451 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2453 $title1 = $langs->trans(
"Holiday");
2455 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
2456 if ($output[0][
'string']) {
2457 $title1 .=
' - '.$output[0][
'string'];
2460 if ($output[0][
'color']) {
2461 $color1 = $output[0][
'color'];
2463 } elseif (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) > 1) {
2464 $title1 = $langs->trans(
"Ref").
' '.$ids1.($title1 ?
' - '.$title1 :
'');
2470 if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) == 1) {
2471 $output = array_slice($cases2[$h], 0, 1);
2472 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2474 $title2 = $langs->trans(
"Holiday");
2476 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
2477 if ($output[0][
'string']) {
2478 $title2 .=
' - '.$output[0][
'string'];
2481 if ($output[0][
'color']) {
2482 $color2 = $output[0][
'color'];
2484 } elseif (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) > 1) {
2485 $title2 = $langs->trans(
"Ref").
' '.$ids2.($title2 ?
' - '.$title2 :
'');
2491 if (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) == 1) {
2492 $output = array_slice($cases3[$h], 0, 1);
2493 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2495 $title3 = $langs->trans(
"Holiday");
2497 $title3 = $langs->trans(
"Ref").
' '.$ids3.($title3 ?
' - '.$title3 :
'');
2498 if ($output[0][
'string']) {
2499 $title3 .=
' - '.$output[0][
'string'];
2502 if ($output[0][
'color']) {
2503 $color3 = $output[0][
'color'];
2505 } elseif (!empty($cases3[$h]) && is_array($cases3[$h]) && count($cases3[$h]) > 1) {
2506 $title3 = $langs->trans(
"Ref").
' '.$ids3.($title3 ?
' - '.$title3 :
'');
2512 if (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) == 1) {
2513 $output = array_slice($cases4[$h], 0, 1);
2514 if ($output[0][
'typecode'] ==
'HOLIDAY') {
2516 $title4 = $langs->trans(
"Holiday");
2518 $title4 = $langs->trans(
"Ref").
' '.$ids4.($title4 ?
' - '.$title4 :
'');
2519 if ($output[0][
'string']) {
2520 $title4 .=
' - '.$output[0][
'string'];
2523 if ($output[0][
'color']) {
2524 $color4 = $output[0][
'color'];
2526 } elseif (!empty($cases4[$h]) && is_array($cases4[$h]) && count($cases4[$h]) > 1) {
2527 $title4 = $langs->trans(
"Ref").
' '.$ids4.($title4 ?
' - '.$title4 :
'');
2531 print
'<table class="nobordernopadding case centpercent">';
2534 if (preg_match(
'/peruser_notbusy/', $style1)) {
2535 print
'style="border: 1px solid #'.($color1 ? $color1 :
"888").
' !important" ';
2536 } elseif ($color1) {
2537 print
'style="background: #'.$color1.
'; "';
2541 print
'center'.($title1 ?
' classfortooltip' :
'').($title1 ?
' cursorpointer' :
'').
'"';
2542 print
'ref="'.$ref1.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_00_'.($ids1 ? $ids1 :
'none').
'"';
2543 print ($title1 ?
' title="'.$title1.
'"' :
'').
'>';
2548 if (preg_match(
'/peruser_notbusy/', $style2)) {
2549 print
'style="border: 1px solid #'.($color2 ? $color2 :
"888").
' !important" ';
2550 } elseif ($color2) {
2551 print
'style="background: #'.$color2.
'; "';
2555 print
'center'.($title2 ?
' classfortooltip' :
'').($title2 ?
' cursorpointer' :
'').
'"';
2556 print
' ref="'.$ref2.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_15_'.($ids2 ? $ids2 :
'none').
'"';
2557 print ($title2 ?
' title="'.$title2.
'"' :
'').
'>';
2562 if (preg_match(
'/peruser_notbusy/', $style3)) {
2563 print
'style="border: 1px solid #'.($color3 ? $color3 :
"888").
' !important" ';
2564 } elseif ($color3) {
2565 print
'style="background: #'.$color3.
'; "';
2569 print
'center'.($title3 ?
' classfortooltip' :
'').($title3 ?
' cursorpointer' :
'').
'"';
2570 print
' ref="'.$ref3.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_30_'.($ids3 ? $ids3 :
'none').
'"';
2571 print ($title3 ?
' title="'.$title3.
'"' :
'').
'>';
2576 if (preg_match(
'/peruser_notbusy/', $style4)) {
2577 print
'style="border: 1px solid #'.($color4 ? $color4 :
"888").
' !important" ';
2578 } elseif ($color4) {
2579 print
'style="background: #'.$color4.
'; "';
2583 print
'center'.($title4 ?
' classfortooltip' :
'').($title4 ?
' cursorpointer' :
'').
'"';
2584 print
' ref="'.$ref4.
'_'.$username->id.
'_'.sprintf(
"%04d", $year).
'_'.sprintf(
"%02d", $month).
'_'.sprintf(
"%02d", $day).
'_'.sprintf(
"%02d", $h).
'_45_'.($ids4 ? $ids4 :
'none').
'"';
2585 print ($title4 ?
' title="'.$title4.
'"' :
'').
'>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
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.
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_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
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.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
conf($dolibarr_main_document_root)
Load conf file (file must exists)
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
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, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.