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

fixed issue with radio custom field and filter

parent 8a9d0185
No related branches found
No related tags found
No related merge requests found
......@@ -22,18 +22,39 @@ class CustomFieldSpecification extends FieldSpecification {
public $customFieldId;
public function __construct($custom_group_name, $custom_group_table_name, $custom_group_title, $id, $column_name, $name, $type, $title, $alias) {
$this->customFieldColumnName = $column_name;
public $customField;
public function __construct($custom_group_name, $custom_group_table_name, $custom_group_title, $field, $alias) {
$this->customField = $field;
$this->customFieldColumnName = $field['column_name'];
$this->customGroupName = $custom_group_name;
$this->customGroupTableName = $custom_group_table_name;
$this->customGroupTitle = $custom_group_title;
$this->customFieldId = $id;
$this->customFieldName = $name;
$this->customFieldTitle = $title;
$this->customFieldId = $field['id'];
$this->customFieldName = $field['name'];
$this->customFieldTitle = $field['label'];
$options = \CRM_Core_PseudoConstant::get('CRM_Core_BAO_CustomField', 'custom_' . $this->customFieldId, array(), 'search');
parent::__construct($field['column_name'], $field['data_type'], $custom_group_title. ': '.$this->customFieldTitle, $options, $alias);
$options = \CRM_Core_PseudoConstant::get('CRM_Core_BAO_CustomField', 'custom_' . $id, array(), 'search');
parent::__construct($column_name, $type, $custom_group_title. ': '.$title, $options, $alias);
}
/**
* Returns whether this field is a multiple select field.
*
* @return bool
*/
public function isMultiple() {
if (!$this->getOptions()) {
return false;
}
if ($this->type == 'Boolean') {
return false;
}
if ($this->customField['html_type'] == 'Radio') {
return false;
}
return true;
}
}
\ No newline at end of file
......@@ -97,7 +97,7 @@ class Utils {
$alias = $aliasPrefix . $customGroup['name'] . '_' . $field['name'];
$customFieldSpec = new CustomFieldSpecification(
$customGroup['name'], $customGroup['table_name'], $customGroup['title'],
$field['id'], $field['column_name'], $field['name'], $field['data_type'], $field['label'],
$field,
$alias
);
$dataSpecification->addFieldSpecification($customFieldSpec->name, $customFieldSpec);
......
......@@ -84,7 +84,7 @@ class SimpleSqlFilter extends AbstractFilterHandler {
*/
protected function isMultiValueField() {
if ($this->fieldSpecification instanceof CustomFieldSpecification) {
if ($this->fieldSpecification->type != 'Boolean' && $this->fieldSpecification->getOptions() != null) {
if ($this->fieldSpecification->isMultiple()) {
return TRUE;
}
}
......
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