From e9546f68bf26cc64bb07f8ed466832f7c9eba020 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Tue, 29 Aug 2017 11:58:39 +0200 Subject: [PATCH] Sync: Respect the fields used in filter_expression of the SyncRule So that you can filter by fields not used in properties, or in property filters. fixes #1130 refs #876 --- library/Director/Import/Sync.php | 6 ++++++ library/Director/Objects/SyncRule.php | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index 56ef5f07..4a85e356 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -283,6 +283,12 @@ class Sync $filterColumns[$column] = $column; } } + if (($ruleFilter = $this->rule->filter()) !== null) { + foreach ($ruleFilter->listFilteredColumns() as $column) { + $filterColumns[$column] = $column; + } + } + if (! empty($filterColumns)) { foreach (SyncUtils::getRootVariables($filterColumns) as $column) { $usedColumns[$column] = $column; diff --git a/library/Director/Objects/SyncRule.php b/library/Director/Objects/SyncRule.php index c144f07c..97f0b472 100644 --- a/library/Director/Objects/SyncRule.php +++ b/library/Director/Objects/SyncRule.php @@ -203,7 +203,10 @@ class SyncRule extends DbObject return $this->sync; } - protected function filter() + /** + * @return Filter + */ + public function filter() { if ($this->filter === null) { $this->filter = Filter::fromQueryString($this->get('filter_expression'));