After upgrading to the new version of Date, the date filters in my views don't work anymore. It is as if nothing is entered. A look at the queries (thanks to the Devel module) shows that the values entered are not added to the SQL statement.

Passing a date by arg works, though.

I have the following things installed:

Drupal 5.1
PHP 5.2.0
MySQL 5.0.27

CCK 5.x-1.10
Views 5.x-1.6
Token 5.x-1.11
Date Tokens 5.x-1.x-dev

Comments

davidhk’s picture

Title: Date filters in Views don't work » Date filters in Views stop working after upgrade

I have the same problem. On a test copy of our live site just I've upgraded Date from 5.x-1.6 to 5.x-2.4, and after the upgrade the filters no longer work.

The rest of the site is running
Drupal 5.11
PHP 5.2.6

CCK 5.x-1.6-1
Views 5.x-1.6

Vuds’s picture

I also can confirm that. Version 2.3 works normally (and I have just downgraded to it because of this).

davidhk’s picture

Some more info:

I am using the 'Date: xxx - Year' filter, not the 'Date: xxx - Date' filter

It seems that when _date_views_filter_handler hits the 'Filter out 5.1 version values that won't work in 5.2.' code, the regex doesn't match, and the function exits without adding anything to the SQL (the first symptom reported above).

When using the Year filter, the value passed in will be a 4-digit year, not a full date, so the regex match will always fail. I'm not sure if the solution is to tweak the regex string, or to skip the test if the $filterinfo['type'] is 'YEAR' ?

Would it also be good to log a message if the regex match fails, as a heads-up to admin that there is something wrong?

karens’s picture

Status: Active » Postponed (maintainer needs more info)

None of the entries here give me any information about what kind of date field you're using for the filter or what kind of widget, whether it is exposed or not, how the view is set up, or anything else that would make it possible for me to reproduce the problem.

My filter work fine. You filters don't, but since I don't have a clue what is different between my setup and yours, there is nothing I can do.

#3 could be right, but I need lots more info to tell.

karens’s picture

Status: Postponed (maintainer needs more info) » Fixed

With a clue from a duplicate post in #273730: View filters for CCK Date field didn't properly upgrade I was able to figure out that this is a problem in the YEAR filter that doesn't affect the DATE filter I was using. It would also affect the MONTH and DAY filters. I've committed a fix.

For future reference, there are several different filters and they all behave differently depending on what kind of date field and what kind of widget is being used, so I need information about what you're using to be able to do anything with these reports.

jdelaune’s picture

Have you got a patch we can apply to get things working? My filter of between now and now +6 days isn't working and it really needs to be.

Cheers

davidhk’s picture

I've downloaded the new 2.5 version, and confirm it has fixed the problem I reported. Thanks for the quick turnaround.

ontoligent’s picture

My searches work now as well, for the most part -- except for the "now" value. But I will raise that as a separate issue if I can't work it out. Thanks for your work!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.