[Pkg-owncloud-commits] [php-sabre-vobject] 02/07: Alternative fix for #312. Extract the timezone, even when there's no master event.
David Prévot
taffit at moszumanska.debian.org
Wed Apr 27 18:03:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch 3
in repository php-sabre-vobject.
commit 1893ca87a4768243ec671201a97459c889bd67da
Author: Evert Pot <me at evertpot.com>
Date: Tue Apr 5 23:34:58 2016 -0400
Alternative fix for #312. Extract the timezone, even when there's no master event.
This fix uses the TZID from the RECURRENCE-ID to figure out the timezone. This is
more accurate than just grabbing the first VTIMEZONE. RECURRENCE-ID must always
be in the same timezone as DTSTART from the master event.
---
lib/ITip/Broker.php | 15 ++++++++++-----
.../BrokerTimezoneInParseEventInfoWithoutMasterTest.php | 2 +-
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 08a7a98..a72de4f 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -813,7 +813,8 @@ class Broker {
* 7. attendees
* 8. sequence
* 9. exdate
- * 10. timezone
+ * 10. timezone - strictly the timezone on which the recurrence rule is
+ * based on.
* 11. significantChangeHash
* 12. status
* @param VCalendar $calendar
@@ -826,7 +827,7 @@ class Broker {
$organizerName = null;
$organizerForceSend = null;
$sequence = null;
- $timezone = $calendar->VTIMEZONE ? $calendar->VTIMEZONE->getTimeZone() : null;
+ $timezone = null;
$status = null;
$organizerScheduleAgent = 'SERVER';
@@ -884,9 +885,13 @@ class Broker {
$status = strtoupper($vevent->STATUS->getValue());
}
- $recurId = isset($vevent->{'RECURRENCE-ID'})?$vevent->{'RECURRENCE-ID'}->getValue():'master';
- if ($recurId==='master') {
- $timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
+ $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master';
+ if (is_null($timezone)) {
+ if ($recurId === 'master') {
+ $timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
+ } else {
+ $timezone = $vevent->{'RECURRENCE-ID'}->getDateTime()->getTimeZone();
+ }
}
if(isset($vevent->ATTENDEE)) {
foreach($vevent->ATTENDEE as $attendee) {
diff --git a/tests/VObject/ITip/BrokerTimezoneInParseEventInfoWithoutMasterTest.php b/tests/VObject/ITip/BrokerTimezoneInParseEventInfoWithoutMasterTest.php
index fadebff..255a84e 100644
--- a/tests/VObject/ITip/BrokerTimezoneInParseEventInfoWithoutMasterTest.php
+++ b/tests/VObject/ITip/BrokerTimezoneInParseEventInfoWithoutMasterTest.php
@@ -71,7 +71,7 @@ ICS;
$reflectionMethod = new \ReflectionMethod($broker, 'parseEventInfo');
$reflectionMethod->setAccessible(true);
$data = $reflectionMethod->invoke($broker, $calendar);
-
+ $this->assertInstanceOf('DateTimeZone', $data['timezone']);
$this->assertEquals($data['timezone']->getName(), 'Europe/Minsk');
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-php/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list