I am getting the following error with Drupal 4.7, event, event repeat, event_views, and JS calendar. The event views module doesn't seem to ever find any of the events in the database:

gmmktime() expects parameter 4 to be long, string given in C:\Program Files\xampp\htdocs\mysite\modules\event\event.module on line 248.

Also, based on a concurrent error, this might also relate to flexinode or the version of MySQL?:

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 '; 1149480660 + 0) AND (event.event_end < 1149912721 + 0) LIMIT 0, 10' at line 1 query: SELECT node.nid FROM node node WHERE (node.status = '1') AND (node.type IN ('event','flexinode-1','flexinode-13','flexinode-3','flexinode-6','flexinode-7','flexinode-18')) AND (event.event_start < 1149480660 + 0) AND (event.event_end < 1149912721 + 0) LIMIT 0, 10 in C:\Program Files\xampp\htdocs\mysite\includes\database.mysql.inc on line 120.

I get a lot of these errors when using event.views, etc. , but not with the plain old event and event repeat.

Comments

karens’s picture

Version: 5.x-2.x-dev »

I am wondering if it needs parantheses around things like

event.event_end < 1149912721 + 0 

to make it

event.event_end < (1149912721 + 0)

That bit of code is coming from the views_handler_filter_timestamp function in the views.module. If are where you can do it, try changing the following line in that module:

from:

$query->add_where("%s %s %s + %d",...

to:

$query->add_where("%s %s (%s + %d)"...

I'm not where I can post a patch or test this right now, but that may be what's needed. If you can't do it, I'll try testing that tomorrow...

karens’s picture

Nevermind the above suggestion. I see that there needs to be a join to the event table that is missing in your query and it is a bug in the current cvs of the event_views module. I will be posting an updated event views module soon, and I'll make sure that fix is in there so you can test it.

karens’s picture

I an now replicate the problem. It happens if you create a view with no event fields and try to filter it using the jscalendar filter. The jscalendar filter is a generic filter from the views module that doesn't add a join to the event table, so I need to find a way to force it to do that. If you add an event field to the view, the problem will disappear because the field will set up the table join, it is just a problem if you don't add any event fields to the vew.

Anyway, you can get it working until I have a fix posted by adding an event field to your view.

bomarmonk’s picture

I'll give it a try. Thanks for tracking the problem down! Part user error, I would guess. However, I am using the default "event views" when I get this error. I need to edit the default views and add fields to them?

karens’s picture

That's strange. The default views should all have fields in them. I'm getting ready to post an update in the next day or so anyway, so I'll confirm that the fields are in the default views, but they should be.

karens’s picture

Status: Active » Fixed

The latest version in cvs has the fix in it.

jwilde’s picture

Status: Fixed » Active

Hi Karen,

I'm getting the same sql errors as Bomarmonk using the 4.7 event views with event selector. I also tried the latest cvs and get the same errors as well as an array error on the links calendar. Any ideas what I might be doing incorrectly? I'm at wits end - help.

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 '; (1150796424 + 0)) AND (event.event_end > (1150796424 + 0))' at line 1 query: SELECT count(*) FROM node node LEFT JOIN event event ON node.nid = event.nid WHERE (node.status = '1') AND (node.type IN ('event')) AND (event.event_start > (1150796424 + 0)) AND (event.event_end > (1150796424 + 0)) in /home/test/public_html/test2/includes/database.mysql.inc on line 120.

Thanks,

Jim

bomarmonk’s picture

Well, I have it working now without errors: try installing the latest 4.7 version of the event module, including event.views (instead of CVS)

jwilde’s picture

Thanks Bomarmonk. I tried those versions on a fresh install of 4.72 and continue to get errors.

karens’s picture

The sql you posted looks valid and the join seems to be in there, so I don't know why you are getting errors. Do you have something like phpadmin where you can try to manually execute that sql and see what happens (by pasting the sql into a sql box). Also, can you export a copy of the view you are using and paste it here. Maybe there's something funky in your view.

karens’s picture

One more thought. Look closely at your sql. Do you by any chance see sql that looks something like:

&gt;

instead of

>

If so, this is the views bug reported at http://drupal.org/node/66928.

jwilde’s picture

Thanks KarenS for all of your help! The sql was > instead of >. I applied your patch and it works great. Thanks again!

Jim

karens’s picture

Status: Active » Closed (won't fix)

This ended up being a couple different bugs, but I think all are fixed except for the views bug which requires a patch to views and cannot be fixed in this module, so I am marking this issue fixed.