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

Fixed issue with aggregation field.

parent 5bac48c8
No related branches found
No related tags found
No related merge requests found
# Version 1.11.1
* Fixed issue with aggregation field.
# Version 1.11.0
* Added Field Output Handler for outputting a text when a contact has a certain relationship.
......
......@@ -109,6 +109,41 @@ class AggregateFunctionFieldOutputHandler extends AbstractSimpleFieldOutputHandl
}
}
/**
* Initialize a field.
* Returns the datasource and the field specification
* The new alias is set as alias in the field.
*
* @param $fieldAlias
* @param $datasourceName
* @param $newAlias
*
* @return array
* @throws \Civi\DataProcessor\Exception\DataSourceNotFoundException
* @throws \Civi\DataProcessor\Exception\FieldNotFoundException
*/
protected function initializeField($fieldAlias, $datasourceName, $newAlias) {
$dataSource = $this->dataProcessor->getDataSourceByName($datasourceName);
if (!$dataSource) {
throw new DataSourceNotFoundException(E::ts("Field %1 requires data source '%2' which could not be found. Did you rename or deleted the data source?", array(1=>$newAlias, 2=>$datasourceName)));
}
$inputFieldSpec = $dataSource->getAvailableFields()->getFieldSpecificationByAlias($fieldAlias);
if (!$inputFieldSpec) {
$inputFieldSpec = $dataSource->getAvailableFields()->getFieldSpecificationByName($fieldAlias);
}
if (!$inputFieldSpec) {
throw new FieldNotFoundException(E::ts("Field %1 requires a field with the name '%2' in the data source '%3'. Did you change the data source type?", array(
1 => $newAlias,
2 => $fieldAlias,
3 => $datasourceName
)));
}
$inputFieldSpec = clone $inputFieldSpec;
$inputFieldSpec->alias = $newAlias;
return [$dataSource, $inputFieldSpec];
}
/**
* When this handler has additional configuration you can add
* the fields on the form with this function.
......
......@@ -14,8 +14,8 @@
<url desc="Documentation">https://lab.civicrm.org/extensions/dataprocessor/blob/master/README.md</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2020-07-28</releaseDate>
<version>1.11.0</version>
<releaseDate>2020-12-10</releaseDate>
<version>1.11.1</version>
<develStage>stable</develStage>
<compatibility>
<ver>4.7</ver>
......
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