Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 25 Aug 2015 16:12:08 +0000 (18:12 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 25 Aug 2015 16:12:08 +0000 (18:12 +0200)
tests/tine20/Calendar/Controller/RecurTest.php
tests/tine20/Calendar/Convert/Event/VCalendar/MacOSXTest.php
tine20/Calendar/Model/Event.php

index 3f92702..d813a46 100644 (file)
@@ -549,7 +549,41 @@ class Calendar_Controller_RecurTest extends Calendar_TestCase
             new Tinebase_DateTime('2011-04-27 12:00:00'),
         )), 'dtstart of new series');
     }
-    
+
+    public function testCreateRecurExceptionAllFollowingAllDay()
+    {
+        $from = new Tinebase_DateTime('2015-07-01 00:00:00');
+        $until = new Tinebase_DateTime('2015-09-29 23:59:59');
+
+        $event = new Calendar_Model_Event(array(
+            'summary'           => 'Mettwoch',
+            'dtstart'           => '2015-02-10 23:00:00',
+            'dtend'             => '2015-02-11 22:59:59',
+            'is_all_day_event'  => 1,
+            'description'       => '2 Pfund Mett. 15 Brotchen. 1ne Zwiebel',
+            'rrule'             => 'FREQ=MONTHLY;INTERVAL=1;BYDAY=2WE',
+            'container_id'      => method_exists($this, '_getTestCalendar') ?
+                $this->_getTestCalendar()->getId() :
+                $this->_testCalendar->getId(),
+            'attendee'          => $this->_getAttendee(),
+        ));
+
+        $persistentEvent = $this->_controller->create($event);
+
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+        $recurSet = Calendar_Model_Rrule::computeRecurrenceSet($persistentEvent, $exceptions, $from, $until);
+
+        $recurSet[1]->description = '4 Pfund Mett. 15 Brotchen. 2 Zwiebeln';
+        $newBaseEvent = $this->_controller->createRecurException($recurSet[1], FALSE, TRUE);
+
+        $oldBaseEvent = $this->_controller->get($persistentEvent->getId());
+        $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
+        $oldRecurSet = Calendar_Model_Rrule::computeRecurrenceSet($oldBaseEvent, $exceptions, $from, $until);
+
+        $this->assertCount(1, $oldRecurSet, 'one event should be left in given period ');
+        $this->assertEquals('2015-07-07 22:00:00', $oldRecurSet[0]->dtstart);
+    }
+
     /**
      * if not resheduled, attendee status must be preserved
      */
index ade3009..36091d1 100644 (file)
@@ -114,7 +114,7 @@ class Calendar_Convert_Event_VCalendar_MacOSXTest extends Calendar_TestCase
         $updateEvent2 = $converter->toTine20Model($vcalendarStream2, $eventWithExdateOnBaseEvent);
 
         $this->assertEquals(1, count($updateEvent2->exdate), print_r($updateEvent2->toArray(), true));
-        $this->assertEquals('2015-04-27 21:59:59', $updateEvent2->rrule_until);
+        $this->assertEquals('2015-04-27 22:00:00', $updateEvent2->rrule_until);
     }
 
     public function testConvertToTine20ModelYosemite()
index a43b4d8..eb95ac6 100644 (file)
@@ -513,7 +513,7 @@ class Calendar_Model_Event extends Tinebase_Record_Abstract
                 // NOTE: this is in contrast to the iCal spec which says until should be the
                 //       dtstart of the last occurence. But as the client with the name of the
                 //       spec sets it to the end of the day, we do it also.
-                if ($rrule->until instanceof Tinebase_DateTime) {
+                if ($rrule->until instanceof Tinebase_DateTime && !$this->is_all_day_event) {
                     $rrule->until->setTimezone($this->originator_tz);
                     // NOTE: subSecond cause some clients send 00:00:00 for midnight
                     $rrule->until->subSecond(1)->setTime(23, 59, 59);