Commit 43d2d9ce authored by ufundo's avatar ufundo

Fix handling of multiple group selection for filter

parent 8f7d3682
......@@ -51,8 +51,9 @@ class ContactInGroupFilter extends AbstractFieldFilterHandler {
$this->resetFilter();
$dataFlow = $this->dataSource->ensureField($this->inputFieldSpecification);
$group_ids = $filter['value'];
if (!is_array($group_ids)) {
$group_ids = array($group_ids);
if (!is_array($group_ids)) {
$group_ids = explode(",", $group_ids);
}
// If the groups are smartgroups (saved searches) they may be out of date.
......@@ -207,12 +208,14 @@ class ContactInGroupFilter extends AbstractFieldFilterHandler {
$sizeClass = 'huge';
$minWidth = 'min-width: 250px;';
if ($size =='compact') {
$sizeClass = 'medium';
$minWidth = '';
}
$api_params['is_active'] = 1;
if ($this->parent_group_id) {
$childGroupIds = \CRM_Contact_BAO_GroupNesting::getDescendentGroupIds([$this->parent_group_id], FALSE);
$api_params['id']['IN'] = $childGroupIds;
......@@ -224,6 +227,7 @@ class ContactInGroupFilter extends AbstractFieldFilterHandler {
'multiple' => FALSE,
'placeholder' => E::ts('- select -'),
]);
$form->addEntityRef( "{$fieldSpec->alias}_value", NULL, array(
'placeholder' => E::ts('Select a group'),
'entity' => 'Group',
......@@ -238,6 +242,7 @@ class ContactInGroupFilter extends AbstractFieldFilterHandler {
} else {
$defaults[$alias . '_op'] = key($operations);
}
if (isset($defaultFilterValue['value'])) {
$defaults[$alias.'_value'] = $defaultFilterValue['value'];
}
......
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