Calendar: Also check if the enddate is in the requested range for events

This commit is contained in:
Bart Visscher 2011-11-30 21:13:26 +01:00
parent e5fdc6013a
commit 0bbeb13e26
1 changed files with 2 additions and 0 deletions

View File

@ -43,10 +43,12 @@ class OC_Calendar_Object{
public static function allInPeriod($id, $start, $end){
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?'
.' AND ((startdate >= ? AND startdate <= ? AND repeating = 0)'
.' OR (enddate >= ? AND enddate <= ? AND repeating = 0)'
.' OR (startdate <= ? AND repeating = 1))' );
$start = self::getUTCforMDB($start);
$end = self::getUTCforMDB($end);
$result = $stmt->execute(array($id,
$start, $end,
$start, $end,
$end));