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.

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new985 bytes

I propose just overriding the method in date_views_filter_handler to also check for arrays without values. Or should we already include it in the method definition in the parent class?

herd45’s picture

I had an issue where Views Selective Filters was not working on the initial page load. This patch fixed the problem.

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll, +Needs rework

The 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.

Checking patch date_views/includes/date_views_filter_handler.inc...
error: while searching for:
    return $options;
  }

  function op_between($field) {
    $this->date_combine_conditions('op_between');
  }

error: patch failed: date_views/includes/date_views_filter_handler.inc:30
error: date_views/includes/date_views_filter_handler.inc: patch does not apply
drunken monkey’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll, -Needs rework
StatusFileSize
new921 bytes

Re-roll attached.

chris matthews’s picture

Thanks 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.

Checking patch date_views/includes/date_views_filter_handler.inc...
Applied patch date_views/includes/date_views_filter_handler.inc cleanly.