Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • extensions/dataprocessor
  • sarvesh21/dataprocessor
  • mattwire/dataprocessor
  • VangelisP/dataprocessor
  • artfulrobot/dataprocessor
  • kainuk/dataprocessor
  • michaelmcandrew/dataprocessor
  • ufundo/dataprocessor
  • ayduns/dataprocessor
  • FoadYousefi/dataprocessor
  • erikbrouwer/dataprocessor
  • dave/dataprocessor
  • ananelson/dataprocessor
  • seamuslee/dataprocessor
  • chamilwijesooriya/dataprocessor
  • marcusm/dataprocessor
  • homotechsual/dataprocessor
  • justinfreeman/dataprocessor
  • JonGold/dataprocessor
  • totten/dataprocessor
  • TheSmammy/dataprocessor
  • kcristiano/dataprocessor
  • DaveD/dataprocessor
  • sebalis/dataprocessor
  • simon.hermann/dataprocessor
  • davej/dataprocessor
  • colemanw/dataprocessor
  • gngn/dataprocessor
  • david124136468769/dataprocessor
29 results
Show changes
Showing
with 1217 additions and 110 deletions
......@@ -88,6 +88,7 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
if ($this->_action != CRM_Core_Action::DELETE) {
$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);
$this->add('checkbox', 'is_exposed', E::ts('Field is exposed to the user'));
$this->add('select', 'type', E::ts('Select Field'), $this->outputHandlers, true, array(
'style' => 'min-width:250px',
......@@ -127,6 +128,11 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
$defaults['name'] = $this->field['name'];
}
}
if ($this->_action == CRM_Core_Action::ADD) {
$defaults['is_exposed'] = 1;
} elseif (isset($this->field['is_exposed'])) {
$defaults['is_exposed'] = $this->field['is_exposed'];
}
return $defaults;
}
......@@ -156,6 +162,7 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
$params['title'] = $values['title'];
$params['type'] = $values['type'];
$params['data_processor_id'] = $this->dataProcessorId;
$params['is_exposed'] = isset($values['is_exposed']) && $values['is_exposed'] ? 1 : 0;
if ($this->id) {
$params['id'] = $this->id;
}
......@@ -170,4 +177,4 @@ class CRM_Dataprocessor_Form_Field extends CRM_Core_Form {
parent::postProcess();
}
}
\ No newline at end of file
}
......@@ -22,6 +22,8 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
private $snippet;
private $filterCollections = [];
/**
* Function to perform processing before displaying form (overrides parent function)
*
......@@ -84,6 +86,9 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
$this->add('select', 'type', E::ts('Select Filter'), $factory->getFilters(), true, array('style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'placeholder' => E::ts('- select -'),));
$this->add('select', 'filter_collection_id', E::ts('Filter Collection'), $this->getFilterCollections(), false, array('style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'placeholder' => E::ts('Default Filter Collection'),));
$this->add('checkbox', 'is_required', E::ts('Is required'));
if ($this->filterTypeClass && $this->filterTypeClass->hasConfiguration()) {
......@@ -119,6 +124,9 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
if (isset($this->filter['name'])) {
$defaults['name'] = $this->filter['name'];
}
if (isset($this->filter['collection_id'])) {
$defaults['filter_collection_id'] = $this->filter['collection_id'];
}
if ($this->_action == CRM_Core_Action::ADD) {
$defaults['is_exposed'] = 1;
} elseif (isset($this->filter['is_exposed'])) {
......@@ -152,6 +160,7 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
}
$params['title'] = $values['title'];
$params['type'] = $values['type'];
$params['collection_id'] = $values['filter_collection_id'] ?? 'null';
$params['is_required'] = isset($values['is_required']) && $values['is_required'] ? 1 : 0;
$params['is_exposed'] = isset($values['is_exposed']) && $values['is_exposed'] ? 1 : 0;
if ($this->dataProcessorId) {
......@@ -171,4 +180,21 @@ class CRM_Dataprocessor_Form_Filter extends CRM_Core_Form {
parent::postProcess();
}
}
\ No newline at end of file
protected function getFilterCollections(): array {
if (empty($this->filterCollections)) {
$this->filterCollections = [];
try {
$filterCollections = civicrm_api3('DataProcessorFilterCollection', 'get', [
'data_processor_id' => $this->dataProcessorId,
'options' => ['limit' => 0],
]);
foreach ($filterCollections['values'] as $filterCollection) {
$this->filterCollections[$filterCollection['id']] = $filterCollection['title'];
}
} catch (CRM_Core_Exception $e) {
}
}
return $this->filterCollections;
}
}
......@@ -25,6 +25,11 @@ class CRM_Dataprocessor_Form_FilterValue extends CRM_Core_Form {
private $filter;
/**
* @var \Civi\DataProcessor\FilterCollection\FilterCollection
*/
private $filterCollection;
/**
* @var Civi\DataProcessor\FilterHandler\AbstractFilterHandler
*/
......@@ -47,18 +52,24 @@ class CRM_Dataprocessor_Form_FilterValue extends CRM_Core_Form {
$factory = dataprocessor_get_factory();
$this->dataProcessorId = CRM_Utils_Request::retrieve('data_processor_id', 'Integer');
$this->dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $this->dataProcessorId));
$this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor);
$this->dataProcessorClass = CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($this->dataProcessor, true);
$this->assign('data_processor_id', $this->dataProcessorId);
$this->id = CRM_Utils_Request::retrieve('id', 'Integer');
$this->assign('id', $this->id);
$filterCollectionNumber = CRM_Dataprocessor_BAO_DataProcessorFilterCollection::getFilterFilloctionNumberById($this->dataProcessorId, $this->id);
$this->filterCollection = $this->dataProcessorClass->getFilterCollectionByNumber($filterCollectionNumber);
$this->filter = civicrm_api3('DataProcessorFilter', 'getsingle', array('id' => $this->id));
$this->assign('filter', $this->filter);
$this->filterTypeClass = $factory->getFilterByName($this->filter['type']);
$this->filterTypeClass->setFilterCollection($this->filterCollection);
$this->filterTypeClass->setDataProcessor($this->dataProcessorClass);
$this->filterTypeClass->initialize($this->filter);
try {
$this->filterTypeClass->initialize($this->filter);
} catch (\Civi\DataProcessor\Exception\FilterRequiredException $ex) {
// Do nothing.
}
$title = E::ts('Data Processor Default Filter Value');
CRM_Utils_System::setTitle($title);
......@@ -68,7 +79,8 @@ class CRM_Dataprocessor_Form_FilterValue extends CRM_Core_Form {
$this->add('hidden', 'data_processor_id');
$this->add('hidden', 'id');
$this->filterTypeClass->addToFilterForm($this, $this->filter['filter_value']);
$filter = $this->filterTypeClass->addToFilterForm($this, $this->filter['filter_value']);
$this->assign('filter', $filter);
$this->assign('filter_template', $this->filterTypeClass->getTemplateFileName());
$this->addButtons(array(
......@@ -95,7 +107,6 @@ class CRM_Dataprocessor_Form_FilterValue extends CRM_Core_Form {
}
public function postProcess() {
$session = CRM_Core_Session::singleton();
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/edit', array('reset' => 1, 'action' => 'update', 'id' => $this->dataProcessorId));
$values = $this->exportValues();
$default_filter_value = $this->filterTypeClass->processSubmittedValues($values);
......@@ -107,4 +118,4 @@ class CRM_Dataprocessor_Form_FilterValue extends CRM_Core_Form {
parent::postProcess();
}
}
\ No newline at end of file
}
......@@ -19,7 +19,7 @@ class CRM_Dataprocessor_Form_Import extends CRM_Core_Form {
}
public function buildQuickForm() {
$this->add('file', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$this->add('file', 'uploadFile', ts('Import Data File'), ['size=30 maxlength=255'], TRUE);
$this->addButtons(array(
array('type' => 'next', 'name' => E::ts('Import'), 'isDefault' => TRUE,),
array('type' => 'cancel', 'name' => E::ts('Cancel'))
......@@ -33,11 +33,11 @@ class CRM_Dataprocessor_Form_Import extends CRM_Core_Form {
if($filetype != 'application/json'){
CRM_Core_Session::setStatus(E::ts('Imported file should be a json file'), '', 'error');
$redirectUrl = CRM_Utils_System::url('civicrm/dataprocessor/form/import', array('reset' => 1, 'action' => 'add'));
parent::preProcess();
CRM_Utils_System::redirect($redirectUrl);
}
else{
......@@ -54,4 +54,4 @@ class CRM_Dataprocessor_Form_Import extends CRM_Core_Form {
}
}
\ No newline at end of file
}
......@@ -29,18 +29,29 @@ class CRM_Dataprocessor_Form_ManageDataProcessors extends CRM_Core_Form {
$apiParams['is_active'] = 1;
}
$apiParams['options']['limit'] = 0;
$apiParams['options']['sort'] = 'title ASC';
$dataProcessors = civicrm_api3('DataProcessor', 'get', $apiParams);
$dataProcessors = $dataProcessors['values'];
foreach($dataProcessors as $idx => $dataProcessor) {
$dataProcessors[$idx]['status_label'] = CRM_Dataprocessor_Status::statusToLabel($dataProcessor['status']);
$outputs = civicrm_api3('DataProcessorOutput', 'get',['data_processor_id' => $dataProcessor['id'], 'options' => ['limit' => 0]]);
$outputTypeTitles = $factory->getOutputs();
foreach(CRM_Utils_Array::value('values', $outputs) as $outputIndex => $output) {
$outputClass = $factory->getOutputByName($output['type']);
if ($outputClass instanceof \Civi\DataProcessor\Output\UIOutputInterface) {
$outputTypeTitle = "";
if (isset($outputTypeTitles[$output['type']])) {
$outputTypeTitle = $outputTypeTitles[$output['type']];
}
$dataProcessors[$idx]['navigation'][$outputIndex]['type'] = $outputTypeTitle;
if ($outputClass instanceof \Civi\DataProcessor\Output\UIFormOutputInterface) {
$dataProcessors[$idx]['navigation'][$outputIndex]['url'] = CRM_Utils_System::url($outputClass->getUrlToUi($output, $dataProcessor), array('reset' => '1'));
$dataProcessors[$idx]['navigation'][$outputIndex]['title'] = $outputClass->getTitleForUiLink($output, $dataProcessor);
} elseif ($outputClass instanceof \Civi\DataProcessor\Output\UrlOutputInterface && $outputClass->checkPermission($output, $dataProcessor)) {
$dataProcessors[$idx]['navigation'][$outputIndex]['url'] = $outputClass->getUrl($output, $dataProcessor);
$dataProcessors[$idx]['navigation'][$outputIndex]['title'] = $outputClass->getTitleForLink($output, $dataProcessor);
}
}
}
......@@ -48,7 +59,7 @@ class CRM_Dataprocessor_Form_ManageDataProcessors extends CRM_Core_Form {
$session = CRM_Core_Session::singleton();
$qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
$urlPath = CRM_Utils_System::getUrlPath();
$urlPath = CRM_Utils_System::currentPath();
$urlParams = 'force=1';
if ($qfKey) {
$urlParams .= "&qfKey=$qfKey";
......@@ -77,4 +88,4 @@ class CRM_Dataprocessor_Form_ManageDataProcessors extends CRM_Core_Form {
}
}
\ No newline at end of file
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@ use CRM_Dataprocessor_ExtensionUtil as E;
class CRM_Dataprocessor_Upgrader_Base {
/**
* @var varies, subclass of this
* @var varies, subclass of ttis
*/
static $instance;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.