Skip to content

Commit

Permalink
ensure outerquery ->where() function doesn't clobber earier ->andWhere()
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcclelland committed Aug 7, 2023
1 parent 1e9082b commit 87bc180
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,10 @@ public function search(array $calendarInfo, $pattern, array $searchProperties,
->andWhere($innerQuery->expr()->eq('op.calendartype',
$outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));

$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
->from('calendarobjects', 'c')
->where($outerQuery->expr()->isNull('deleted_at'));

// only return public items for shared calendars for now
if (isset($calendarInfo['{http://owncloud.org/ns}owner-principal']) === false || $calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
$outerQuery->andWhere($outerQuery->expr()->eq('c.classification',
Expand All @@ -1866,10 +1870,6 @@ public function search(array $calendarInfo, $pattern, array $searchProperties,
$this->db->escapeLikeParameter($pattern) . '%')));
}

$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
->from('calendarobjects', 'c')
->where($outerQuery->expr()->isNull('deleted_at'));

if (isset($options['timerange'])) {
if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
$outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',
Expand Down

0 comments on commit 87bc180

Please sign in to comment.