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

Changed behaviour of hidden fields on search output

parent 09c5244c
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,19 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce ...@@ -84,6 +84,19 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
return true; return true;
} }
/**
* Returns an array with hidden columns
*
* @return array
*/
protected function getHiddenFields() {
$hiddenFields = array();
if (!$this->isIdFieldVisible()) {
$hiddenFields[] = $this->getIdFieldName();
}
return $hiddenFields;
}
/** /**
* Returns the url for view of the record action * Returns the url for view of the record action
* *
...@@ -278,19 +291,12 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce ...@@ -278,19 +291,12 @@ abstract class CRM_DataprocessorSearch_Form_AbstractSearch extends CRM_Dataproce
*/ */
protected function addColumnHeaders() { protected function addColumnHeaders() {
$sortFields = array(); $sortFields = array();
$id_field = $this->getIdFieldName(); $hiddenFields = $this->getHiddenFields();
$idFieldVisible = $this->isIdFieldVisible();
$columnHeaders = array(); $columnHeaders = array();
$sortColumnNr = 1; $sortColumnNr = 1;
foreach($this->dataProcessorClass->getDataFlow()->getOutputFieldHandlers() as $outputFieldHandler) { foreach($this->dataProcessorClass->getDataFlow()->getOutputFieldHandlers() as $outputFieldHandler) {
$field = $outputFieldHandler->getOutputFieldSpecification(); $field = $outputFieldHandler->getOutputFieldSpecification();
$hiddenField = true; if (!in_array($field->alias, $hiddenFields)) {
if ($field->alias != $id_field) {
$hiddenField = false;
} elseif ($field->alias == $id_field && $idFieldVisible) {
$hiddenField = false;
}
if (!$hiddenField) {
$columnHeaders[$field->alias] = $field->title; $columnHeaders[$field->alias] = $field->title;
$sortFields[$sortColumnNr] = array( $sortFields[$sortColumnNr] = array(
'name' => $field->title, 'name' => $field->title,
......
...@@ -106,4 +106,30 @@ class CRM_DataprocessorSearch_Form_CaseSearch extends CRM_DataprocessorSearch_Fo ...@@ -106,4 +106,30 @@ class CRM_DataprocessorSearch_Form_CaseSearch extends CRM_DataprocessorSearch_Fo
return $this->_taskList; return $this->_taskList;
} }
/**
* Returns whether the ID field is Visible
*
* @return bool
*/
protected function isIdFieldVisible() {
if (isset($this->dataProcessorOutput['configuration']['hide_id_fields']) && $this->dataProcessorOutput['configuration']['hide_id_fields']) {
return false;
}
return true;
}
/**
* Returns an array with hidden columns
*
* @return array
*/
protected function getHiddenFields() {
$hiddenFields = array();
if (!$this->isIdFieldVisible()) {
$hiddenFields[] = $this->getIdFieldName();
$hiddenFields[] = $this->getContactIdFieldName();
}
return $hiddenFields;
}
} }
\ No newline at end of file
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