diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index ded11aa1..db6bbd43 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -76,6 +76,7 @@ class Sync protected $runStartTime; + /** @var Filter[] */ protected $columnFilters = array(); /** @@ -258,9 +259,20 @@ class Sync $key = $source->key_column; $this->sourceColumns[$sourceId][$key] = $key; $run = $source->fetchLastRun(true); - $rows = $run->fetchRows( - SyncUtils::getRootVariables($this->sourceColumns[$sourceId]) - ); + + $usedColumns = SyncUtils::getRootVariables($this->sourceColumns[$sourceId]); + + $filterColumns = array(); + foreach ($this->columnFilters as $filter) { + foreach ($filter->listFilteredColumns() as $column) { + $filterColumns[$column] = $column; + } + } + foreach (SyncUtils::getRootVariables($filterColumns) as $column) { + $usedColumns[$column] = $column; + } + + $rows = $run->fetchRows($usedColumns); $this->imported[$sourceId] = array(); foreach ($rows as $row) {