Skip to content
Snippets Groups Projects
Commit 8ee231f6 authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with multi value fields and filter

parent 59b064b6
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ namespace Civi\DataProcessor\FilterHandler;
use Civi\DataProcessor\DataFlow\SqlDataFlow;
use Civi\DataProcessor\DataFlow\SqlTableDataFlow;
use Civi\DataProcessor\DataSpecification\CustomFieldSpecification;
use Civi\DataProcessor\DataSpecification\FieldSpecification;
use Civi\DataProcessor\Source\SourceInterface;
use CRM_Dataprocessor_ExtensionUtil as E;
......@@ -67,7 +68,11 @@ class SimpleSqlFilter extends AbstractFilterHandler {
public function setFilter($filter) {
$dataFlow = $this->dataSource->ensureField($this->fieldSpecification->name);
if ($dataFlow && $dataFlow instanceof SqlDataFlow) {
$whereClause = new SqlDataFlow\SimpleWhereClause($dataFlow->getName(), $this->fieldSpecification->name, $filter['op'], $filter['value'], $this->fieldSpecification->type);
if ($this->fieldSpecification instanceof CustomFieldSpecification && $this->fieldSpecification->getOptions() != null) {
$whereClause = new SqlDataFlow\MultiValueFieldWhereClause($dataFlow->getName(), $this->fieldSpecification->name, $filter['op'], $filter['value'], $this->fieldSpecification->type);
} else {
$whereClause = new SqlDataFlow\SimpleWhereClause($dataFlow->getName(), $this->fieldSpecification->name, $filter['op'], $filter['value'], $this->fieldSpecification->type);
}
$dataFlow->addWhereClause($whereClause);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment