Skip to content

ICS export does not include RRULE / EXDATE for recurring planning events #19798

Open
JeremieMercier/glpi
#1
@JeremieMercier

Description

@JeremieMercier

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.18

Bug description

The ICS export generated by GLPI planning misses recurrence data :

  • No RRULE is written, so a recurring event is exported as a single occurrence.
  • EXDATE lines (date exceptions) are also absent.

Relevant log output

Page URL

No response

Steps To reproduce

Steps to reproduce

  • Create a recurring planning event (e.g., weekly, every 3 weeks).
  • Optionally add one or more exception dates.
  • Export the calendar via Export → Ical.
  • Open the downloaded .ics: the VEVENT block has no RRULE or EXDATE.

Your GLPI setup information

No response

Anything else?

Quick fix that works for me

Edit src/Planning.php, method generateIcal().
Right after you finish building $vevent and just before you call
$vcalendar->add('VEVENT', $vevent); add :

line 2748

// RRULE
if (!empty($val['rrule'])) {
    $parts = [];
    foreach ($val['rrule'] as $k => $v) {

        if ($v === '' || $v === null) {
            continue;
        }

        // EXDATE
        if ($k === 'exceptions') {
            $exceptions = array_unique($v);
            $exceptions = array_map(
                static fn ($date) => str_replace('-', '', $date),
                $exceptions
            );
            $vevent['EXDATE;VALUE=DATE'] = $exceptions;
            continue;
        }

        if ($k === 'until') {
            $v = str_replace('-', '', $v);
        }

        $parts[] = strtoupper($k) . '=' . strtoupper($v);
    }
    if ($parts) {
        $vevent['RRULE'] = implode(';', $parts);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions