How Booking Creation and Validation Works
Source: events_controller.rb, event.rb
- Event date is mandatory and must be a valid date; non-date strings are rejected at validation
- A sequential event number is auto-assigned from the company sequence, but the number is only consumed if the full validation passes (no wasted numbers on failed saves)
- Every booking requires a customer; vehicle is optional
- New events always default to OPEN status and booking source defaults to MANUAL
- Description field is capped at 255 characters; event number must be numeric only
- If discount_includes_tax is enabled on the company, applying a discount across line items with mixed tax rates is blocked (would produce incorrect tax splits)
- When the update_product flag is true, the product's description and price are updated inline from the line item values during save
- VV Garage integration triggers a sync on booking creation, but fails silently if the vehicle or customer is missing their VV IDs
- Product pricing and tax information are pulled fresh at creation time based on current company settings
Support scenarios
- "I created a booking but the event number skipped a number" → Event numbers are only consumed when validation passes. A previously failed save attempt would not consume a number, but a validation failure partway through (after number assignment but before rollback) could in rare cases leave a gap.
- "I can't apply a discount to my booking" → If the company has discount_includes_tax enabled and the booking has line items with different tax rates, the system blocks the discount because it cannot correctly split the tax portion across mixed rates.
- "My VV Garage booking didn't sync" → The sync fails silently if the customer or vehicle record is missing a VV Garage ID. Check both records have their VV IDs populated.