VEVENT converter: rrule until on the same day as event
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 18 Aug 2014 12:46:17 +0000 (14:46 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 4 Sep 2014 09:26:42 +0000 (11:26 +0200)
* cope with one second difference at day-end which
  gets normalized later in the flow

Change-Id: Ie98132fb2f8874245d665a3a426121bdcde6e941
Reviewed-on: http://gerrit.tine20.com/customers/1010
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Convert/Event/VCalendar/GenericTest.php
tests/tine20/Calendar/Import/files/rrule_until_at_dtstart_allday.ics [new file with mode: 0644]
tine20/Calendar/Model/Event.php

index fc7ce7b..070a6e9 100644 (file)
@@ -688,6 +688,16 @@ class Calendar_Convert_Event_VCalendar_GenericTest extends PHPUnit_Framework_Tes
     }
     
     /**
+     * testRruleUntilAtDtstartForAllDayEvent
+     */
+    public function testRruleUntilAtDtstartForAllDayEvent()
+    {
+        $savedEvent = $this->_saveIcsEvent('rrule_until_at_dtstart_allday.ics');
+        
+        $this->assertTrue(true, 'no exception should be thrown ;-)');
+    }
+    
+    /**
      * testLongLocation
      */
     public function testLongLocation()
diff --git a/tests/tine20/Calendar/Import/files/rrule_until_at_dtstart_allday.ics b/tests/tine20/Calendar/Import/files/rrule_until_at_dtstart_allday.ics
new file mode 100644 (file)
index 0000000..c521f7d
--- /dev/null
@@ -0,0 +1,54 @@
+BEGIN:VCALENDAR
+PRODID:-//BusyMac LLC//BusyCal 2.5.4//DE
+VERSION:2.0
+CALSCALE:GREGORIAN
+BEGIN:VEVENT
+DTSTART;VALUE=DATE:20130715
+DTEND;VALUE=DATE:20130716
+RRULE:FREQ=YEARLY;UNTIL=20130715
+SUMMARY:Geburtstage
+UID:3616ED6A-E30F-4125-8213-9BA7A5730192
+SEQUENCE:0
+DTSTAMP:20140521T063241Z
+CREATED:20110704T155641Z
+TRANSP:TRANSPARENT
+LAST-MODIFIED:20140521T063213Z
+X-BUSYMAC-LASTMODBY:jeanette
+BEGIN:VALARM
+UID:D62E454A-F678-425C-AAAA-5A616D3C3365
+ACKNOWLEDGED:20130714T091142Z
+X-APPLE-DEFAULT-ALARM:TRUE
+TRIGGER;VALUE=DURATION:-PT15H
+ACTION:AUDIO
+ATTACH;VALUE=URI:Basso
+END:VALARM
+END:VEVENT
+BEGIN:VEVENT
+DTSTART;VALUE=DATE:20130715
+DTEND;VALUE=DATE:20130716
+SUMMARY:Geburtstage
+UID:3616ED6A-E30F-4125-8213-9BA7A5730192
+SEQUENCE:0
+DTSTAMP:20140521T063241Z
+RECURRENCE-ID;VALUE=DATE:20130715
+CREATED:20110704T155641Z
+TRANSP:TRANSPARENT
+LAST-MODIFIED:20130714T095219Z
+BEGIN:VALARM
+UID:CB33677C-22E5-49C8-AC54-317BF2A4EEA9
+ACKNOWLEDGED:20130714T091142Z
+X-APPLE-DEFAULT-ALARM:TRUE
+TRIGGER;VALUE=DURATION:-PT15H
+ACTION:AUDIO
+ATTACH;VALUE=URI:Basso
+END:VALARM
+BEGIN:VALARM
+UID:EB516FEB-A6DD-438E-BF61-E07E0357207B
+RELATED-TO;RELTYPE=SNOOZE:CB33677C-22E5-49C8-AC54-317BF2A4EEA9
+ACKNOWLEDGED:20130714T095219Z
+TRIGGER;VALUE=DATE-TIME:20130714T092642Z
+ACTION:AUDIO
+ATTACH;VALUE=URI:Basso
+END:VALARM
+END:VEVENT
+END:VCALENDAR
index cf30d74..15945f1 100644 (file)
@@ -492,7 +492,7 @@ class Calendar_Model_Event extends Tinebase_Record_Abstract
             }
         }
         
-        if ($this->rrule_until && $this->rrule_until < $this->dtstart) {
+        if ($this->rrule_until && $this->rrule_until->getTimeStamp() - $this->dtstart->getTimeStamp() < -1) {
             throw new Tinebase_Exception_Record_Validation('rrule until must not be before dtstart');
         }
     }