Closed (fixed)
Project:
Resource Conflict
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Jan 2010 at 19:50 UTC
Updated:
13 Jun 2012 at 15:18 UTC
I'm working at a booking application for my company where employees can book an instrument for a day or more.
So I created a Booking Content Type with a Date field (from to date) with granularity set to Day
But I noticed that if I book something from day 1 to day 5 then I try to book from day 5 to day 7 the system accept that because the date is from day 1 h 00:00 to day 5 h 00:00 so the second booking isn't overlapping
I don't know how ResConf does the check on the dates, but is there the chance to let it look only up to the day without checking the hours?
Comments
Comment #1
deviantintegral commentedIt partially depends on how Date is storing dates for when the date granularity is "Day". Do we know for sure it's using midnight?
The module is built so that, like a calendar, events overlapping on a minute don't block availability. Day-bookings break that assumption, as the end date should be blocked.
I think the best solution is to have it check the granularity setting of the field, and if it's set to "day" (or month / year?) use a different algorithm.
Comment #2
garg commentedI'm new to drupal so I'm trying to figure out how I can check the granularity set for the datetime field for the content type. If it is set to "day" then I think changing the query to:
Where I have changed
to
appears to work so that if there exists an event from
17-Feb to 19-Feb
Then events from
15-Feb to 17-Feb
and
19-Feb to 23-Feb
will cause a conflict.
Comment #3
deviantintegral commentedYou should be able to get the field information by calling
content_fields($date_field). Install the devel module and dpr() the return of that function to check. Then you should be able to wrap an if around $query to set it properly.Comment #4
keyiyek commented@garg: I'm new too, where can I find this query?
ok I found it, thanks it works!
Comment #5
Balbo commented@garg: I'm new too, where can I find this query?
:-/
Comment #6
ohthehugemanatee commented