[Pkg-owncloud-commits] [php-sabre-vobject] 13/25: Alternative fix for #312. Extract the timezone, even when there's no master event.

David Prévot taffit at moszumanska.debian.org
Thu Apr 7 01:41:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit f775d2dd0a6af1d33d99f56d700dcd6b4b435657
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                                         | 13 +++++++++----
 .../BrokerTimezoneInParseEventInfoWithoutMasterTest.php     |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/ITip/Broker.php b/lib/ITip/Broker.php
index 20139d1..effa743 100644
--- a/lib/ITip/Broker.php
+++ b/lib/ITip/Broker.php
@@ -820,7 +820,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
@@ -834,7 +835,7 @@ class Broker {
         $organizerName = null;
         $organizerForceSend = null;
         $sequence = null;
-        $timezone = $calendar->VTIMEZONE ? $calendar->VTIMEZONE->getTimeZone() : null;
+        $timezone = null;
         $status = null;
         $organizerScheduleAgent = 'SERVER';
 
@@ -893,8 +894,12 @@ class Broker {
             }
 
             $recurId = isset($vevent->{'RECURRENCE-ID'}) ? $vevent->{'RECURRENCE-ID'}->getValue() : 'master';
-            if ($recurId === 'master') {
-                $timezone = $vevent->DTSTART->getDateTime()->getTimeZone();
+            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