MRBS Insert Period Script
I need a SQL script to insert a period in the middle without effecting existing reservations.
When MRBS is set to use Periods instead of times it uses minutes after 12:00 to hold the period number. For example:
Period 1 ->12:00
Period 2 ->12:01
Period 3 ->12:02
Period 4 ->12:03
Period 5 ->12:04
Period 6 ->12:05
Period 7 ->12:06
Now if I change the period structure by adding a new period at the top of the list I can just run
Code:
UPDATE mrbs_entry SET start_time=start_time+60, end_time=end_time+60;
UPDATE mrbs_repeat SET start_time=start_time+60, end_time=end_time+60, end_date=end_date+60;
This will add 60 seconds to every entry so I can add a period at the top. My problem is how do I adjust the script so I can insert a period in the middle:
Period 1 ->12:00
Period 2 ->12:01
Period 3 ->12:02
Period 4 ->12:03
Advisory ->12:04
Period 5 ->12:05
Period 6 ->12:06
Period 7 ->12:07
I need to add 60 seconds to any entry 12:04 or later in the day. The problem is that the date/time is stored as an integer. I have used SQL for years but I am not a coder. I think I need to use a CAST to convert from integer to date/time and then parse it to find the ones with an hour of 12 and minutes between 0 and 59 (MRBS only supports 60 periods). Then use the above UPDATE commands to add 60 seconds to any minute greater than a specified value. This would probably have to be done for each of the 5 values above one at a time.
Most of our sites are using MRBS 1.2.1 so we don't currently have a mix of Periods and Times but we have a few test sites using MRBS 1.4.8 where you can have some reservations that are Period based and others that are Time based. Is there a Field in the new structure that determines if it is a Period or Time reservation? We might need to have that as an option as well.
Thanks for any help you can give.