Commit 43ab5c74 authored by jaapjansma's avatar jaapjansma
Browse files

Fixed #24

parent 5a4fa8a0
......@@ -7,6 +7,7 @@
* Added PDF Export Output
* Added Union Query Data Flow.
* Added a field specification for a fixed value
* Fixed #24
# Version 1.3.0
......
......@@ -188,7 +188,7 @@ class SimpleJoin implements JoinInterface, SqlJoinInterface {
*/
public function processConfiguration($submittedValues, SourceInterface $joinFromSource) {
$left_prefix = $joinFromSource->getSourceName();
$left_field = $this->ocrrectFieldName($submittedValues['left_field'], $joinFromSource);
$left_field = $this->correctFieldName($submittedValues['left_field'], $joinFromSource);
list($right_prefix, $right_field) = explode("::",$submittedValues['right_field'], 2);
$configuration = array(
......@@ -215,7 +215,7 @@ class SimpleJoin implements JoinInterface, SqlJoinInterface {
* @param \Civi\DataProcessor\Source\SourceInterface $joinFromSource
* @return String
*/
private function ocrrectFieldName($fieldAlias, SourceInterface $joinFromSource) {
private function correctFieldName($fieldAlias, SourceInterface $joinFromSource) {
try {
$fields = \CRM_Dataprocessor_Utils_DataSourceFields::getAvailableFieldsInDataSource($joinFromSource, '', '');
if (isset($fields[$fieldAlias])) {
......@@ -228,7 +228,7 @@ class SimpleJoin implements JoinInterface, SqlJoinInterface {
$fieldKeys = array_keys($fields);
$fieldsWithoutPrefixKeys = array_keys($fieldsWithoutPrefix);
$key = array_search($fieldAlias, $fieldsWithoutPrefixKeys);
if (isset($fieldKeys[$key])) {
if ($key!== false && isset($fieldKeys[$key])) {
return $fieldKeys[$key];
}
} catch (\Exception $e) {
......
......@@ -117,6 +117,18 @@ abstract class AbstractCivicrmEntitySource extends AbstractSource {
$this->primaryDataFlow = $this->getEntityDataFlow();
$this->dataFlow = null;
$this->additionalDataFlowDescriptions = array();
$this->availableFields = null;
$this->availableFilterFields = null;
}
/**
* @param String $name
* @return \Civi\DataProcessor\Source\SourceInterface
*/
public function setSourceName($name) {
$this->availableFields = null;
$this->availableFilterFields = null;
return parent::setSourceName($name);
}
/**
......@@ -134,7 +146,10 @@ abstract class AbstractCivicrmEntitySource extends AbstractSource {
*/
protected function loadFields(DataSpecification $dataSpecification, $fieldsToSkip=array()) {
$daoClass = \CRM_Core_DAO_AllCoreTables::getFullName($this->getEntity());
$aliasPrefix = $this->getSourceName().'_';
$aliasPrefix = '';
if ($this->getSourceName()) {
$aliasPrefix = $this->getSourceName() . '_';
}
DataSpecificationUtils::addDAOFieldsToDataSpecification($daoClass, $dataSpecification, $fieldsToSkip, '', $aliasPrefix);
}
......@@ -152,7 +167,10 @@ abstract class AbstractCivicrmEntitySource extends AbstractSource {
if (!$entity) {
$entity = $this->getEntity();
}
$aliasPrefix = $this->getSourceName() . '_';
$aliasPrefix = '';
if ($this->getSourceName()) {
$aliasPrefix = $this->getSourceName() . '_';
}
DataSpecificationUtils::addCustomFieldsToDataSpecification($entity, $dataSpecification, $onlySearchAbleFields, $aliasPrefix);
}
......
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