Commit ba804b90 authored by jaapjansma's avatar jaapjansma
Browse files

update

parent c7883b14
......@@ -7,6 +7,7 @@
namespace Civi\DataProcessorTokenOutput\Output;
use Civi\DataProcessor\DataFlow\Sort\SortCompareFactory;
use Civi\DataProcessor\DataFlow\SqlDataFlow;
use Civi\DataProcessor\Exception\DataSourceNotFoundException;
use Civi\DataProcessor\Exception\FieldNotFoundException;
use Civi\DataProcessor\Output\OutputInterface;
......@@ -196,7 +197,7 @@ class Token implements OutputInterface {
if (!$dataSource) {
throw new DataSourceNotFoundException(E::ts("Requires data source '%1' which could not be found. Did you rename or deleted the data source?", array(1=>$datasource_name)));
}
$fieldSpecification = clone $dataSource->getAvailableFilterFields()->getFieldSpecificationByAlias($field_name);
$fieldSpecification = $dataSource->getAvailableFilterFields()->getFieldSpecificationByAlias($field_name);
if (!$fieldSpecification) {
throw new FieldNotFoundException(E::ts("Requires a field with the name '%1' in the data source '%2'. Did you change the data source type?", array(
1 => $field_name,
......@@ -204,10 +205,9 @@ class Token implements OutputInterface {
)));
}
$fieldSpecification->alias = 'token_output_contact_id';
$dataFlow = $dataSource->ensureField($fieldSpecification);
if ($dataFlow && $dataFlow instanceof SqlDataFlow) {
$whereClause = new SimpleWhereClause($dataFlow->getName(), $fieldSpecification->name, '=', $contact_id, $fieldSpecification->type);
$whereClause = new SqlDataFlow\SimpleWhereClause($dataFlow->getName(), $fieldSpecification->name, '=', $contact_id, $fieldSpecification->type);
$dataFlow->addWhereClause($whereClause);
}
......@@ -220,7 +220,6 @@ class Token implements OutputInterface {
$dataProcessorClass->getDataFlow()->addSort($sortField, $direction);
$dataProcessorClass->getDataFlow()->setLimit(1);
$dataProcessorClass->getDataFlow()->setOffset(0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment