### Problem/Motivation

Steps to reproduce the problem:
- create a content type using "list" fields: List (integer), List (float), List (text), and Boolean
- create a view using the content type as base table
- add two filters on the same list field using the "Is one of" operator
- separate the filters into two groups
- connect the filter groups by "OR"; connect the filters in each group by "AND"
- optionally, expose the filters

Example:
group 1 (AND each filter)
- content type = type1
- published = true
- field_1 = value1A
- field_2 = value2A (exposed)
- field_3 = value3A (exposed)
OR
group 2 (AND each filter)
- content type = type1
- published = true
- field_1 = value1B
- field_2 = value2B (exposed)
- field_3 = value3B (exposed)

The join clauses for field_1 are:
INNER JOIN {field_data_field_1} field_data_field_1 ON
node.nid = field_data_field_1.entity_id AND
(field_data_field_1.entity_type = 'node' AND field_data_field_1.deleted = '0')

LEFT JOIN {field_data_field_2} field_data_field_2 ON
node.nid = field_data_field_2.entity_id AND
field_data_field_2.field_2_value != '1'

In the example, the second join clause is unnecessary and its presence causes the results to exclude desired values. It occurs because the code does not respect the filter groups when determining the join clause.

### Proposed resolution

Respect the filter groups when determining the join clause for this type of filter.

Class hierarchy for a "list" module field:

views_handler
views_handler_filter
views_handler_filter_in_operator
views_handler_filter_many_to_one
views_handler_filter_field_list

The offending code is in three methods of `views_many_to_one_helper` class: `ensure_my_table()`, `summary_join()`, and `add_table`.

### Remaining tasks

Review, write tests.

None.

### API changes

None.

CommentFileSizeAuthor
#14 KBsolotandem
PASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es). View
Members fund testing for the Drupal project. Learn more

## Comments

 Status: Active » Needs review
FileSize
4 KB
PASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es). View

The attached patch implements group checking for the many-to-one filter handler. Similar code appears in the many-to-one argument handler, but I did not test this and it will await a later patch.

I confirmed this, and the patch still applies to 7.x-3.x and works for me.