Hello.
The columns in a table include the following:
- eventday (Type: DATE)
- wholeDay (Type: BOOLEAN)
- starts
- ends (Both Type: DATETIME)
Now I have following rules:
- if the event is a wholeDay-Event AND on this day is any event in the database: FALSE !
- if the event is not a wholeDay-Event AND on this day is an event with wholeDay in the database: FALSE !
These both rules are simlpy checked with own validation rules and they work, but I don't know how to check following with custom rules:
- if the event is not a wholeDay-Event AND in the database an event exists an event during the requested duration (So if there are time overlaps)
- if the event is an event over 2 or more days and in the database an event exist (doesn't matter if wholeDay or not) during the requestet time.
My suggestion to solve this problem is to use the "beforeInsert" / "beforeUpdate" method, wich redirected to the form, if above rules are false.
Or is there a better practice to solve this ?
Greetings
Kighlander