From f4531102a27fd76149caa88fc6cb878a3378e001 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 31 Mar 2015 09:43:13 +0200 Subject: [PATCH] Fix loading of birthday events in December when range spans over two years (#4920) --- plugins/calendar/drivers/calendar_driver.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/calendar/drivers/calendar_driver.php b/plugins/calendar/drivers/calendar_driver.php index b25f1c54..32586666 100644 --- a/plugins/calendar/drivers/calendar_driver.php +++ b/plugins/calendar/drivers/calendar_driver.php @@ -693,18 +693,19 @@ abstract class calendar_driver // quick-and-dirty recurrence computation: just replace the year $bday->setDate($year, $bday->format('n'), $bday->format('j')); $bday->setTime(12, 0, 0); + $this_year = $year; // date range reaches over multiple years: use end year if not in range if (($bday > $end || $bday < $start) && $year2 != $year) { $bday->setDate($year2, $bday->format('n'), $bday->format('j')); - $year = $year2; + $this_year = $year2; } // birthday is within requested range if ($bday <= $end && $bday >= $start) { - $age = $year - $birthyear; + $age = $this_year - $birthyear; $event = array( - 'id' => rcube_ldap::dn_encode('bday:' . $source . ':' . $contact['ID'] . ':' . $year), + 'id' => rcube_ldap::dn_encode('bday:' . $source . ':' . $contact['ID'] . ':' . $this_year), 'calendar' => self::BIRTHDAY_CALENDAR_ID, 'title' => $event_title, 'description' => $rcmail->gettext(array('name' => 'birthdayage', 'vars' => array('age' => $age)), 'calendar'),