DESCRIPTION OF BUG:
================
Date CCK fields do not show up in the Filters list when creating or editing a View.
This has been reproduced in both 6.x-2.x-dev and 6.x-2.0-rc6, on windows and on linux.
If I add other, non-Date CCK fields to the content type, they DO show up in the list of filters (eg text fields, number fields, etc), which is what leads me to believe that the date fields should be showing as well.
I've marked this as critical, as it prevents filtering by date, making the creation of date fields mostly useless, other than as nonfunctional labels.
HOWEVER, given others are reporting bugs with cck date field filtering (eg http://drupal.org/node/367970), I suspect I may be doing something wrong, if I'm not seeing these filters at all. This is why I've described the setup below in such detail, and tested so thoroughly.
SETUP
=====
To minimally reproduce this, I created the following setup:
System 1:
Drupal 6.9
Windows XP SP3
Apache 2.2.11
PHP 5.2.8
MySQL 5.1.31
System 2:
Drupal 6.9
Fedora Core release 3 kernel 2.6.11.9-050512a
Apache 2.2.4
PHP 5.2.6
MySQL 5.0.41
Modules enabled:
Content 6.x-2.1
Database logging 6.9
Date 6.x-2.x-dev
Date API 6.x-2.x-dev
Date Popup 6.x-2.x-dev
Date Timezone 6.x-2.x-dev
Date Tools 6.x-2.x-dev
Views 6.x-2.3
Views UI 6.x-2.3
Plus the "Core - required" modules. No other modules were enabled.
The only external modules installed, to sites/all/modules, were:
cck
views
date
STEPS TO REPRODUCE:
=================
I created a new content type, added a date field with popup, like so:
Content name: testtype
Type: testtype
Description: (empty)
Field name: testdate
Field label: testdate
Field type: date
Widget: Text field with popup calendar.
Granularity: year, month, day
Timezone settings: none
All other settings default.
Then I went to the Views->add
View name: testview
View description: testview
View type: node
View tag: (empty)
I clicked the "+" by "Fields" and see:
Content: test date - (field_testdate)
Date - Appears in: test type
I clicked the "+" by "Filters" and see no "Content:..." types listed in the filters.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 376224-9.patch | 2.66 KB | les lim |
| #6 | 376224.patch | 2.39 KB | les lim |
| #3 | date_090218.gif | 5.62 KB | szy |
Comments
Comment #1
Dewi Morgan commentedJust noting (since I forgot to mention) that the dev version I tested against was 2009-Feb-18.
Comment #2
szy commentedLook for 'Date' group, instead of 'Content', in the filters list.
Szy.
Comment #3
szy commentedBut - actually, there are missing date field names in the latest dev. You can see only
'value' and 'value2' on the list, here - this is your date field:
-> http://drupal.org/files/issues/date_090218.gif
Check 'value' as it stands for 'From' date.
Szy.
Comment #4
szy commentedComment #5
Dewi Morgan commentedExcellent, thank you.
Since you point out the names are missing, I'll not mark this one as "Support request: fixed", but I'll mark it as "minor" at least, since that's (imho) just a cosmetic issue that doesn't affect functionality and isn't visible to end users.
Thanks again!
Comment #6
les limFound it! There are some problems with _date_field_settings() in date_admin.inc that are causing field titles to get lost when the module has to create new fields for "To" dates. This patch should get the field titles back in.
As a bonus, since it was right here anyway, the patch replaces the value and value2 descriptors with 'From' date and 'To' date, respectively. Does anybody know if this would cause problems with translations?
Comment #7
les limComment #8
les limComment #9
les limSame patch as #6 but using t() with "From date" and "To date". Remember to flush the views cache after applying.
Comment #10
TheSmegHead commentedThis patch works for me, the names of the Content From and To dates are now exposed in the View UI. But the Views filter for those fields still does not work. I have the filter:
Content: Date - (field_time) - From date >= Now
which has no affect on the view.
Comment #11
les limTheSmegHead: I'm pretty sure you're experiencing #386406: After module upgrade, Views filter value "now" incorrectly outputs 2009-01-01, which KarenS fixed in CVS this morning (though there isn't a release yet). Try checking it out directly from CVS.
Comment #12
TheSmegHead commentedThanks lesmana and KarenS, yesterday's CVS solved the filter problem. I note that the this does not include the patch that re-exposes the Date field names in Views, which still has to be applied manually.
Comment #13
joostvdl commentedSame problem here. I don't think this can be set as a cosmetic problem. Especially with multiple content types. Then there is a long list of not traceable fields.
Comment #14
arlinsandbulte commentedI agree this is not just a cosmetic problem. If you have multiple Date Fields to choose from, it is impossible to tell which is the right one to select when building filters (they are all called 'value'
Comment #15
les limjoostvdl, arlinsandbulte: did you try applying the patch in #9 yet?
Comment #16
Anonymous (not verified) commentedPatch worked for me. Date field names are back and have been given the 'To' or 'From' suffixes (much better). Thanks!
Comment #17
arlinsandbulte commentedNope, I did not apply the patch (and probably won't).
I don't do much programming... mostly just a user.
Comment #18
joostvdl commented@lesmana: Yes I did install the patch. From then it worked ok.
Comment #19
karens commentedThere was a small bug in the patch, you used 'title_short' instead of 'title short' which created some PHP notices, so I fixed that and committed this.
Thanks!
Comment #20
les limThanks, Karen! I must've added the underscore purely by reflex.
Comment #21
arlinsandbulte commentedJust wanted to confirm: The Latest Date 6.x-2.x-dev (March 4, 2009 - 00:05) FIXED this issue