Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
fix(Calendar): multiple calendar filters not working
Browse files Browse the repository at this point in the history
Change-Id: Ia819ffbef85eb419d8c97bd2d8aeecb8127349d3
Reviewed-on: http://gerrit.tine20.com/customers/14013
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Cornelius Weiss <c.weiss@metaways.de>
  • Loading branch information
corneliusweiss committed Sep 13, 2019
1 parent 97adb0c commit 622e791
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
1 change: 1 addition & 0 deletions tests/tine20/Tinebase/UserTest.php
Expand Up @@ -215,6 +215,7 @@ protected function _assertPolicy($pw, $expectedMessage, $pwIsValid = FALSE)
}
}
}

}

/**
Expand Down
29 changes: 0 additions & 29 deletions tine20/Calendar/Backend/Sql.php
Expand Up @@ -211,22 +211,6 @@ public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tineba
// and the calendar filter is used in the UI to
$clonedFilters = clone $_filter;

$calendarFilter = null;
unset($func); // !!! very important, don't separate this and the next line
$func = function($filter) use (/*yes & !*/&$func, &$calendarFilter, $translate) {
if ($filter instanceof Calendar_Model_EventFilter) {
$filter->filterWalk($func);
} elseif ($filter instanceof Calendar_Model_CalendarFilter && strpos($filter->getOperator(), 'not') !== 0) {
if ($calendarFilter !== null) {
throw new Tinebase_Exception_SystemGeneric($translate->_('You can not have more than one calendar filter'));
}
$calendarFilter = $filter;
$filter->getParent()->removeFilter($filter);
}
};
$clonedFilters->filterWalk($func);


// sort filters, roleFilter und statusFilter need to be processed after attenderFilter
unset($func); // !!! very important, don't separate this and the next line
$tempFilters = [];
Expand All @@ -251,19 +235,6 @@ public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tineba
$select->group($this->_tableName . '.' . 'id');
Tinebase_Backend_Sql_Abstract::traitGroup($select);

if ($calendarFilter) {
$select1 = clone $select;
$select2 = clone $select;

$calendarFilter->appendFilterSql1($select1, $this);
$calendarFilter->appendFilterSql2($select2, $this);

$select = $this->getAdapter()->select()->union(array(
$select1,
$select2
));
}

$_pagination->appendPaginationSql($select);

$stmt = $this->_db->query($select);
Expand Down

0 comments on commit 622e791

Please sign in to comment.