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.

CommentFileSizeAuthor
#9 376224-9.patch2.66 KBles lim
#6 376224.patch2.39 KBles lim
#3 date_090218.gif5.62 KBszy

Comments

Dewi Morgan’s picture

Just noting (since I forgot to mention) that the dev version I tested against was 2009-Feb-18.

szy’s picture

I clicked the "+" by "Filters" and see no "Content:..." types listed in the filters.

Look for 'Date' group, instead of 'Content', in the filters list.

Szy.

szy’s picture

StatusFileSize
new5.62 KB

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

szy’s picture

Title: Date CCK Field does not appear in Views filter. » Names of date fields missing in Views filter
Dewi Morgan’s picture

Priority: Critical » Minor

Excellent, 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!

les lim’s picture

Title: Names of date fields missing in Views filter » 'From' and 'To' field titles get lost when provided to Views
Version: 6.x-2.x-dev » 6.x-2.0
Component: Date CCK Field » Date API
Assigned: Unassigned » les lim
Priority: Minor » Normal
Status: Active » Needs review
StatusFileSize
new2.39 KB

Found 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?

les lim’s picture

Assigned: les lim » Unassigned
les lim’s picture

Version: 6.x-2.0 » 6.x-2.x-dev
les lim’s picture

StatusFileSize
new2.66 KB

Same patch as #6 but using t() with "From date" and "To date". Remember to flush the views cache after applying.

TheSmegHead’s picture

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

les lim’s picture

TheSmegHead: 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.

TheSmegHead’s picture

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

joostvdl’s picture

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

arlinsandbulte’s picture

I 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'

les lim’s picture

joostvdl, arlinsandbulte: did you try applying the patch in #9 yet?

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Patch worked for me. Date field names are back and have been given the 'To' or 'From' suffixes (much better). Thanks!

arlinsandbulte’s picture

Nope, I did not apply the patch (and probably won't).
I don't do much programming... mostly just a user.

joostvdl’s picture

@lesmana: Yes I did install the patch. From then it worked ok.

karens’s picture

Status: Reviewed & tested by the community » Fixed

There 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!

les lim’s picture

Thanks, Karen! I must've added the underscore purely by reflex.

arlinsandbulte’s picture

Just wanted to confirm: The Latest Date 6.x-2.x-dev (March 4, 2009 - 00:05) FIXED this issue

Status: Fixed » Closed (fixed)

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