The simplest use case for Resource Conflict is to be able to book rooms for events. In this example, we'll set up Resource Conflict to enable booking of a room for a Drupal User Group. To follow these steps, you'll need:

All of these modules should be installed and enabled before continuing. As well, all of the images below are links to the full-size versions, so be sure to click them if you're having problems finding things.

Step 1: Add a "Room" content type

Each node of the type "Room" will contain information about an individual room within the building. In this simple example, a Room simply contains a title (the name of the room) and a body describing any notes about the room. More advanced configurations may contain additional fields to store the building, room number, or other attributes about the room.

To add a content type, browse to Administer > Content management > Content types, and click on Add content type.

Set the name of the content type to Room, and the machine-readable type to room. Fill in a description of the content type to make it easy for users entering content to know what the content type is for.

Step 2: Add a "Drupal User Group Meeting" content type

Each node within this content type will correspond to single user group meeting. Just as with the Room content type, additional fields could be added, such as a file field for slides, an embedded media field for videos, and so on. Every time a meeting is scheduled, it will be created with this content type, and a Room will be associated with it.

Step 3: Add a node reference field to the "Drupal User Group Meeting" content type

Once the basic content type has been created, click on Manage fields to add a node reference field.

Set the label of the field to Room and the field name to room. The type of the field should be a Node reference field. Choose an appropriate type of form element to display the field with. For a small number of rooms, a Select list is best. For a large number of rooms, try an Autocomplete field instead.

After adding the basic field information, enter appropriate help text for the field. Under Global settings, choose if a room should be required to be selected for an event. As well, it is best to limit the content types that can be referenced to Room, otherwise users can select any type of node.

Step 4: Add a date field to the "Drupal User Group Meeting" content type

Now that a room can be associated with a user group meeting, we need to add a date field to allow the meeting to be scheduled for a specific date and time. Add another field to the content type. Set the label to Meeting date, the field name to meeting_date, and set the type to Date. Any type of form element can be used to edit the field; most websites will have the Javascript Calendar element enabled to simplify date and time input.

Once the basic field information has been entered, set the Required option for both the field itself and the To date. Without these settings, it's impossible for a resource to be scheduled for a finite period of time, and Resource Conflict will prevent you from enabling it for the content type.

Step 5: Enable resource conflict

Now that the Meeting Date field has been created, go back to the main settings for the Drupal User Group Meeting content type. Now that all of the requirements for scheduling a resource has been met, Resource Conflict can be enabled. Check Enable resource conflict checking for this content type, select Meeting date to select the date field to check for conflicts, and check Room to indicate that Rooms can never be booked at the same time.

Step 6: Add the rooms to book

To add rooms to be available to be booked, go to Create content > Add room. Once at least one room has been created, User Group Meetings can be booked. Multiple user group meetings can be booked, as long as they book different rooms.

Comments

FNGR’s picture

somebody here who can write down doing this with d7? can't get this to work with rules.. would be great if it would be easy like in D6!

thanks