TolfaWeb
This is the design document (work in progress) of TolfaWeb. This is a new service designed to replace the existing Tolfa Booking System (TBS) that is used by the Tolfa Assocation to manage facility bookings and content management.
Table of contents
- 1. Introduction
- 2. Design goals
- 3. Prices and policies
- 4. Classes and attributes
- 6. Roadmap
- 7. Deployment
- 8. Final comments
1. Introduction
NOTE: This document is in English because I communicate with developers overseas and consequently would like to be able to supply them with system documentation in English. The service, when delivered to the client, will have a Norwegian user interface, and the end user documentation will be in Norwegian.
CAVEAT: This is a working document written by the designer for himself (as part of the system documentation). While it may be shared with the Tolfa Association for purposes of discussion, it is not intended as end user documentation. Do not expect to understand everything in this document. However. I shall be happy answer any questions you may have about this document, and about the service (TolfaWeb).
TolfaWeb is defined as service (rather than a system) because it will implemented as a “SaaS” (“Software as a Service”). In addition to the necessary credentials (e.g. a username and password) all you will need to access the TolfaWeb is a connection to the Internet, and a PC or tablet with a standard web browser.
TolfaWeb will leverage on the Resource Booking Grid (hereafter RBG). This is a Drupal custom project (developed by Hannemyr Nye Medier AS), that creates a grid-object suitable for booking. There exists classes in RBG) that can be populated through the GUI to create TolfaWeb. For an overview these see section 4 (Classes and attributes).
2. Design goals
The overarching design goals for TolfaWeb are that the new service:
- Capable (by extending RBG through the GUI) of supporting all booking-types, pricing plans and policies in the existing TBS;
- enables the use of seasonal rebates to encourage use of the facility in the low season;
- enables the addition of new policies to limit abusive bookings (see separate design document);
- enables a web content management service (WCMS), for posting news and announcements on the booking website.
To meet the first 3 design goals, the designer has studied various commercial booking systems, as well as other software (commercial and free) to determine how these design goals can be met. The conclusion is that no pre-existing software, system or service can meet these design goals.
These compoents of TolfaWeb will therefore be created from scratch, or by extending RBG.
The last goal (enable an WCMS) can however be met by Drupal (a standard and widely used WCMS). ToldaWeb will be seamlessly integrated with Drupal, and available along with the WCMS on the Tolfa Assocation's website.
3. Prices and policies
A special feature of the TBS is the existence of booking types. This feature is missing from all other booking systems I've studied, but is a requirement for TolfaWeb. In TolfaWeb, the same bed/room is rented at different prices depending on the type of booking.
In the TBS, booking types are fixed in code. In TolfaWeb booking types shall be added and removed by the booking master through the GUI. (The term “GUI” an acronym for “Graphical User Interface”. It is an interface where the user interacts with computers graphic screen by direct manipulation, i.e. by using a “mouse” for pointing and clicking.)
In the TolfaWeb, each resource has an attribute called “base price” (BP). It usually to the price in NOK for a member to book a room himself/herself for a single night (currently BP = 75).
The TBS has the following 8 different booking types built-in:
W | Name of booking type | Price (% rel) | Price (NOK) | By occupancy | RGB colour |
---|---|---|---|---|---|
1 | Members | BPD × 100 | 75 | TRUE | 88ffdd |
2 | Family | BPD × 133 | 100 | TRUE | 88dd88 |
3 | Friends w. member | BPD × 267 | 200 | TRUE | 99ffff |
4 | Friends alone | BPD × 400 | 300 | TRUE | 88eeff |
5 | Friends, long term stay | BPD × 200 | 150 | TRUE | 5bcede |
6 | Workshop | BPD × 867 | 650 | FALSE | ffff00 |
7 | Event | BPD × 0 | 0 | FALSE | ffaa00 |
8 | Blocked | BPD × 0 | 0 | FALSE | cccccc |
In TolfaWeb, there are two global
variable tolfa_baseprice_day
(BPD, currently set to 75),
and tolfa_baseprice_min
(BPM, currently set to -1). All
prices are computed by applying multipliers to this provided it is
positive. A negative number means that it is not avilable.
In the table above, the column “Price (rel)” contains the multiplier (relative to base price) that is the price for that type of booking. The column “Price (NOK)” show the result of using the multiplier, and is the daily price for the booking in NOK. The column “By occupancy” is a flag (i.e. a true or false value) and defines whether price should be computed by occupancy (i.e. the number of adults and children that occupy the room), or by room (i.e. the price of a booking shall not depend on occupancy). The column “RGB colour” contains hexadecimal numbers corresponding to the colour used in visual presentations of the booking type.
Special price rules in Tolfa:
- Children under 12 years who sleep in the same room as a parent do not pay (× 0).
- Children 12-18 years with members or family pay NOK 100 (× 1.33).
- Person 3 in the same a room pay NOK 50 (× 0.67).
- There may be a seasonal price adjustment (Tolfa season class) for bookings in the low season (not used today, but set to × 50% in the example below).
In TolfaWeb, a booking type instance is created dynamically by the RBG booking type class. It is simple to add, change and remove instances of this class.
In TolfaWeb each resource (i.e. an instance of RBG resource class) will have a base price associated with it, and the price for the actual booking is derived from a computation that takes into account the following:
- The daily base price for the resource instance.
- The booking type adjustment.
- If “By occupancy” is true, the price is adjusted according to occupancy (i.e. the number of adults and children that occupy the room).
- If the booking is in a period when there is a seasonal price adjustment, the price is adjusted accordingly.
- The duration (the number of days the resource is booked for).
The price of a booking is computed when a resource is booked. It is recomputed when the booking is edited (but the computation may still use the original base price). It is not automatically recomputed when the base price is changed. However, the booking master will be given the option to force a price change in upcoming (but unpaid) bookings, and a new invoice will be emailed to the person paying. Bookings that are marked as paid in full will not be recomputed by forcing a price change.
Price computation examples
Example 1: member with partner stays 10 days in a standard room in the standard season.
- The BPD is NOK 75.
- Computing resource price adjustment: NOK 75 × 100% = NOK 75
- Computing booking type adjustment for Members: NOK 75 × 1= NOK 75
- Computing occupancy: NOK 75 × 2 persons = NOK 150
- There is no seasonal price adjustment: NOK 150 × 1= NOK 150
- Computing duration: NOK 150 × 10 days = NOK 1500 (this is what this booking costs)
Example 2: Friend alone (1 person) stays 10 days in a standard room in the low season, and the low season adjustment is set to × 50%.
- The BPD is NOK 75.
- Computing resource price adjustment: NOK 75 × 100% = NOK 75
- Computing booking type adjustment for Friends alone: NOK 75 × 400% = NOK 300
- Computing occupancy: NOK 300 × 1 person × 100% = NOK 300
- Computing seasonal price adjustment: NOK 300 × 50% = NOK 150
- Computing duration: NOK 150 × 10 days = NOK 1500 (this is what this booking costs)
Example 3: member stays 10 days in T2.1 in the standard season.
- The BPD is NOK 75.
- Computing resource price adjustment: NOK 75 × 50% = NOK 37
- Computing booking type adjustment for Members: NOK 37 × 1= NOK 37
- Computing occupancy: NOK 37 × 1 person = NOK 37
- There is no seasonal price adjustment: NOK 37 × 1= NOK 37
- Computing duration: NOK 37 × 10 days = NOK 370 (this is what this booking costs)
Policies
In the TBS, the booking policy is in code only. This is very rigid and expensive to maintain. In TolfaWeb, policy will ultimately become an object that is part of the RBG category class (this means that it will be much simpler to create and maintain different booking policies for bedrooms, common rooms and the waiting list).
However, for TolfaWeb ver. 1, the policy is still in code, but exposed to the booking master through the GUI. Category constraints will be enforced through code, but the policy can be changed by the booking master through the GUI.
TolfaWeb shall reproduce the same policies as the TBS, but more flexible and more transparently.
Some policies are not even exposed through the GUI, as they are universal and should not be changed. For, now this applies to a the following:
- Only the boking master can move rooms from the waiting list to real rooms.
- Workshops can only be booked and cancelled by the booking master. The constraints for workshops are manually enforced by the booking master.
- When there are bookings on the waiting list, rooms cannot be self-booked (to avoid that people on the waiting list can jump the queue because of race conditions) (not used in Tolfa).
- Only users having a specific role (e.g. “cultural committee”) can book a resource belonging to this category (not used in Tolfa).
- The first to book a room gets it (however, a future booking may initially be set with a “pending” State, and not confirmed until X days later, provided there are no disputes).
- Users can book 1 room for themselves or Family during Easter and Autumn break.
- The RBG may also implement a points feature to limit abusive bookings (postponed, see separate design document for details).
Booking policy rules (X are suggested defaults (from the TBS), use X = -1 to disable a rule and other negative numbers for special purposes). Current state is in square brackets.
- General:
- Application name. The name is used in the configuration menu. [DONE]
- Quantity constraints:
- Max rooms. Users who stay at the facility can book 2 simultaneous rooms, except Easter and Autumn break.
- Max rooms for family. Users can book 1 room for Family when they are not staying at the facility.
- More max rooms. When it is less than Y days to arrival, users can self-book up to X rooms (X = 4).
- Time constraints:
- Booking in the past. By default, this is not allowed. [DONE]
- Max duration of a visit. Rooms cannot be booked for more than X consecutive days (X=30). [FORM]
- Max days in advance. Bookings that end more than X days in the future are not allowed (X = 365). [DONE]
- Full flex self-service (days). Users can create, update and delete bookings that begin more than X days in the future (X = 30). [FORM]
- Unlimited bookings (days). Users can create (but not update or delete) bookings that begin less than X days in the future (X = 30). [FORM]
- Friends direct (days). All booking for friends more than X days before arrival must be on the waiting list (X = 60).
- Extended limit booking (days). When it is less than X days to arrival, users can self-book up to Y rooms (X = 60).
4. Classes and attributes
The core of TolfaWeb is based upon five classes (i.e. types of content). Four of those are inherited from RBG, while one in created for TolfaWeb (now by using the GUI, may become a features export). The description of each class consists of a list of attributes and a brief explanations of the attributes that are not self-explanatory or is explained elsewhere. A number in a square bracket connects the attribute to its explanation.
- RBG category: A caregory of resource, users may navigate between categories using tabs above the grid.
- RBG resource: A bookable resource.
- RBG booking type: The type of booking. Placeholder for additional attributes.
- RBG booking: An actual booking of a resource
- Tolfa season: A seasonal price adjustment
The data type or Drupal field is indicated insite parentheses for each attribute. The prefix “rel:” here means that the attribute is an entity relation to another class.
There is also a User class, and an Article class, that comes as part of Drupal and is inherited by TolfaWeb. Those are stadard features of the Drupal WCMS, and are not described here.
RBG category
TolfaWeb introduces a new level of abstraction above the actual resources (i.e. the rooms). This purpose of this class is to move the booking policy out of code and into an object that can be changed by the booking master through the GUI.
Inherited attributes:
- Name (title) [1]
- Description (body)
- Visibility (select list)
- Weight (int)
TolfaWeb attributes:
- Policy (object) [2]
Notes:
- The Category is used to name the category. The Tolfa service will initially define four categories named “Bedrooms”, “Common Rooms”, “Waiting list”, and “Meta”.
- Postponed to ver. 2.0.
RBG resource
This class is used to represent the bookable resource (e.g. a physical room or a pseudo-room).
Inherited attributes:
- Name (title) [1]
- Description (body)
- Capacity (int)
- Category (entity reference, rel: RBG category)
- Weight
TolfaWeb attributes:
- Price adjustment (int) [2]
Notes:
- The Resource name is the name of the resource. In Tolfa the bedrooms are named V1-V8, T1, T2, T2.1, T3 and T4; the Common rooms are named SanG-salen and Ballsalen; and there are 7 pseudo-rooms on the waiting list: X1-X7.
- Like in TBS the base price (BP) is a global variable. This is the base price shared by all resources:
- Each resource has two base prices, one for for daily and one for lower resolution rental (abbreviated BPD, BPM, -1 means NA, 0 means free). While Tolfa only rents by the day, this extra flexibily costs nothing.
- However, the resource object instance may have a price adjustment set, given as an integer percentage. This allow for pricing some resources different from others (e.g. T2.1 is 75 × 50% = 37).
- The base price in this object will only be used as a starting point for computing the cost of a booking. Refer to the examples above to learn how the price is computed.
RBG booking type
This class describes the various types of booking that are known to the system. The use of this class is described above in the section Prices.
Inherited attributes:
- Name (title) [1]
- Description (body)
- RGB colour (text)
- Weight (int)
TolfaWeb attributes:
- By occupancy [2]
- Percentage of base price (e.g. Members 100 %, Family 133 %, etc.) [3]
- Children 0-11 NOK 0 [4]
- Children 12-17 NOK 100 [4]
- Quantum absolute NOK 50 [5]
- Quantum modifier NOK 50 (67 %) [5]
- Quantum modifier limit (> 2) [5]
Notes:
- The booking type has a name. The names used in the TBS are listed
in the table in the previous section. After creating
these edit the
$bt_classes
array (located inrbg.controller.inc
). - The attribute By occupancy is a flag to indicate if price for this booking type should be computed by occupancy or not. In Tolfa, all bookings except workshops are by occupancy. Most commercial booking software does not even allow pricing by occupancy.
- The Percentage of base price is the percentage of the base price that will be used in the computation of the price of this booking type for the principal adult person in the room.
- The two Children attributes are used to compute the cost of having children in the room.
- The Children 0-11 attribute is used to set the price of children under 12 years old sharing the room with at least one parent or grandparent. Setting it to 0 means that there is no cost to have the children sleeping in the same room as the parent(s).
- The Children 12-17 attribute is used to set the price of children 12-17 years old traveling with member or family if they hace their own room.
- The three Quantum attributes are used to compute how the number of occupants in a room affects the price (and are not used if By occupancy is not set).
- The Quantum absolute attribute is used to set the price when more adults than the Quantum modifier limit occupy the same room. Set to -1 to use Quantum modifier instead
- The Quantum modifier attribute is used to compute the price when more adults than the Quantum modifier limit occupy the same room, and Quantum absolute is set to -1.
- The Quantum modifier limit is used to indicate when to use the Quantum modifier. Setting it to 2 means that it used to compute the cost of the 3rd adult in the same room.
RBG booking
This is the actual booking. It has roughly the same attributes as the fields that appeared in the booking form in the TBS.
However, in TolfaWeb, bookings will have revisions enabled, so that we can extract historic booking patterns for analysis later. This is not possible in the TBS.
Inherited attributes:
- Title (title)
- Owner (node:uid) [1]
- Arrival-Departure (date)
- Booking type (rel: RBG booking type)
- Resource (rel: RBG resource)
- Private (bool)
- Booking state (select list) [2]
- Comment (body)
- Hide comment (bool)
TolfaWeb attributes:
- Name of guest (text) [3]
- Billing address (street address and email address)
- Adults (int) [4]
- Children00 (int) [4]
- Children12 (int) [4]
- Base price used (int) [5]
- Computed price (int) [6]
- Paid in (int)
- Paid time (int)
- Booking locked (bool) [7]
- Legacy user ID (int) [8]
Notes:
- The Owner is always the member who the booking is made for (either by self-service booking, or by the booking master on behalf of a member). In TolfaWeb, it is the owner of the booking node. A member can create, edit and delete own booking instances (according to the booking policy). The booking master can do the same thing to all booking instances, and is not constrained by the booking policy.
- The booking state feature is not used in Tolfa (all booking will be automatically set to Confirmed as soon as they are created), but it should be in place in TolfaWeb in case we want to enable a booking policy that allows bookings to be disputed.
- This should only be visible when the booking type indicate that the booking is not for the Member.
- For most booking types, the service needs to know the number of Adults and Children aged 0-11 and Children aged 12-17 in order to compute the price for the booking based upon the Tolfa price model. However, this information will no longer be requested on the booking form if the booking type has the “By occupancy” flag set to false.
- We also retain the actual Base price used when the booking was made, so that if the base price for the resource is changed, but the booking master choses not to force this change on bookings that are already confirmed and an invoice has been sent out, editing the booking will not automatically result in a different price. For legacy bookings, this is set to the base price at the time TolfaWeb is deployed.
- This is usually a computed price based upon the price model, but may be overridden by the booking master. If it is overridden, it is indicated by the Booking locked flag.
- If the Booking locked flag is set, the booking cannot be changed by the owner, even if the rules otherwise would permit this. This is automatically set when a special price is set by the booking master. In TBS this field was named “spfymf” (special price for you my friend).
- The Legacy user ID retains the user ID from the TBS. This is to make sure we are able to reconnect users to bookings when we migrate the legacy user and booking data into TolfaWeb.
Tolfa season
This class is to enable seasonal price adjustments (e.g. “low season” pricing for November - February).
The booking master can create any number of price adjustment instances in the GUI, and each instance can apply to a single resource or to all resources. They cannot overlap.
TolfaWeb attributes:
- Name (title)
- Period (date) [1]
- Campaign (bool) [2]
- Resource (entity reference rel: RBG resource) [3]
- Percentage (unt, price adjustment to apply) [4]
Untick “Promoted to front page” and set comments “Closed”.
Notes:
- The Period records the period when price adjustment apply (i.e. the beginning date and the end date).
- The Campaign flag indicates whether the price adjustment is of the type “Recurring” (default) or “Campaign”. A Campaign adjustment, when set, is automatically deactivated when it expires. A Recurring adjustment, will be automatically reactivated annually as long as it is not deleted. Recurring adjustments are for setting up “low season” discounts. Campaigns are for running time-limited promotions. Tick “Use field label instead of the "On value" as label” TODO: Improve display.
- The price adjustment may apply to a single resource, or to
- All -
resources. The latter is a meta-resource that appears on the pull-down menu. - The Percentage is the discount (expressed as a percentage) that is applied to the price computation of a resource as the penultimate step in computing the cost of a stay (just before duration is applied). It is used in step 5 in this example.
6. Roadmap
Optional features
Optional features are not enabled by default, but may be enabled by the booking master.
- When a resource is booked, email is sent to all members who subscribe to notices about booking of this resource.
- X days before arrival, an email is sent to all members who subscribe to notices about booking gets a reminder/invoice by email (X = 40).
- Feature to export to Excel for client side analysis.
- The initial booking state can be set to pending, and other members may then dispute the booking (i.e. indicating that they also want to use the resource at the same time). If there are no disputes in X days, the booking is automatically confirmed. This is not used in Tolfa, but having it in place will allow for more flexible booking policies than the present: “the first to book gets the room”.
Wishlist
The wishlist lists ideas that would be nice to have, but that will not be included in the first release.
- Shopping cart: Ability to book more than one room in a linked
context, producing a single invoice for all rooms booked in this
context.
See: ostraining.com/blog/drupal/basic-cart/. - Limit abusive bookings: Add a policy to limit abusive bookings (see separate design document).
- It would be nice to reveal the last slot avilable in the departure tooltip.
Sociability extensions
This section is for description of features that may increase the sociability of the service.
- Users are encouraged to enter they year and date of their birthday as part of their user profile. This will allow:
- Ability to compute the age demographic of the users (the board is interested in this).
- Birthday greeting: Members who log in on their birthday receive a "happy birthday" message.
- A birthday Resource in the External-category (see below). It will indicate the date, but not the year. Users may opt out if they do not want to share their birthday with other users.
- An External category. In this category, the individual resources are birthdays, cultural events ("culture calendar"), local festivals, Italian holidays. etc. etc.
7. Deployment
Install the following custom projects and dependencies:
- RBG
- Tolfa
- Flexilogin
- Mother May I
Setting up
To set up a production booking service for the Tolfa website, do the following to create the Tolfa season class and the required instances:
- Create Tolfa season using the GUI.
- Create three RBG categories: Bedrooms, Common rooms, Waiting list
- Create the RBG resources: V1-V8, T1, T2, T2.1, T3, T4 (Bedrooms); SanG-salen, Ballsalen (Common rooms); X1-X7 (waiting list); - Alle - (meta).
- Create RBG booking types equivalent to the TBS (these are described above).
- To offer a discount for the low season, create a Tolfa season from 2018-11-01 to 2019-03-01.
At this point, the site should be very similar to the legacy TBS. It may be a good idea to create a backup.
- Add a phonefield to user profile, make it mandatory.
- Create the role “booking master”.
- Give the booking master role the following permission: Adminster RBG, as well as all node permissions for the RBG content types and the Tolfa season content type.
- Give all authenticated users the following node permissions: RBG booking: Create new content, Edit own content, Delete own content.
- Create test users “test” and “bm” and give the latter the booking master role.
The suggested access control will give the booking master full access to a GUI that allow him/her to create, change and remove instances of all classes.
Ordinary users will only have GUI access to the Booking class.
Configuration
[TBA]
Known bugs
- Editing a resource reverts category back to first category.
Migrate legacy data
At this point, it is possible to import legacy data from the TBS into TolfaWeb.
Insert credentials for legacy database in settings.php
.
Manual tests
- …
8. Final comments
[TBA]
Last update: 2018-08-19.