When ClassTemplates are created inside ClassPeriodTemplate, order and service bookings should be also created for all days in the period. ( Class template should create real service booking and repeat it for each week from ClassPeriodTemplate )
Currently it is done by calling ClassPeriodTemplateOp.createOrderItems (ClassPeriodTemplate template) method.
Method works flow :
- Take each ClassTemplate from ClassPeriodTemplate
- Validate ClassTemplate ( Should have Product, BusinessUnit, StartTime, WeekDay, Room, Instructor)
- Get first valid day from the period (when weekday is needed and resources are free) and create Order and ServiceBooking
- Create Repetition for ServiceBooking for all days in the period
Return data:
Method return Map<ClassPeriod, List<Day>> where :
ClassPeriod - is ClassPeriod that was used to create repeating ServiceBookings
List<Day> - List of Days when ServiceBookings were not created.
The reason why ServiceBooking was not created for some days is because resources (one or both) were not available for this Day.
Special Cases:
If we plan some or all days "in the past" (means if we call method createOrderItems(....) for the period that has started already, all service bookings will be also created even for days that have past.
Possible updates:
...
all classes are filled with rooms and instructors (see Assign instructors) it's time to create service booking for that classes