Commit 06a458d1 authored by MAGENE Sem Joel's avatar MAGENE Sem Joel
Browse files

[BP][FIX] Calendar: fix undefined session-key warnings and null-description deprecations

```yaml:frontmatter
* [BP][FIX] Calendar: fix undefined session-key warnings and null-description deprecations
```
* [FIX] Calendar: fix undefined session-key warnings and null-description deprecations
---
* [FIX] Calendar: fix undefined session-key warnings and null-description deprecations

See merge request !10406

(cherry picked from commit c45c8afb)

See merge request !10410

(cherry picked from commit f5e520ee)

See merge request !10411
parent c5146065
Loading
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -686,6 +686,9 @@ class CalendarLib extends TikiLib
        $res = $result->fetchRow();

        if ($res) {
            if ($res['description'] === null) {
                $res['description'] = '';
            }
            $query
                = "select `username`, `role`, `partstat`, `comment` from `tiki_calendar_roles` where `calitemId`=? order by `role`";
            $rezult = $this->query($query, [(int)$calitemId]);
@@ -872,6 +875,10 @@ class CalendarLib extends TikiLib
        }

        $data['user'] = $user;
        // Enforce calendar-item invariant: description is always a string.
        if (! array_key_exists('description', $data) || $data['description'] === null) {
            $data['description'] = '';
        }

        $realcolumns = ['calitemId', 'calendarId', 'start', 'end', 'locationId', 'categoryId', 'nlId', 'priority', 'uri', 'uid',
                     'status', 'url', 'lang', 'name', 'description', 'user', 'created', 'lastmodif', 'allday', 'recurrenceId', 'changed', 'recurrenceStart', 'hideParticipants'];
+10 −4
Original line number Diff line number Diff line
@@ -116,6 +116,11 @@ function wikiplugin_calendar($data, $params)
        'view_calendar'
    );

    if (empty($rawcals['data'])) {
        Feedback::error(tra("You do not have permission to view the calendar"));
        return;
    }

    $focusdate = date("Y-m-d");
    switch ($params['viewmode']) {
        case 'week':
@@ -172,14 +177,15 @@ function wikiplugin_calendar($data, $params)
    }

    $checkedCalIds = [];
    if (is_array($_SESSION['PluginCalendarViewGroups'])) {
    $pluginCalendarViewGroups = $_SESSION['PluginCalendarViewGroups'] ?? null;
    if (is_array($pluginCalendarViewGroups)) {
        foreach ($calendars as $calendarId => $calendar) {
            if (in_array($calendarId, $_SESSION['PluginCalendarViewGroups'])) {
            if (in_array($calendarId, $pluginCalendarViewGroups)) {
                $checkedCalIds[] = $calendarId;
            }
        }
        $displayedcals = $_SESSION['PluginCalendarViewGroups'];
        $pluginCalendarIds = implode(',', $_SESSION['PluginCalendarViewGroups']);
        $displayedcals = $pluginCalendarViewGroups;
        $pluginCalendarIds = implode(',', $pluginCalendarViewGroups);
    } else {
        $displayedcals = $params['calIds'];
        $checkedCalIds = $params['calIds'];
+5 −4
Original line number Diff line number Diff line
@@ -197,14 +197,15 @@ function module_calendar_new($mod_reference, $module_params)
        }

        $checkedCalIds = [];
        if (is_array($_SESSION['ModuleCalendarViewGroups'])) {
        $moduleCalendarViewGroups = $_SESSION['ModuleCalendarViewGroups'] ?? null;
        if (is_array($moduleCalendarViewGroups)) {
            foreach ($calendars as $calendarId => $calendar) {
                if (in_array($calendarId, $_SESSION['ModuleCalendarViewGroups'])) {
                if (in_array($calendarId, $moduleCalendarViewGroups)) {
                    $checkedCalIds[] = $calendarId;
                }
            }
            $displayedcals = $_SESSION['ModuleCalendarViewGroups'];
            $moduleCalendarIds = implode(',', $_SESSION['ModuleCalendarViewGroups']);
            $displayedcals = $moduleCalendarViewGroups;
            $moduleCalendarIds = implode(',', $moduleCalendarViewGroups);
        } else {
            $displayedcals = $calIds;
            $checkedCalIds = $calIds;