Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.6-beta5
Component:
exposed filters
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jun 2008 at 16:06 UTC
Updated:
10 Sep 2009 at 22:40 UTC
The default views filter handler makes assumptions about the operators in use when a submitted value is not an array. However, force single in exposed filters has the effect of making values submitted from a filter defined as #multiple to come through as a single value. As a result, you get a SQL query that looks like [fieldname] OR [filtervalue], which of course results in 0 results. Should be [fieldname] IN([filtervalue]). The first few lines of views_handler_filter_default could be updated as follows. Not entirely sure of further implications:
function views_handler_filter_default($op, $filter, $filterinfo, &$query) {
$table = $filterinfo['table'];
$field = $filterinfo['field'];
if(!is_array($filter['value']) && $filterinfo['value']['#multiple']) $filter['value'] = array($filter['value']);
Comments
Comment #1
onelittleant commentedOk, there's actually better logic to apply in views_handler_filter_default. Instead of the above, it would be appropriate to check the operator that is in use when we are dealing with a singleton filter value. The better change would be to change the last few lines of the function to (apologies, not familiar w/patches at this point):
Comment #2
drupdrips commentedGood work!! I got bitten by this and your fix works for me. I also verified the query output from DEVEL and it is working for me at least. Thanks for tackling this.
Comment #3
sunPlease supply a proper patch.
Comment #4
esmerel commentedNo update for more than 30 days.