Hello,

Ive created a CCK content type that has a date field for the purposes of explaining it here I'll call it "my event content type", I also have catagories of events that I want to filter in/out at different parts of the website I'm working on.

I'm sucessfully displaying the callendar with a list of all "my event content type" occuring this month, however, when I put together a filter I'm having problems.

I create a filter and no matter what I filter on (Iv'e tried creating a taxonimy and adding a catagory field to my content type) when I expose the filter to create the dropdown and select "Opperator: is all of" the initial rendiring of the calendar works fine, however when I select from the combo box to filter out for specific "my event content type" I get an error...

* warning: Invalid argument supplied for foreach() in /var/www/html/drupal/sites/all/modules/views/includes/handlers.inc on line 539.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ((STR_TO_DATE(node_data_field_event_date.field_event_date_value, '%Y-%' at line 12 query: SELECT node.nid AS nid, node_data_field_event_date.field_event_date_value AS node_data_field_event_date_field_event_date_value, node_data_field_event_date.field_event_date_value2 AS node_data_field_event_date_field_event_date_value2, node.title AS node_title, node.changed AS node_changed, node_revisions.body AS node_revisions_body, node_revisions.format AS node_revisions_format, node.type AS node_type FROM node node LEFT JOIN content_type_events node_data_field_event_date ON node.vid = node_data_field_event_date.vid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid WHERE () AND ((STR_TO_DATE(node_data_field_event_date.field_event_date_value, '%Y-%m-%dT%T') >= '2008-07-01 00:00:00' AND STR_TO_DATE(node_data_field_event_date.field_event_date_value, '%Y-%m-%dT%T') <= '2008-07-31 23:59:59')) in /var/www/html/drupal/sites/all/modules/views/includes/view.inc on line 681.

I can see where the error is, it's the empty WHERE()

and line 681 of view.inc is where the SQL gets exicuted, however I can't find the algorithm that puts together the SQL code. if anyone could help me out with either...

a) Point me in the direction of where the SQL gets generated
b) Let me know if there is a way to put my own SQL in (rather than use the gui to generate it)

that would be greatly appreciated

PS: if I hide the combo box and hard code the "Opperator:is all of: <value>" then it works.

Thank you.
Chris.

Comments

KarenS’s picture

Project: Views (for Drupal 7) » Date
Version: 6.x-2.0-rc1 » 6.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

This looks more like a Date issue. Switch to the very latest Date code and see if you still have a problem. There have been lots of fixes to the filters.

yeahgday’s picture

Hello, I've updated to the latest date module and it's still happening.
I don't think it's date because in the two where clauses that should be generated by views, the date in the where clause is present, but the catagory (in my case catagory is a CCK Text field) isn't generated.

KarenS’s picture

Status: Postponed (maintainer needs more info) » Fixed

This is an old issue and we have a newer release with lots of fixes, so assuming fixed unless I hear back that the problem still exists in the latest release. There are new releases of Date, Calendar, Views, and CCK and you need all of them.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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