Revisions causes wrong conflicts

willeaton - September 28, 2009 - 15:44
Project:Resource Conflict
Version:6.x-2.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

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

#1

deviantintegral - September 29, 2009 - 02:42
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 :).

 
 

Drupal is a registered trademark of Dries Buytaert.