Fix loading of birthday events in December when range spans over two years (#4920)
This commit is contained in:
parent
a67881cd8c
commit
f4531102a2
1 changed files with 4 additions and 3 deletions
|
@ -693,18 +693,19 @@ abstract class calendar_driver
|
||||||
// quick-and-dirty recurrence computation: just replace the year
|
// quick-and-dirty recurrence computation: just replace the year
|
||||||
$bday->setDate($year, $bday->format('n'), $bday->format('j'));
|
$bday->setDate($year, $bday->format('n'), $bday->format('j'));
|
||||||
$bday->setTime(12, 0, 0);
|
$bday->setTime(12, 0, 0);
|
||||||
|
$this_year = $year;
|
||||||
|
|
||||||
// date range reaches over multiple years: use end year if not in range
|
// date range reaches over multiple years: use end year if not in range
|
||||||
if (($bday > $end || $bday < $start) && $year2 != $year) {
|
if (($bday > $end || $bday < $start) && $year2 != $year) {
|
||||||
$bday->setDate($year2, $bday->format('n'), $bday->format('j'));
|
$bday->setDate($year2, $bday->format('n'), $bday->format('j'));
|
||||||
$year = $year2;
|
$this_year = $year2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// birthday is within requested range
|
// birthday is within requested range
|
||||||
if ($bday <= $end && $bday >= $start) {
|
if ($bday <= $end && $bday >= $start) {
|
||||||
$age = $year - $birthyear;
|
$age = $this_year - $birthyear;
|
||||||
$event = array(
|
$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,
|
'calendar' => self::BIRTHDAY_CALENDAR_ID,
|
||||||
'title' => $event_title,
|
'title' => $event_title,
|
||||||
'description' => $rcmail->gettext(array('name' => 'birthdayage', 'vars' => array('age' => $age)), 'calendar'),
|
'description' => $rcmail->gettext(array('name' => 'birthdayage', 'vars' => array('age' => $age)), 'calendar'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue