Posted by willeaton on September 28, 2009 at 3:44pm
| Project: | Resource Conflict |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | raphaelhuefner |
| Status: | closed (fixed) |
Issue Summary
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
#1
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 :).
#2
I'm working on this for one of my clients. Hope to have a patch out until 2010-03-14.
#3
Thanks for the update - I'll be glad to review whatever you come up with.
#4
I went for the
JOIN ... ON {node}.vidsolution. 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.#5
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
#6
#7
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?
#8
I've committed the patch in #5.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.