Event nodes that have a start/end date of, say May 15, show up on the calendar on April 15, despite the fact that the page for the node does in fact display May. Oddly enough, on my personal login the display is correct, however on all the other usernames I've tried, this problem occurs.

Comments

keschrich’s picture

After a bit of debugging I've found that changing the line:

$result = db_query(db_rewrite_sql('SELECT n.nid FROM {event} e INNER JOIN {node} n USING (nid) WHERE n.status = 1 AND e.start > %d AND e.start < %d ORDER BY e.start'), $first, $last);

in event.module to:

$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.type, n.status, n.moderate, e.start FROM {node} n INNER JOIN {event} e USING (nid) WHERE n.status = 1 AND n.moderate = 0 AND e.start >= $time ORDER BY e.start"), 0, $limit);

solves the problem, although (at least so far as I understand the db_rewrite_sql command...err..aka not at all) this may break compatibility with other database servers.

keschrich’s picture

/me continues to be an idiot..

i pasted the wrong line, it should be changed to:

$result = db_query("SELECT n.nid FROM event AS e INNER JOIN node AS n USING (nid) WHERE n.status = 1 AND e.start > $first AND e.start < $last ORDER BY e.start");

sorry about the discrepancy

Anonymous’s picture

This looks like a bug in db_rewrite_sql(), because AFAICT the two queries are functionally identical. Should the issue be moved to the Drupal project?

(Note I have not confirmed this behavior myself)

crunchywelch’s picture

Assigned: Unassigned » crunchywelch

This is an old query which has been rewritten several times, and i believe that db_rewrite has also had patches as well. I cannot reproduce this problem on my sandboxes, please reopen if you have more information and can reproduce this behaviour on the updated versions.