Enforcing max circ rule loan periods on bookings (37354), cuts into the circ period of a booking when post-processing days are added. To replicate: 1. Set up two days of post-processing time in the circ rules for an item type. 2. Make that item type bookable. 3. Place a booking for an item from that item type. Note that the 2-days of post-processing time are factored into the total number of days allowed for the booking. For a 7-day circ period, the booking cannot be set for 7 days; it is enforced to end at 5.
I think this is a problem in the mouseover function AFTER selecting a startDate where it is incorrectly using hoverDate instead of startDate
Created attachment 181312 [details] [review] Bug 39584: Use startDate instead of hoverDate when calculating loan period on mouseover To test: 1. Set up two days of post-processing time in the circ rules for an item type. 2. Make that item type bookable. 3. Place a booking for an item from that item type. Note that the 2-days of post-processing time are factored into the total number of days allowed for the booking. For a 7-day circ period, the booking cannot be set for 7 days; it is enforced to end at 5. 4. APPLY PATCH 5. Try the booking again, this time you should be able to select the full loan period for that item.
I looked at this in a sandbox. While I am able to add 2 days of post-processing and get the full 7-day circ period, it looks like the date picker is marking the post-processing days within the booking now. That is, if I pick a booking for a 7-day circ period between May 5-12, the calendar is marking May 6 and 7 as the post-processing days, not May 13-14. Please see the attached screenshot.
Created attachment 181394 [details] BookingPostProcessing_39584 Shows booking post-processing days assigned within the booking period instead of after.
Created attachment 182448 [details] [review] Bug 39584: Include trailDays when calculating maxDate When enforcing the max booking period from the circulation rules, we should not include booking post processing days. Our pre and post processing days handling looks for 'flatpickr-disabled' and ensure processing days cannot overlap. When setting maxDate, flatpickr will apply the flatpickr-disabled class to the next day to prevent selection past the max date and as such our post-processing acts in an inclusive manor. This patch updates our maxDate handler to increase then maximum target by the trailDays setting to allow a full loan period. To test: 1. Set up two days of post-processing time in the circ rules for an item type. 2. Make that item type bookable. 3. Place a booking for an item from that item type. Note that the 2-days of post-processing time are factored into the total number of days allowed for the booking. For a 7-day circ period, the booking cannot be set for 7 days; it is enforced to end at 5. 4. APPLY PATCH 5. Try the booking again, this time you should be able to select the full loan period for that item.
I've got a slightly cleaner approach.. but I'm still refining a bit as I don't like that because the maxDate is extended in my version it appears later than it really is due to the ungreyed out dates.
Created attachment 182451 [details] [review] Bug 39584: Include trailDays when calculating maxDate When enforcing the max booking period from the circulation rules, we should not include booking post processing days. Our pre and post processing days handling looks for 'flatpickr-disabled' and ensure processing days cannot overlap. When setting maxDate, flatpickr will apply the flatpickr-disabled class to the next day to prevent selection past the max date and as such our post-processing acts in an inclusive manor. This patch updates our maxDate handler to increase then maximum target by the trailDays setting to allow a full loan period and includes styling to match flatpickr-disabled for the exclusive trailDays. To test: 1. Set up two days of post-processing time in the circ rules for an item type. 2. Make that item type bookable. 3. Place a booking for an item from that item type. Note that the 2-days of post-processing time are factored into the total number of days allowed for the booking. For a 7-day circ period, the booking cannot be set for 7 days; it is enforced to end at 5. 4. APPLY PATCH 5. Try the booking again, this time you should be able to select the full loan period for that item.
OK.. I'm done.. could someone please try out my alternative patch.. I believe it more accurately allows for all the existing cases. So.. the basic test plan just checks that the bug in question is resolved.. but what would be even better is to add a set of bookings in and ensure end date handling is still properly handled for those bookings with a start date before one and around the expected maximum date. Many thanks,