Closed (fixed)
Project:
Resource Conflict
Version:
6.x-2.0
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
28 Sep 2009 at 15:44 UTC
Updated:
13 Jun 2010 at 20:00 UTC
Jump to comment: Most recent file
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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | resource_conflict-2.0-590200-1.patch | 1.23 KB | raphaelhuefner |
| #5 | resource_conflict-2.x-dev-590200-1.patch | 1.33 KB | raphaelhuefner |
| #4 | resource_conflict-2.0-590200.patch | 2.03 KB | raphaelhuefner |
| #4 | resource_conflict-2.x-dev-590200.patch | 2.15 KB | raphaelhuefner |
Comments
Comment #1
deviantintegral commentedYes, 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 :).
Comment #2
raphaelhuefner commentedI'm working on this for one of my clients. Hope to have a patch out until 2010-03-14.
Comment #3
deviantintegral commentedThanks for the update - I'll be glad to review whatever you come up with.
Comment #4
raphaelhuefner commentedI 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.Comment #5
raphaelhuefner commentedNew 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
Comment #6
raphaelhuefner commentedComment #7
deviantintegral commentedThanks 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?
Comment #8
deviantintegral commentedI've committed the patch in #5.