glpi icon indicating copy to clipboard operation
glpi copied to clipboard

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

Open JeremieMercier opened this issue 7 months ago • 2 comments

Code of Conduct

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

Is there an existing issue for this?

  • [x] 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);
    }
}

JeremieMercier avatar May 23 '25 19:05 JeremieMercier

Feel free to open a pull request with your changes.

cconard96 avatar May 25 '25 13:05 cconard96

sorry

JeremieMercier avatar May 25 '25 22:05 JeremieMercier