I'm sorry if this issue already exists somewhere, but I couldn't find anything.
Anyways, while I can't explain exactly how it happens (you probably know what nightmare debugging through Views code quickly becomes), the $input parameter passed to date_views_filter_handler::get_filter_value() sometimes contains the following when there is no user input and the operator is "(not) between":
array(
'year' => NULL,
'month' => NULL,
)
However, the code then just checks whether empty($input), and even though the above obviously contains no usable user input, that check will still evaluate to FALSE, which means the default value will not be used.
In the end, this results in a DB condition like the following:
(DATE_FORMAT(dim_snapshot_month_comms.datetime, '%Y-%m') >= '' AND DATE_FORMAT(dim_snapshot_month_comms.datetime, '%Y-%m') <= '')
Which, of course, won't return any results.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2634952-5--default_filter_value_not_applied.patch | 921 bytes | drunken monkey |
Comments
Comment #2
drunken monkeyI propose just overriding the method in
date_views_filter_handlerto also check for arrays without values. Or should we already include it in the method definition in the parent class?Comment #3
herd45 commentedI had an issue where Views Selective Filters was not working on the initial page load. This patch fixed the problem.
Comment #4
chris matthews commentedThe 3 year old patch in #2 to date_views_filter_handler.inc does not apply to the latest 7.x-2.x-dev and may be too old to reroll, but I went ahead and tagged the issue accordingly.
Comment #5
drunken monkeyRe-roll attached.
Comment #6
chris matthews commentedThanks Thomas, the rerolled patch in #5 now applies cleanly to the latest 7.x-2.x-dev, but it would be good for someone else to review and test before changing the status to RTBC.