Commit 9ce978fd authored by jaapjansma's avatar jaapjansma

refactored

parent 348d5e2a
......@@ -102,9 +102,15 @@ class CRM_Dataprocessor_BAO_DataProcessorSource extends CRM_Dataprocessor_DAO_Da
public static function sourceToSourceClass($source) {
$factory = dataprocessor_get_factory();
$sourceClass = $factory->getDataSourceByName($source['type']);
$sourceClass->setSourceName($source['name']);
$sourceClass->setSourceTitle($source['title']);
$sourceClass->setConfiguration($source['configuration']);
if (isset($source['name'])) {
$sourceClass->setSourceName($source['name']);
}
if (isset($source['title'])) {
$sourceClass->setSourceTitle($source['title']);
}
if (isset($source['configuration'])) {
$sourceClass->setConfiguration($source['configuration']);
}
return $sourceClass;
}
}
......@@ -11,6 +11,8 @@ class CRM_Dataprocessor_Form_AggregateField extends CRM_Core_Form {
private $dataProcessorId;
private $dataProcessor;
private $id;
/**
......@@ -19,28 +21,31 @@ class CRM_Dataprocessor_Form_AggregateField extends CRM_Core_Form {
* @access public
*/
function preProcess() {
$session = CRM_Core_Session::singleton();
$this->dataProcessorId = CRM_Utils_Request::retrieve('id', 'Integer');
$this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $this->dataProcessorId));
$this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor);
$this->assign('data_processor_id', $this->dataProcessorId);
$title = E::ts('Data Processor Field');
CRM_Utils_System::setTitle($title);
$url = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('id' => $this->dataProcessorId, 'action' => 'update', 'reset' => 1));
$session->pushUserContext($url);
}
public function buildQuickForm() {
$this->add('hidden', 'id');
$this->add('hidden', 'alias');
if ($this->_action != CRM_Core_Action::DELETE) {
$fields = CRM_Dataprocessor_BAO_DataProcessor::getAvailableAggregationFields($this->dataProcessorId);
$fieldSelect = array(E::ts('- Select -'));
foreach($fields as $field) {
$fieldSelect[$field->fieldSpecification->alias] = $field->dataSource->getSourceTitle()." :: ".$field->fieldSpecification->title;
$aggregationFieldsFormatted = array();
foreach($this->dataProcessorClass->getDataSources() as $dataSource) {
foreach($dataSource->getAvailableAggregationFields() as $field) {
$aggregationFieldsFormatted[$field->fieldSpecification->alias] = $field->dataSource->getSourceTitle()." :: ".$field->fieldSpecification->title;
}
}
$this->add('select', 'field', E::ts('Select Field'), $fieldSelect, true, array('class' => 'crm-select2 crm-huge40'));
$this->add('select', 'field', E::ts('Select Field'), $aggregationFieldsFormatted, true, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'placeholder' => E::ts('- select -'),
));
}
if ($this->_action == CRM_Core_Action::ADD) {
$this->addButtons(array(
......@@ -63,31 +68,29 @@ class CRM_Dataprocessor_Form_AggregateField extends CRM_Core_Form {
public function postProcess() {
$session = CRM_Core_Session::singleton();
$redirectUrl = $session->readUserContext();
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
if ($this->_action == CRM_Core_Action::DELETE) {
$values = $this->exportValues();
$dataProcessor = CRM_Dataprocessor_BAO_DataProcessor::getValues(array('id' => $this->dataProcessorId));
$aggregation = $dataProcessor[$this->dataProcessorId]['aggregation'];
$dataProcessor[$this->dataProcessorId]['aggregation'] = array();
$aggregation = $this->dataProcessor['aggregation'];
$this->dataProcessor['aggregation'] = array();
foreach($aggregation as $alias) {
if ($alias != $values['alias']) {
$dataProcessor[$this->dataProcessorId]['aggregation'][] = $alias;
$this->dataProcessor['aggregation'][] = $alias;
}
}
$result = CRM_Dataprocessor_BAO_DataProcessor::add($dataProcessor[$this->dataProcessorId]);
$result = civicrm_api3('DataProcessor', 'create', $this->dataProcessor);
$session->setStatus(E::ts('Field removed'), E::ts('Removed'), 'success');
CRM_Utils_System::redirect($redirectUrl);
}
$values = $this->exportValues();
$dataProcessor = CRM_Dataprocessor_BAO_DataProcessor::getValues(array('id' => $this->dataProcessorId));
$aggregation = $dataProcessor[$this->dataProcessorId]['aggregation'];
$aggregation = $this->dataProcessor['aggregation'];
if (!in_array($values['field'], $aggregation)) {
$aggregation[] = $values['field'];
}
$dataProcessor[$this->dataProcessorId]['aggregation'] = $aggregation;
$result = CRM_Dataprocessor_BAO_DataProcessor::add($dataProcessor[$this->dataProcessorId]);
$this->dataProcessor['aggregation'] = $aggregation;
$result = civicrm_api3('DataProcessor', 'create', $this->dataProcessor);
CRM_Utils_System::redirect($redirectUrl);
parent::postProcess();
......
......@@ -202,6 +202,7 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
}
$result = civicrm_api3('DataProcessor', 'create', $params);
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $result['id']));
CRM_Utils_System::redirect($redirectUrl);
}
......@@ -269,7 +270,7 @@ class CRM_Dataprocessor_Form_DataProcessor extends CRM_Core_Form {
if (empty($fields['name'])) {
$fields['name'] = CRM_Dataprocessor_BAO_DataProcessor::checkName($fields['title'], $id);
}
if (!CRM_Dataprocessor_BAO_DataProcessorSource::isNameValid($fields['name'], $id)) {
if (!CRM_Dataprocessor_BAO_DataProcessor::isNameValid($fields['name'], $id)) {
$errors['name'] = E::ts('There is already a data processor with this name');
return $errors;
}
......
......@@ -11,6 +11,13 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
private $dataProcessorId;
private $dataProcessor;
/**
* @var Civi\DataProcessor\ProcessorType\AbstractProcessorType
*/
private $dataProcessorClass;
private $id;
private $field;
......@@ -21,9 +28,12 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
* @access public
*/
function preProcess() {
$session = CRM_Core_Session::singleton();
$this->dataProcessorId = CRM_Utils_Request::retrieve('data_processor_id', 'Integer');
$this->assign('data_processor_id', $this->dataProcessorId);
if ($this->dataProcessorId) {
$this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $this->dataProcessorId));
$this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor);
}
$this->id = CRM_Utils_Request::retrieve('id', 'Integer');
$this->assign('id', $this->id);
......@@ -35,9 +45,6 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
$title = E::ts('Data Processor Field');
CRM_Utils_System::setTitle($title);
$url = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('id' => $this->dataProcessorId, 'action' => 'update', 'reset' => 1));
$session->pushUserContext($url);
}
public function buildQuickForm() {
......@@ -47,7 +54,7 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
$this->add('text', 'name', E::ts('Name'), array('size' => CRM_Utils_Type::HUGE), FALSE);
$this->add('text', 'title', E::ts('Title'), array('size' => CRM_Utils_Type::HUGE), TRUE);
$outputHandlers = CRM_Dataprocessor_BAO_DataProcessor::getAvailableOutputHandlers($this->dataProcessorId);
$outputHandlers = $this->dataProcessorClass->getAvailableOutputHandlers();
foreach($outputHandlers as $outputHandler) {
$outputHandlersSelect[$outputHandler->getName()] = $outputHandler->getTitle();
}
......@@ -95,7 +102,7 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
public function postProcess() {
$session = CRM_Core_Session::singleton();
$redirectUrl = $session->readUserContext();
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
if ($this->_action == CRM_Core_Action::DELETE) {
civicrm_api3('DataProcessorField', 'delete', array('id' => $this->id));
$session->setStatus(E::ts('Field removed'), E::ts('Removed'), 'success');
......
......@@ -35,7 +35,6 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
}
$factory = dataprocessor_get_factory();
$session = CRM_Core_Session::singleton();
$this->dataProcessorId = CRM_Utils_Request::retrieve('data_processor_id', 'Integer');
$this->assign('data_processor_id', $this->dataProcessorId);
......@@ -62,9 +61,6 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
$title = E::ts('Data Processor Filter');
CRM_Utils_System::setTitle($title);
$url = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('id' => $this->dataProcessorId, 'action' => 'update', 'reset' => 1));
$session->pushUserContext($url);
}
public function buildQuickForm() {
......@@ -122,7 +118,7 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
public function postProcess() {
$session = CRM_Core_Session::singleton();
$redirectUrl = $session->readUserContext();
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
if ($this->_action == CRM_Core_Action::DELETE) {
civicrm_api3('DataProcessorFilter', 'delete', array('id' => $this->id));
$session->setStatus(E::ts('Filter removed'), E::ts('Removed'), 'success');
......
......@@ -35,7 +35,6 @@ class CRM_Dataprocessor_Form_Output extends CRM_Core_Form {
}
$factory = dataprocessor_get_factory();
$session = CRM_Core_Session::singleton();
$this->dataProcessorId = CRM_Utils_Request::retrieve('data_processor_id', 'Integer');
$this->assign('data_processor_id', $this->dataProcessorId);
......@@ -61,9 +60,6 @@ class CRM_Dataprocessor_Form_Output extends CRM_Core_Form {
$title = E::ts('Data Processor Output');
CRM_Utils_System::setTitle($title);
$url = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('id' => $this->dataProcessorId, 'action' => 'update', 'reset' => 1));
$session->pushUserContext($url);
}
public function buildQuickForm() {
......@@ -103,7 +99,7 @@ class CRM_Dataprocessor_Form_Output extends CRM_Core_Form {
public function postProcess() {
$session = CRM_Core_Session::singleton();
$redirectUrl = $session->readUserContext();
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
if ($this->_action == CRM_Core_Action::DELETE) {
civicrm_api3('DataProcessorOutput', 'delete', array('id' => $this->id));
$session->setStatus(E::ts('Data Processor Output removed'), E::ts('Removed'), 'success');
......
......@@ -31,8 +31,7 @@ abstract class CRM_Dataprocessor_Form_Output_AbstractOutputForm extends CRM_Core
$this->assign('id', $this->id);
if ($this->id) {
$output = CRM_Dataprocessor_BAO_Output::getValues(array('id' => $this->id));
$this->output = $output[$this->id];
$this->output = civicrm_api3('DataProcessorOutput', 'getsingle', array('id' => $this->id));
$this->assign('output', $output[$this->id]);
}
......
......@@ -79,8 +79,7 @@ abstract class CRM_Dataprocessor_Form_Output_AbstractUIOutputForm extends CRM_Co
$this->dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor);
$this->dataProcessorId = $dao->data_processor_id;
$output = CRM_Dataprocessor_BAO_Output::getValues(['id' => $dao->output_id]);
$this->dataProcessorOutput = $output[$dao->output_id];
$this->dataProcessorOutput = civicrm_api3('DataProcessorOutput', 'getsingle', array('id' => $dao->output_id));
$this->assign('output', $this->dataProcessorOutput);
if (!$this->isConfigurationValid()) {
......
......@@ -52,7 +52,6 @@ class CRM_Dataprocessor_Form_Source extends CRM_Core_Form {
$factory = dataprocessor_get_factory();
$session = CRM_Core_Session::singleton();
$this->dataProcessorId = CRM_Utils_Request::retrieve('data_processor_id', 'Integer');
$this->assign('data_processor_id', $this->dataProcessorId);
if ($this->dataProcessorId) {
......@@ -81,7 +80,7 @@ class CRM_Dataprocessor_Form_Source extends CRM_Core_Form {
$i++;
}
} else {
$this->isFirstDataSource = count($sources) > 0 ? false : true;
$this->isFirstDataSource = count($sources['values']) > 0 ? false : true;
$this->source['data_processor_id'] = $this->dataProcessorId;
}
$this->assign('is_first_data_source', $this->isFirstDataSource);
......@@ -91,7 +90,7 @@ class CRM_Dataprocessor_Form_Source extends CRM_Core_Form {
$this->source['type'] = $type;
$this->sourceClass = CRM_Dataprocessor_BAO_DataProcessorSource::sourceToSourceClass($this->source);
$this->assign('has_configuration', $this->sourceClass->hasConfiguration());
if ($this->sourceClass) {
if ($this->sourceClass && !$this->id) {
$this->source['configuration'] = $this->sourceClass->getDefaultConfiguration();
}
}
......@@ -113,9 +112,6 @@ class CRM_Dataprocessor_Form_Source extends CRM_Core_Form {
$title = E::ts('Data Processor Source');
CRM_Utils_System::setTitle($title);
$url = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('id' => $this->dataProcessorId, 'action' => 'update', 'reset' => 1));
$session->pushUserContext($url);
}
public function buildQuickForm() {
......@@ -191,7 +187,7 @@ class CRM_Dataprocessor_Form_Source extends CRM_Core_Form {
public function postProcess() {
$session = CRM_Core_Session::singleton();
$backUrl = $redirectUrl = $session->readUserContext();
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
if ($this->_action == CRM_Core_Action::DELETE) {
civicrm_api3('DataProcessorSource', 'delete', array('id' => $this->id));
$session->setStatus(E::ts('Data Processor Source removed'), E::ts('Removed'), 'success');
......@@ -207,26 +203,28 @@ class CRM_Dataprocessor_Form_Source extends CRM_Core_Form {
}
$params['title'] = $values['title'];
$params['type'] = $values['type'];
if (!$this->isFirstDataSource) {
$params['join_type'] = $values['join_type'];
} else {
$params['join_type'] = '';
}
if ($this->dataProcessorId) {
$params['data_processor_id'] = $this->dataProcessorId;
}
if ($this->id) {
$params['id'] = $this->id;
}
if (isset($this->source)) {
$params['join_configuration'] = $this->source['join_configuration'];
}
$this->sourceClass = CRM_Dataprocessor_BAO_DataProcessorSource::sourceToSourceClass($params);
if ($this->sourceClass && $this->sourceClass->hasConfiguration()) {
$params['configuration'] = $this->sourceClass->processConfiguration($values);
}
if (!$this->isFirstDataSource) {
$params['join_type'] = $values['join_type'];
if ($this->joinClass && $this->joinClass->hasConfiguration()) {
$params['join_configuration'] = $this->joinClass->processConfiguration($values, $this->sourceClass);
}
} else {
$params['join_type'] = '';
}
$result = civicrm_api3('DataProcessorSource', 'create', $params);
CRM_Utils_System::redirect($redirectUrl);
parent::postProcess();
}
......
......@@ -10,9 +10,9 @@ use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_DataprocessorOutputExport_CSV implements ExportOutputInterface {
const MAX_DIRECT_SIZE = 500;
const MAX_DIRECT_SIZE = 1;
const RECORDS_PER_JOB = 250;
const RECORDS_PER_JOB = 1;
/**
* Returns true when this filter has additional configuration
......
......@@ -31,7 +31,7 @@ class CRM_DataprocessorOutputExport_Page_Download extends CRM_Core_Page {
list($prefix, $dataProcessorId, $outputId, $userId, $download_name) = explode("_", $fileName, 5);
$download_name = $prefix.'_'.$download_name;
$data_processors = CRM_Dataprocessor_BAO_DataProcessor::getValues(array('id' => $dataProcessorId));
$data_processor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $dataProcessorId));
$output = civicrm_api3("DataProcessorOutput", "getsingle", array('id' => $outputId));
$outputClass = $factory->getOutputByName($output['type']);
if (!$outputClass instanceof \Civi\DataProcessor\Output\ExportOutputInterface) {
......
......@@ -308,11 +308,11 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
$factory = dataprocessor_get_factory();
$outputs = civicrm_api3('DataProcessorOutput', 'get', array('data_processor_id' => $this->dataProcessorId, 'options' => array('limit' => 0)));
$otherOutputs = array();
foreach($outputs as $output) {
foreach($outputs['values'] as $output) {
if ($output['id'] == $this->dataProcessorOutput['id']) {
continue;
}
$outputClass = $factory->getOutputByName(($output['type']));
$outputClass = $factory->getOutputByName($output['type']);
if ($outputClass instanceof \Civi\DataProcessor\Output\ExportOutputInterface) {
$otherOutput = array();
$otherOutput['title'] = $outputClass->getTitleForExport($output, $this->dataProcessor);
......
......@@ -150,7 +150,7 @@ class SimpleJoin implements JoinInterface, SqlJoinInterface {
));
// Backwords compatability
if ($joinConfiguration['right_prefix'] == $joinFromSource->getSourceName()) {
if (isset($joinConfiguration['right_prefix']) && $joinConfiguration['right_prefix'] == $joinFromSource->getSourceName()) {
$joinConfigurationBackwardsCompatibility = $joinConfiguration;
$joinConfiguration['left_prefix'] = '';
$joinConfiguration['left_field'] = $joinConfigurationBackwardsCompatibility['right_field'];
......
......@@ -35,8 +35,7 @@ class UIOutputHelper {
$outputClass = $factory->getOutputByName($dao->type);
if ($outputClass instanceof \Civi\DataProcessor\Output\UIOutputInterface) {
$output = civicrm_api3('DataProcessorOutput', 'getsingle', array('id' => $dao->output_id));
$dataprocessors = \CRM_Dataprocessor_BAO_DataProcessor::getValues(['id' => $dao->id]);
$dataprocessor = $dataprocessors[$dao->id];
$dataprocessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $dao->id));
$url = $outputClass->getUrlToUi($output, $dataprocessor);
$configuration = json_decode($dao->configuration, TRUE);
......@@ -85,8 +84,7 @@ class UIOutputHelper {
\CRM_Core_BAO_Navigation::resetNavigation();
self::$rebuildMenu = TRUE;
} else {
$dataProcessors = \CRM_Dataprocessor_BAO_DataProcessor::getValues(['id' => $output['data_processor_id']]);
$dataProcessor = $dataProcessors[$output['data_processor_id']];
$dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $output['data_processor_id']));
// Retrieve the current navigation params.
$navigationParams = [];
......@@ -105,8 +103,7 @@ class UIOutputHelper {
}
}
elseif ($op == 'create' && isset($params['configuration']['navigation_parent_path'])) {
$dataProcessors = \CRM_Dataprocessor_BAO_DataProcessor::getValues(array('id' => $params['data_processor_id']));
$dataProcessor = $dataProcessors[$params['data_processor_id']];
$dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $params['data_processor_id']));
self::$rebuildMenu = self::newNavigationItem($params, $dataProcessor);
}
}
......
......@@ -191,6 +191,16 @@ abstract class AbstractSource implements SourceInterface {
return count($this->getAvailableFilterFields()->getFields()) > 0 ? true : false;
}
/**
* Returns an array with the names of required configuration filters.
* Those filters are displayed as required to the user
*
* @return array
*/
protected function requiredConfigurationFilters() {
return array();
}
/**
* When this source has additional configuration you can add
* the fields on the form with this function.
......@@ -200,11 +210,21 @@ abstract class AbstractSource implements SourceInterface {
*/
public function buildConfigurationForm(\CRM_Core_Form $form, $source=array()) {
$fields = array();
$required_fields = array();
$requiredFilters = $this->requiredConfigurationFilters();
foreach($this->getAvailableFilterFields()->getFields() as $fieldSpec) {
$alias = $fieldSpec->name;
$isRequired = false;
if (in_array($alias, $requiredFilters)) {
$isRequired = true;
}
switch ($fieldSpec->type) {
case 'Boolean':
$fields[$alias] = $fieldSpec->title;
if ($isRequired) {
$required_fields[$alias] = $fieldSpec->title;
} else {
$fields[$alias] = $fieldSpec->title;
}
$form->addElement('select', "{$alias}_op", ts('Operator:'), [
'=' => E::ts('Is equal to'),
'!=' => E::ts('Is not equal to'),
......@@ -215,7 +235,11 @@ abstract class AbstractSource implements SourceInterface {
break;
default:
if ($fieldSpec->getOptions()) {
$fields[$alias] = $fieldSpec->title;
if ($isRequired) {
$required_fields[$alias] = $fieldSpec->title;
} else {
$fields[$alias] = $fieldSpec->title;
}
$form->addElement('select', "{$alias}_op", ts('Operator:'), [
'IN' => E::ts('Is one of'),
'NOT IN' => E::ts('Is not one of'),
......@@ -230,6 +254,7 @@ abstract class AbstractSource implements SourceInterface {
}
}
$form->assign('filter_fields', $fields);
$form->assign('filter_required_fields', $required_fields);
$defaults = array();
if (isset($source['configuration']['filter'])) {
......
......@@ -30,4 +30,32 @@ class AddressSource extends AbstractCivicrmEntitySource {
return 'civicrm_address';
}
/**
* Returns an array with the names of required configuration filters.
* Those filters are displayed as required to the user
*
* @return array
*/
protected function requiredConfigurationFilters() {
return array(
'is_primary',
);
}
/**
* Returns the default configuration for this data source
*
* @return array
*/
public function getDefaultConfiguration() {
return array(
'filter' => array(
'is_primary' => array (
'op' => '=',
'value' => '1',
),
)
);
}
}
\ No newline at end of file
......@@ -30,4 +30,32 @@ class EmailSource extends AbstractCivicrmEntitySource {
return 'civicrm_email';
}
/**
* Returns an array with the names of required configuration filters.
* Those filters are displayed as required to the user
*
* @return array
*/
protected function requiredConfigurationFilters() {
return array(
'is_primary',
);
}
/**
* Returns the default configuration for this data source
*
* @return array
*/
public function getDefaultConfiguration() {
return array(
'filter' => array(
'is_primary' => array (
'op' => '=',
'value' => '1',
),
)
);
}
}
\ No newline at end of file
......@@ -30,4 +30,32 @@ class PhoneSource extends AbstractCivicrmEntitySource {
return 'civicrm_phone';
}
/**
* Returns an array with the names of required configuration filters.
* Those filters are displayed as required to the user
*
* @return array
*/
protected function requiredConfigurationFilters() {
return array(
'is_primary',
);
}
/**
* Returns the default configuration for this data source
*
* @return array
*/
public function getDefaultConfiguration() {
return array(
'filter' => array(
'is_primary' => array (
'op' => '=',
'value' => '1',
),
)
);
}
}
\ No newline at end of file
......@@ -57,6 +57,19 @@ class RelationshipSource extends AbstractCivicrmEntitySource {
return $this->availableFilterFields;
}
/**
* Returns an array with the names of required configuration filters.
* Those filters are displayed as required to the user