Every time somebody creates or changes a booking, Calpendo checks its Booking Rules to see whether the change should be allowed. Unlike Time Templates which are applied in the user's web browser, Booking Rules are applied in the Calpendo server. This key difference has the following consequences:
•Time Templates can give feedback to the user before they even try to create a booking, whereas Booking Rules require the user to enter the booking details before any feedback can be given.
•Time Templates have limited information available to them, whereas Booking Rules have full access to everything in the Calpendo database, and even external information available on the internet as well if you need it.
When Calpendo checks its Booking Rules, it first looks to see which ones apply to the booking and the change being made. There are different types of Booking Rules, but they all share the same way of identifying which bookings they apply to, and this is described in the next section, Choosing Which Bookings A Rule Applies To.
Each Booking Rule has to decide whether the booking should be rejected or whether it is acceptable. If acceptable, then it must also decide whether to issue the user a warning. When a warning or rejection is issued, the Booking Rule responds with two extra things:
•a message that should be given to the user, preferably customised so it is specific to the problem it has encountered.
•for bookings whose status is Approved, the Booking Rule can indicate whether it might be acceptable if the booking's status were Requested instead. This allows the user the opportunity to downgrade their booking to a request, although the option should only be given if the Booking Rule would generate a different response to a booking request.
If Calpendo finds a Booking Rule that rejects the change, then no further Booking Rules are run. However, if a Booking Rule is found to generate a warning, then further Booking Rules are run, just in case there is a Booking Rule that would reject the booking. Also, Calpendo will only show one message to the user, so the order in which the Booking Rules run can affect any error message the user is given. The order in which Booking Rules are run is controlled by the order they appear in the Rule Editor.