Page 1 of 1

Reservation Future Date Issue

Posted: Sat Apr 23, 2022 6:26 pm
by pjurski
Hello,

I am a developer who uses booked scheduler very heavily for our users. However, we are running into huge problems with reservation availability.

Scenario: All the reservations are available only for 7 days in 30 minute increments. We cannot change the 7 days and increase it. Demand is super high for the rooms. Currently users wait for a slot to open until the current time passes to book on the 7th day.

I need to modify the core Booked Scheduler to allow users to be able to book reservations not stopping at the "current time" 7 days from now but by the "end of the day" of that 7th day. Instead of using current time as a stoppage, use days instead.

The reason this is a huge problem is because we are having super high demand for reservations and we have to limit the days to be available. In addition, booked does not gray out the future days so it looks like the slots are available and the only way to check if it is, is to go through the process and create a reservation to get a error ajax message. This creates a lot of headaches for users because they don't know when to book. We fixed the graying out issue but the time issue is overwhelming looking at the code.

So going back to development, where in the booked application or specific files (classes or functions) I can make changes to allow "end of the day" scenario?

Anyone who can guide me where I should look will seriously be appreciated for the help!

Thanks!

Re: Reservation Future Date Issue

Posted: Sun Apr 24, 2022 11:05 pm
by pjurski
I figured it out!

For reference, when the reservation saves it goes through a whole bunch of validations which check for everything required to make the reservation. One of the rules is called "ResourceMaximumNoticeRule" located in lib/Application/Reservation/Validation/ResourceMaximumNoticeRule.php

You have to make a modification in Validate function and look for $maxEndDate variable:

$maxEndDate = Date::Now()->ApplyDifference($resource->GetMaxNotice()->Interval());

Add these lines underneath it:
$maxEndDate = $maxEndDate->GetDate(); //clears the time to 00:00 and only shows the day in the value
$maxEndDate = $maxEndDate->AddDays(1); //adds one day which will make it 12am next day

This will modify the date to go one day up and clear out the time to set it to 12AM.

Hopefully this helps someone! :D