]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix bug in OC_Calendar_Repeat
authorGeorg Ehrke <dev@georgswebsite.de>
Mon, 11 Jun 2012 15:13:20 +0000 (17:13 +0200)
committerGeorg Ehrke <dev@georgswebsite.de>
Mon, 11 Jun 2012 15:13:20 +0000 (17:13 +0200)
apps/calendar/lib/repeat.php

index f1323a9cb5ec8c1f872a300d69c99ed2a3da443f..585fc560085eff3b8e2d92940e2661871f8ac817 100644 (file)
@@ -34,7 +34,7 @@ class OC_Calendar_Repeat{
        public static function get_inperiod($id, $from, $until){
                $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?'
                .' AND ((startdate >= ? AND startdate <= ?)'
-               .' OR (enddate >= ? AND enddate <= ?)');
+               .' OR (enddate >= ? AND enddate <= ?))');
                $result = $stmt->execute(array($id,
                                        $from, $until,
                                        $from, $until));
@@ -68,7 +68,7 @@ class OC_Calendar_Repeat{
        public static function getcalendar_inperiod($id, $from, $until){
                $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?'
                .' AND ((startdate >= ? AND startdate <= ?)'
-               .' OR (enddate >= ? AND enddate <= ?)');
+               .' OR (enddate >= ? AND enddate <= ?))');
                $result = $stmt->execute(array($id,
                                        $from, $until,
                                        $from, $until));
@@ -155,12 +155,27 @@ class OC_Calendar_Repeat{
         * @return (bool)
         */
        public static function is_cached($id){
-               if(count(self::get($id)) === 1){
+               if(count(self::get($id)) != 0){
                        return true;
                }else{
                        return false;
                }
        }
+       /*
+        * @brief checks if an event is already cached in a specific period
+        * @param (int) id - id of the event
+        * @param (string) $from - start for period in UTC
+        * @param (string) $until - end for period in UTC
+        * @return (bool)
+        */
+       public static function is_cached_inperiod($id, $start, $end){
+               if(count(self::get_inperiod($id, $start, $end)) != 0){
+                       return true;
+               }else{
+                       return false;
+               }
+
+       }
        /*
         * @brief checks if a whole calendar is already cached
         * @param (int) id - id of the calendar