If I have revisions turned on for the content type that I am using for resource conflict, then it doesn't check that its only checking the current version's date. To explain...

I create a "Booking" with date 01/10/09 - 02/10/09
I then modify the booking to 03/10/09 - 04/10/09
with revisions turned on, there is an entry in the "content_type_booking" table in the database for both revisions.

The resource conflict is not checking for only the current revision, it kind of is but if I have understood correctly, in an incorrect manner. In resource_conflict.module line 384, instead of:

$query = "SELECT DISTINCT nid FROM $date_table
WHERE('%s' >= $start_field_name AND '%s' < $end_field_name)
OR('%s' > $start_field_name AND '%s' <= $end_field_name)
OR('%s' <= $start_field_name AND '%s' >= $end_field_name)";

Maybe...

$query = "SELECT MAX(vid) FROM $date_table
WHERE('%s' >= $start_field_name AND '%s' < $end_field_name)
OR('%s' > $start_field_name AND '%s' <= $end_field_name)
OR('%s' <= $start_field_name AND '%s' >= $end_field_name)";

and then query the vid?

Thanks
Will Eaton
Drupal Developer
http://www.williameaton.co.uk

Comments

deviantintegral’s picture

Priority: Normal » Critical

Yes, that sounds reasonable. Doing by only nid is a bit of an oversight.

I'm marking as critical, since revisions are a core feature. Instead of MAX(), it should probably be a join from {node}.vid. Feel free to write up a patch :).

raphaelhuefner’s picture

Assigned: Unassigned » raphaelhuefner

I'm working on this for one of my clients. Hope to have a patch out until 2010-03-14.

deviantintegral’s picture

Thanks for the update - I'll be glad to review whatever you come up with.

raphaelhuefner’s picture

I went for the JOIN ... ON {node}.vid solution. The biggest delay was to separate this change from the change for #641850: repeat dates are not checked for conflicts in my working copy, which also modifies the SQL.

raphaelhuefner’s picture

New patches, replacing the ones in #4. This time without wrong event table SQL. I shouldn't have touched the event-module-integration stuff, in the first place.

BTW: integration of the event module seems to be broken, at least with their current 2.x-dev version, which I checked as detailed here: http://drupal.org/node/3238/cvs-instructions/HEAD

raphaelhuefner’s picture

Status: Active » Needs review
deviantintegral’s picture

Thanks for the note about Event integration. Due to the state of Event, I'm tempted to remove Event support entirely. That will likely happen for D7, but belongs in a new issue.

The code looks good on this - anyone else given it a try?

deviantintegral’s picture

Status: Needs review » Fixed

I've committed the patch in #5.

Status: Fixed » Closed (fixed)

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