Skip to content

Commit

Permalink
add option to filter CalendarAPI by componenttype
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
  • Loading branch information
georgehrke committed Nov 9, 2017
1 parent 852d581 commit ff9ad26
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,6 @@ public function search(array $calendarInfo, $pattern, array $searchProperties,
}
$innerQuery->andWhere($or);

// TODO - add component-type

if ($pattern !== '') {
$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
$outerQuery->createNamedParameter('%' .
Expand All @@ -1404,7 +1402,15 @@ public function search(array $calendarInfo, $pattern, array $searchProperties,
$outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence',
$outerQuery->createNamedParameter($options['timerange']['end']->getTimeStamp)));
}
}

if (isset($options['types'])) {
$or = $outerQuery->expr()->orX();
foreach($options['types'] as $type) {
$or->add($outerQuery->expr()->eq('componenttype',
$outerQuery->createNamedParameter($type)));
}
$outerQuery->andWhere($or);
}

$outerQuery->andWhere($outerQuery->expr()->in('c.id',
Expand Down

0 comments on commit ff9ad26

Please sign in to comment.