Commit fa2220bc authored by jaapjansma's avatar jaapjansma
Browse files

Added hidden fields option to search outputs, dashboard output and contact summary tab output.

parent 2727203a
......@@ -23,6 +23,7 @@
* Added Case ID field on the activity source.
* Added field to display relationships.
* Added is not empty as a filter operator.
* Added hidden fields option to search outputs, dashboard output and contact summary tab output.
# Version 1.0.7
......
......@@ -46,6 +46,13 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show Contact ID field'), array(0=>'Contact ID is Visible', 1=> 'Contact ID is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -74,6 +81,9 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -110,6 +120,7 @@ class CRM_Contact_DataProcessorContactSearch implements UIOutputInterface {
public function processConfiguration($submittedValues, &$output) {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['help_text'] = $submittedValues['help_text'];
......
......@@ -96,6 +96,13 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
*/
public function buildConfigurationForm(\CRM_Core_Form $form, $output = []) {
$fieldSelect = \CRM_Dataprocessor_Utils_DataSourceFields::getAvailableFilterFieldsInDataSources($output['data_processor_id']);
$dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $output['data_processor_id']));
$dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataProcessor);
$fields = array();
foreach($dataProcessorClass->getDataFlow()->getOutputFieldHandlers() as $outputFieldHandler) {
$field = $outputFieldHandler->getOutputFieldSpecification();
$fields[$field->alias] = $field->title;
}
$form->add('select','permission', E::ts('Permission'), \CRM_Core_Permission::basicPermissions(), true, array(
'style' => 'min-width:250px',
......@@ -109,6 +116,13 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
'placeholder' => E::ts('- select -'),
));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this tab'), array('rows' => 6, 'cols' => 80));
$form->add('wysiwyg', 'no_result_text', E::ts('No Result Text'), array('rows' => 2, 'class' => 'huge'), false);
$form->add('text', 'weight', E::ts('Weight'));
......@@ -130,6 +144,9 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
if (isset($output['configuration']['contact_id_field'])) {
$defaults['contact_id_field'] = $output['configuration']['contact_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['default_limit'])) {
$defaults['default_limit'] = $output['configuration']['default_limit'];
}
......@@ -172,6 +189,7 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIOutputInterface {
public function processConfiguration($submittedValues, &$output) {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['no_result_text'] = $submittedValues['no_result_text'];
$configuration['weight'] = $submittedValues['weight'];
......
......@@ -25,6 +25,14 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\Outp
* @param array $output
*/
public function buildConfigurationForm(\CRM_Core_Form $form, $output = []) {
$dataProcessor = civicrm_api3('DataProcessor', 'getsingle', array('id' => $output['data_processor_id']));
$dataProcessorClass = \CRM_Dataprocessor_BAO_DataProcessor::dataProcessorToClass($dataProcessor);
$fields = array();
foreach($dataProcessorClass->getDataFlow()->getOutputFieldHandlers() as $outputFieldHandler) {
$field = $outputFieldHandler->getOutputFieldSpecification();
$fields[$field->alias] = $field->title;
}
$form->add('select','permission', E::ts('Permission'), \CRM_Core_Permission::basicPermissions(), true, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
......@@ -34,6 +42,13 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\Outp
$form->add('wysiwyg', 'help_text', E::ts('Help text for this dashlet'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$defaults = array();
if ($output) {
if (isset($output['permission'])) {
......@@ -46,6 +61,9 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\Outp
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['expanded_search'])) {
$defaults['expanded_search'] = $output['configuration']['expanded_search'];
}
......@@ -106,6 +124,7 @@ class CRM_DataprocessorDashlet_Dashlet implements Civi\DataProcessor\Output\Outp
$output['permission'] = $submittedValues['permission'];
$configuration['default_limit'] = $submittedValues['default_limit'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
}
......
......@@ -48,6 +48,13 @@ class CRM_DataprocessorSearch_ActivitySearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show Activity ID field'), array(0=>'Activity ID is Visible', 1=> 'Activity ID is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -74,6 +81,9 @@ class CRM_DataprocessorSearch_ActivitySearch implements UIOutputInterface {
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -111,6 +121,7 @@ class CRM_DataprocessorSearch_ActivitySearch implements UIOutputInterface {
$configuration['activity_id_field'] = $submittedValues['activity_id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
......
......@@ -53,6 +53,13 @@ class CRM_DataprocessorSearch_CaseSearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_fields', E::ts('Show Contact and Case ID field'), array(0=>'Contact and Case ID are Visible', 1=> 'Contact and Case ID are hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -82,6 +89,9 @@ class CRM_DataprocessorSearch_CaseSearch implements UIOutputInterface {
if (isset($output['configuration']['hide_id_fields'])) {
$defaults['hide_id_fields'] = $output['configuration']['hide_id_fields'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -118,6 +128,7 @@ class CRM_DataprocessorSearch_CaseSearch implements UIOutputInterface {
$output['permission'] = $submittedValues['permission'];
$configuration['contact_id_field'] = $submittedValues['contact_id_field'];
$configuration['case_id_field'] = $submittedValues['case_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_fields'] = $submittedValues['hide_id_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
......
......@@ -49,6 +49,13 @@ class CRM_DataprocessorSearch_ContributionSearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show Contribution ID field'), array(0=>'Contribution ID is Visible', 1=> 'Contribution ID is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -75,6 +82,9 @@ class CRM_DataprocessorSearch_ContributionSearch implements UIOutputInterface {
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -112,6 +122,7 @@ class CRM_DataprocessorSearch_ContributionSearch implements UIOutputInterface {
$configuration['contribution_id_field'] = $submittedValues['contribution_id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
......
......@@ -97,6 +97,9 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
if (!$this->isIdFieldVisible()) {
$hiddenFields[] = $this->getIdFieldName();
}
if (isset($this->dataProcessorOutput['configuration']['hidden_fields']) && is_array($this->dataProcessorOutput['configuration']['hidden_fields'])) {
$hiddenFields = array_merge($hiddenFields, $this->dataProcessorOutput['configuration']['hidden_fields']);
}
return $hiddenFields;
}
......
......@@ -90,4 +90,4 @@ class CRM_DataprocessorSearch_Form_Search extends CRM_DataprocessorSearch_Form_A
return $this->_taskList;
}
}
\ No newline at end of file
}
......@@ -49,6 +49,13 @@ class CRM_DataprocessorSearch_MembershipSearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show Membership ID field'), array(0=>'Membership ID is Visible', 1=> 'Membership ID is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -75,6 +82,9 @@ class CRM_DataprocessorSearch_MembershipSearch implements UIOutputInterface {
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -112,6 +122,7 @@ class CRM_DataprocessorSearch_MembershipSearch implements UIOutputInterface {
$configuration['membership_id_field'] = $submittedValues['membership_id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
......
......@@ -49,6 +49,13 @@ class CRM_DataprocessorSearch_ParticipantSearch implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show participant ID field'), array(0=>'Participant ID is Visible', 1=> 'Participant ID is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -75,6 +82,9 @@ class CRM_DataprocessorSearch_ParticipantSearch implements UIOutputInterface {
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -112,6 +122,7 @@ class CRM_DataprocessorSearch_ParticipantSearch implements UIOutputInterface {
$configuration['participant_id_field'] = $submittedValues['participant_id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
......
......@@ -49,6 +49,13 @@ class CRM_DataprocessorSearch_Search implements UIOutputInterface {
));
$form->add('select', 'hide_id_field', E::ts('Show ID field'), array(0=>'ID is Visible', 1=> 'ID field is hidden'));
$form->add('select', 'hidden_fields', E::ts('Hidden fields'), $fields, false, array(
'style' => 'min-width:250px',
'class' => 'crm-select2 huge',
'multiple' => true,
'placeholder' => E::ts('- select -'),
));
$form->add('wysiwyg', 'help_text', E::ts('Help text for this search'), array('rows' => 6, 'cols' => 80));
$form->add('checkbox', 'expanded_search', E::ts('Expand criteria form initially'));
......@@ -75,6 +82,9 @@ class CRM_DataprocessorSearch_Search implements UIOutputInterface {
if (isset($output['configuration']['hide_id_field'])) {
$defaults['hide_id_field'] = $output['configuration']['hide_id_field'];
}
if (isset($output['configuration']['hidden_fields'])) {
$defaults['hidden_fields'] = $output['configuration']['hidden_fields'];
}
if (isset($output['configuration']['help_text'])) {
$defaults['help_text'] = $output['configuration']['help_text'];
}
......@@ -99,7 +109,6 @@ class CRM_DataprocessorSearch_Search implements UIOutputInterface {
return "CRM/DataprocessorSearch/Form/OutputConfiguration/Search.tpl";
}
/**
* Process the submitted values and create a configuration array
*
......@@ -112,6 +121,7 @@ class CRM_DataprocessorSearch_Search implements UIOutputInterface {
$configuration['id_field'] = $submittedValues['id_field'];
$configuration['navigation_parent_path'] = $submittedValues['navigation_parent_path'];
$configuration['hide_id_field'] = $submittedValues['hide_id_field'];
$configuration['hidden_fields'] = $submittedValues['hidden_fields'];
$configuration['help_text'] = $submittedValues['help_text'];
$configuration['expanded_search'] = isset($submittedValues['expanded_search']) ? $submittedValues['expanded_search'] : false;
return $configuration;
......
......@@ -19,6 +19,11 @@
<div class="content">{$form.hide_id_field.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
......
......@@ -16,6 +16,11 @@
<div class="content">{$form.contact_id_field.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.no_result_text.label}</div>
<div class="content">{$form.no_result_text.html}</div>
......
......@@ -5,11 +5,17 @@
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.help_text.label}</div>
......
......@@ -15,14 +15,19 @@
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
<div class="label">{$form.hide_id_field.label}</div>
<div class="content">{$form.hide_id_field.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hide_id_field.label}</div>
<div class="content">{$form.hide_id_field.html}</div>
<div class="clear"></div>
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.help_text.label}</div>
......
......@@ -20,9 +20,14 @@
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hide_id_fields.label}</div>
<div class="content">{$form.hide_id_fields.html}</div>
<div class="clear"></div>
<div class="label">{$form.hide_id_fields.label}</div>
<div class="content">{$form.hide_id_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
......
......@@ -19,6 +19,11 @@
<div class="content">{$form.hide_id_field.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
......
......@@ -19,6 +19,11 @@
<div class="content">{$form.hide_id_field.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
......
......@@ -19,6 +19,11 @@
<div class="content">{$form.hide_id_field.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.hidden_fields.label}</div>
<div class="content">{$form.hidden_fields.html}</div>
<div class="clear"></div>
</div>
<div class="crm-section">
<div class="label">{$form.expanded_search.label}</div>
<div class="content">{$form.expanded_search.html}</div>
......
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