[Bug 39584] New: Booking post-processing time cuts into circulation period
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Bug ID: 39584 Summary: Booking post-processing time cuts into circulation period Change sponsored?: --- Product: Koha Version: 24.11 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: kkrueger@cuyahogalibrary.org QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com 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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Kristi <kkrueger@cuyahogalibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kkrueger@cuyahogalibrary.or | |g -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #1 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- I think this is a problem in the mouseover function AFTER selecting a startDate where it is incorrectly using hoverDate instead of startDate -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|24.11 |Main -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lucas@bywatersolutions.com |ity.org | Severity|enhancement |normal Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #2 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Created attachment 181312 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=181312&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #3 from Kristi <kkrueger@cuyahogalibrary.org> --- 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #4 from Kristi <kkrueger@cuyahogalibrary.org> --- Created attachment 181394 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=181394&action=edit BookingPostProcessing_39584 Shows booking post-processing days assigned within the booking period instead of after. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |37354 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37354 [Bug 37354] Bookings should respect circulation rules for max loan periods -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #5 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 182448 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182448&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #182448|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 182451 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182451&action=edit 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. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|lucas@bywatersolutions.com |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #181312|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- 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, -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #9 from Kristi <kkrueger@cuyahogalibrary.org> --- I looked at this in a sandbox with a 7-day circ period and no renewals allowed. I got the full circ period with the 2 post-processing factored in at the end (39584_20250520.png) That addresses the bug as described, post-processing cutting into the circ period. If there are renewals allowed, the post-processing also does not cut into the circ peiod (39584_WithRenewals_20250520.png) It does look like it adds another day on the end date in this case though. A booking for 7 days with 2 renewals starting on 6/02 would end on 6/23 in the date picker, but it ends on 6/24 when booked (39584_Bookings.PNG) I'm not sure I fully understand "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." Happy to discuss that further. Otherwise, the patch addresses the problem as described "Enforcing max circ rule loan periods on bookings (37354), cuts into the circ period of a booking when post-processing days are added." -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #10 from Kristi <kkrueger@cuyahogalibrary.org> --- Created attachment 182678 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182678&action=edit BookingWithPostProcessing_NoRenewals -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #11 from Kristi <kkrueger@cuyahogalibrary.org> --- Created attachment 182679 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182679&action=edit BookingWithPostProcessing_WithRenewals -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #12 from Kristi <kkrueger@cuyahogalibrary.org> --- Created attachment 182680 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182680&action=edit BookingsWithDayAddedInBooking -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #13 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks for testing Kristi, it's very much appreciated. (In reply to Kristi from comment #9)
If there are renewals allowed, the post-processing also does not cut into the circ peiod (39584_WithRenewals_20250520.png) It does look like it adds another day on the end date in this case though. A booking for 7 days with 2 renewals starting on 6/02 would end on 6/23 in the date picker, but it ends on 6/24 when booked (39584_Bookings.PNG)
As discussed, I think this is pre-existing and it's actually a day "added" at to the initial issue if I'm understanding it correctly. We count the first day of the booking as the "pickup day" and under normal circulation we would set the due date to today at midnight + issue period.. so if I booked from the first, the due date would be midnight on the 8th.. 1st + 7 days = 8th. For renewals, we currently add a renewal period for each renewal allowed, so it's exclusive of the 'renewal' day.. it presumed you would be returning the item on the last day of your issue and adds renewal period to that day.
I'm not sure I fully understand "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." Happy to discuss that further.
So what I meant by that was that I just wanted to verify that we're still handling bookings clashes as expected. i.e that the lead and trail periods still interact with other bookings, ensuring one cannot overlap with another booking (I know I also have another bug to work on to ensure we don't overlap lead/trail periods with each other too) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=39916 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Circulation| |Bookings function| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |39390 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39390 [Bug 39390] Booking pre-processing and post-processing days can be set for same day -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #14 from Kristi <kkrueger@cuyahogalibrary.org> --- Thanks for the explanations on both points. Bookings do still overlap with pre- and post-processing time. I set circ rules for 2 days of post-processing and a 7-day circ period, no renewals. I placed a booking for 6/9-6/16, which would have the 2 post-processing days on 6/17 and 6/18. I was able to place a booking for 6/18- 6/25. That is, I was allowed to place a booking that started on one of the post-processing days for the first booking. This is bib 194 in the PTFS-hosted sandbox for this bug if it helps. Would this issue be a new bug report? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37707 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37707 [Bug 37707] Lead/Trail times should work in combination -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |39916 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39916 [Bug 39916] The 'Place booking' modal should have cypress tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Eric Garcia <cubingguy714@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Eric Garcia <cubingguy714@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #182451|0 |1 is obsolete| | --- Comment #15 from Eric Garcia <cubingguy714@gmail.com> --- Created attachment 182910 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182910&action=edit 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. Signed-off-by: Eric Garcia <cubingguy714@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |BLOCKED CC| |m.de.rooy@rijksmuseum.nl --- Comment #16 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Blocked currently by 39916 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|39916 |40134 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39916 [Bug 39916] The 'Place booking' modal should have cypress tests https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40134 [Bug 40134] Fix and optimise 'Any item' functionality of bookings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|Trivial patch |Small patch Status|BLOCKED |Needs Signoff QA Contact|testopia@bugs.koha-communit |nick@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #182910|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #17 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 190822 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190822&action=edit Bug 39584: Add Cypress tests for bookings lead and trail period behavior This commit adds comprehensive Cypress tests for the lead and trail period functionality in the bookings modal date picker. These tests validate the hover effects, conflict detection, and date selection constraints. Test coverage includes: - Lead period visual hints (CSS classes on hover) - Lead period conflict prevention with existing bookings - Lead period conflict prevention with past dates - Trail period visual hints (CSS classes on hover) - Trail period conflict prevention with existing bookings - Trail period should NOT limit max date when clear (BUG FIX TEST) - Full max range selection when trail period has no conflicts The critical bug being tested: Trail period should ONLY prevent selection when it conflicts with an existing booking. It should NOT subtract from the max date allowed by circulation rules. Currently, the trail period incorrectly reduces the max selectable end date even when no conflicts exist. Test setup: - Lead period: 2 days - Trail period: 3 days - Issue length: 14 days with 2 renewals of 7 days each - Max period: 28 days - Booking A (Days 5-7): Tests lead period conflicts - Booking B (Days 45-50): Tests trail period conflicts The test at line 977-1045 (TEST 4) specifically validates that the max end date (Day 37) is selectable when the trail period (Days 38-40) is clear, proving the trail period doesn't incorrectly reduce max date. These tests currently expose the bug and will pass once the JavaScript implementation is fixed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #18 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 190823 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190823&action=edit Bug 39584: Fix trail period incorrectly limiting max booking date This commit fixes a bug where the trail period was preventing selection of the maximum end date allowed by circulation rules, even when there were no booking conflicts in the trail period. The Problem: ============ The hover logic in place_booking.js checked if ANY disabled date fell within the trail period and would prevent selection. However, dates can be disabled for multiple reasons: 1. They conflict with an existing booking (correct reason to disable) 2. They are beyond the maxDate set by circulation rules (incorrect!) 3. They are in the past When hovering over the max selectable end date, the trail period would extend beyond the maxDate. Those dates were disabled by flatpickr automatically, and the code incorrectly interpreted this as a booking conflict, preventing selection of the otherwise valid max date. The Fix: ======== Modified the trail period conflict check (lines 995-1005) to only consider dates that are within the max date range. Disabled dates beyond the maxDate are now ignored when checking for trail conflicts. Before: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { trailDisable = true; } After: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null; if (!maxDate || elemDate.isSameOrBefore(maxDate)) { trailDisable = true; } } This ensures trail periods only prevent selection when they conflict with actual bookings, not when they extend beyond the circulation rules' maximum date. Test Updates: ============= Updated the Cypress test to correctly calculate the expected max date consistent with existing tests (startDate + maxPeriod, not -1). The test now properly validates that Day 38 (max date with 28-day period from Day 10) is selectable when the trail period (Days 39-41) has no booking conflicts. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|37707 |40134 Depends on|40134 |39916 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37707 [Bug 37707] Lead/Trail times should work in combination https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39916 [Bug 39916] The 'Place booking' modal should have cypress tests https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40134 [Bug 40134] Fix and optimise 'Any item' functionality of bookings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |37707 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37707 [Bug 37707] Lead/Trail times should work in combination -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|39390 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39390 [Bug 39390] Booking pre-processing and post-processing days can be set for same day -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|40134 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40134 [Bug 40134] Fix and optimise 'Any item' functionality of bookings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190822|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190823|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #19 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 190824 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190824&action=edit Bug 39584: Add Cypress tests for bookings lead and trail period behavior This commit adds comprehensive Cypress tests for the lead and trail period functionality in the bookings modal date picker. These tests validate the hover effects, conflict detection, and date selection constraints. Test coverage includes: - Lead period visual hints (CSS classes on hover) - Lead period conflict prevention with existing bookings - Lead period conflict prevention with past dates - Trail period visual hints (CSS classes on hover) - Trail period conflict prevention with existing bookings - Trail period should NOT limit max date when clear (BUG FIX TEST) - Full max range selection when trail period has no conflicts The critical bug being tested: Trail period should ONLY prevent selection when it conflicts with an existing booking. It should NOT subtract from the max date allowed by circulation rules. Currently, the trail period incorrectly reduces the max selectable end date even when no conflicts exist. Test setup: - Lead period: 2 days - Trail period: 3 days - Issue length: 14 days with 2 renewals of 7 days each - Max period: 28 days - Booking A (Days 5-7): Tests lead period conflicts - Booking B (Days 45-50): Tests trail period conflicts The test at line 977-1045 (TEST 4) specifically validates that the max end date (Day 37) is selectable when the trail period (Days 38-40) is clear, proving the trail period doesn't incorrectly reduce max date. These tests currently expose the bug and will pass once the JavaScript implementation is fixed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #20 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 190825 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190825&action=edit Bug 39584: Fix trail period incorrectly limiting max booking date This commit fixes a bug where the trail period was preventing selection of the maximum end date allowed by circulation rules, even when there were no booking conflicts in the trail period. The Problem: ============ The hover logic in place_booking.js checked if ANY disabled date fell within the trail period and would prevent selection. However, dates can be disabled for multiple reasons: 1. They conflict with an existing booking (correct reason to disable) 2. They are beyond the maxDate set by circulation rules (incorrect!) 3. They are in the past When hovering over the max selectable end date, the trail period would extend beyond the maxDate. Those dates were disabled by flatpickr automatically, and the code incorrectly interpreted this as a booking conflict, preventing selection of the otherwise valid max date. The Fix: ======== Modified the trail period conflict check (lines 995-1005) to only consider dates that are within the max date range. Disabled dates beyond the maxDate are now ignored when checking for trail conflicts. Before: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { trailDisable = true; } After: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null; if (!maxDate || elemDate.isSameOrBefore(maxDate)) { trailDisable = true; } } This ensures trail periods only prevent selection when they conflict with actual bookings, not when they extend beyond the circulation rules' maximum date. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #21 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190898 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190898&action=edit Bug 39584: Correct spelling in comment QA tools caught the spelling "caluclate" in a comment within the cypress test code. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190824|0 |1 is obsolete| | --- Comment #22 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190931 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190931&action=edit Bug 39584: Add Cypress tests for bookings lead and trail period behavior This commit adds comprehensive Cypress tests for the lead and trail period functionality in the bookings modal date picker. These tests validate the hover effects, conflict detection, and date selection constraints. Test coverage includes: - Lead period visual hints (CSS classes on hover) - Lead period conflict prevention with existing bookings - Lead period conflict prevention with past dates - Trail period visual hints (CSS classes on hover) - Trail period conflict prevention with existing bookings - Trail period should NOT limit max date when clear (BUG FIX TEST) - Full max range selection when trail period has no conflicts The critical bug being tested: Trail period should ONLY prevent selection when it conflicts with an existing booking. It should NOT subtract from the max date allowed by circulation rules. Currently, the trail period incorrectly reduces the max selectable end date even when no conflicts exist. Test setup: - Lead period: 2 days - Trail period: 3 days - Issue length: 14 days with 2 renewals of 7 days each - Max period: 28 days - Booking A (Days 5-7): Tests lead period conflicts - Booking B (Days 45-50): Tests trail period conflicts The test at line 977-1045 (TEST 4) specifically validates that the max end date (Day 37) is selectable when the trail period (Days 38-40) is clear, proving the trail period doesn't incorrectly reduce max date. These tests currently expose the bug and will pass once the JavaScript implementation is fixed. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190825|0 |1 is obsolete| | --- Comment #23 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190932 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190932&action=edit Bug 39584: Fix trail period incorrectly limiting max booking date This commit fixes a bug where the trail period was preventing selection of the maximum end date allowed by circulation rules, even when there were no booking conflicts in the trail period. The Problem: ============ The hover logic in place_booking.js checked if ANY disabled date fell within the trail period and would prevent selection. However, dates can be disabled for multiple reasons: 1. They conflict with an existing booking (correct reason to disable) 2. They are beyond the maxDate set by circulation rules (incorrect!) 3. They are in the past When hovering over the max selectable end date, the trail period would extend beyond the maxDate. Those dates were disabled by flatpickr automatically, and the code incorrectly interpreted this as a booking conflict, preventing selection of the otherwise valid max date. The Fix: ======== Modified the trail period conflict check (lines 995-1005) to only consider dates that are within the max date range. Disabled dates beyond the maxDate are now ignored when checking for trail conflicts. Before: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { trailDisable = true; } After: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null; if (!maxDate || elemDate.isSameOrBefore(maxDate)) { trailDisable = true; } } This ensures trail periods only prevent selection when they conflict with actual bookings, not when they extend beyond the circulation rules' maximum date. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190898|0 |1 is obsolete| | --- Comment #24 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190933 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190933&action=edit Bug 39584: Correct spelling in comment QA tools caught the spelling "caluclate" in a comment within the cypress test code. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190931|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190932|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190933|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #25 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191765 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191765&action=edit Bug 39584: Add Cypress tests for bookings lead and trail period behavior This commit adds comprehensive Cypress tests for the lead and trail period functionality in the bookings modal date picker. These tests validate the hover effects, conflict detection, and date selection constraints. The tests use cy.clock() to fix "today" to June 10, 2026, enabling deterministic testing without date arithmetic complications. Test coverage includes: - Lead period visual hints (CSS classes on hover) - Lead period conflict prevention with past dates - Lead period conflict prevention with existing bookings - Trail period visual hints (CSS classes on hover) - Trail period conflict prevention with existing bookings - Max date selection when trail period is clear (no false restrictions) Test setup: - Fixed date: June 10, 2026 - Lead period: 2 days - Trail period: 3 days - Issue length: 3 days with 2 renewals of 2 days each - Max booking period: 7 days - Blocker booking: June 25-27 (tests both lead and trail conflicts) Test phases: 1. Hover June 13 - lead period (June 11-12) is clear, no leadDisable 2. Select June 13, hover June 16 - trail period (June 17-19) is clear 3a. Hover June 11 - lead period includes past date (June 9), leadDisable 3b. Hover June 29 - lead period overlaps blocker (June 27), leadDisable 4. Select June 20, hover June 23 - trail overlaps blocker, trailDisable 5. Select June 13, hover June 20 (max) - trail is clear, selectable Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #26 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191766 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191766&action=edit Bug 39584: Fix trail period incorrectly limiting max booking date This commit fixes a bug where the trail period was preventing selection of the maximum end date allowed by circulation rules, even when there were no booking conflicts in the trail period. The Problem: ============ The hover logic in place_booking.js checked if ANY disabled date fell within the trail period and would prevent selection. However, dates can be disabled for multiple reasons: 1. They conflict with an existing booking (correct reason to disable) 2. They are beyond the maxDate set by circulation rules (incorrect!) 3. They are in the past When hovering over the max selectable end date, the trail period would extend beyond the maxDate. Those dates were disabled by flatpickr automatically, and the code incorrectly interpreted this as a booking conflict, preventing selection of the otherwise valid max date. The Fix: ======== Modified the trail period conflict check (lines 995-1005) to only consider dates that are within the max date range. Disabled dates beyond the maxDate are now ignored when checking for trail conflicts. Before: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { trailDisable = true; } After: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null; if (!maxDate || elemDate.isSameOrBefore(maxDate)) { trailDisable = true; } } This ensures trail periods only prevent selection when they conflict with actual bookings, not when they extend beyond the circulation rules' maximum date. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #27 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191767 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191767&action=edit Bug 39584: Fix end date disable to check selected item, not all items When a specific item is selected in the booking modal, the end date disable logic was incorrectly checking if ALL bookable items were unavailable before disabling a date. This meant dates with existing bookings for the selected item remained selectable if other items were available. Now when a specific item is selected (booking_item_id != 0), the logic checks if that specific item is in the unavailable_items list. The "all items unavailable" check is only used when "Any item" is selected. This aligns the end date selection behavior with the start date selection behavior, which already correctly checks only the selected item. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #28 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191768 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191768&action=edit Bug 39584: Correct spelling in comment QA tools caught the spelling "caluclate" in a comment within the cypress test code. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191765|0 |1 is obsolete| | --- Comment #29 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 191855 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191855&action=edit Bug 39584: Add Cypress tests for bookings lead and trail period behavior This commit adds comprehensive Cypress tests for the lead and trail period functionality in the bookings modal date picker. These tests validate the hover effects, conflict detection, and date selection constraints. The tests use cy.clock() to fix "today" to June 10, 2026, enabling deterministic testing without date arithmetic complications. Test coverage includes: - Lead period visual hints (CSS classes on hover) - Lead period conflict prevention with past dates - Lead period conflict prevention with existing bookings - Trail period visual hints (CSS classes on hover) - Trail period conflict prevention with existing bookings - Max date selection when trail period is clear (no false restrictions) Test setup: - Fixed date: June 10, 2026 - Lead period: 2 days - Trail period: 3 days - Issue length: 3 days with 2 renewals of 2 days each - Max booking period: 7 days - Blocker booking: June 25-27 (tests both lead and trail conflicts) Test phases: 1. Hover June 13 - lead period (June 11-12) is clear, no leadDisable 2. Select June 13, hover June 16 - trail period (June 17-19) is clear 3a. Hover June 11 - lead period includes past date (June 9), leadDisable 3b. Hover June 29 - lead period overlaps blocker (June 27), leadDisable 4. Select June 20, hover June 23 - trail overlaps blocker, trailDisable 5. Select June 13, hover June 20 (max) - trail is clear, selectable Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191766|0 |1 is obsolete| | --- Comment #30 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 191856 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191856&action=edit Bug 39584: Fix trail period incorrectly limiting max booking date This commit fixes a bug where the trail period was preventing selection of the maximum end date allowed by circulation rules, even when there were no booking conflicts in the trail period. The Problem: ============ The hover logic in place_booking.js checked if ANY disabled date fell within the trail period and would prevent selection. However, dates can be disabled for multiple reasons: 1. They conflict with an existing booking (correct reason to disable) 2. They are beyond the maxDate set by circulation rules (incorrect!) 3. They are in the past When hovering over the max selectable end date, the trail period would extend beyond the maxDate. Those dates were disabled by flatpickr automatically, and the code incorrectly interpreted this as a booking conflict, preventing selection of the otherwise valid max date. The Fix: ======== Modified the trail period conflict check (lines 995-1005) to only consider dates that are within the max date range. Disabled dates beyond the maxDate are now ignored when checking for trail conflicts. Before: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { trailDisable = true; } After: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null; if (!maxDate || elemDate.isSameOrBefore(maxDate)) { trailDisable = true; } } This ensures trail periods only prevent selection when they conflict with actual bookings, not when they extend beyond the circulation rules' maximum date. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191767|0 |1 is obsolete| | --- Comment #31 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Created attachment 191857 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191857&action=edit Bug 39584: Fix end date disable to check selected item, not all items When a specific item is selected in the booking modal, the end date disable logic was incorrectly checking if ALL bookable items were unavailable before disabling a date. This meant dates with existing bookings for the selected item remained selectable if other items were available. Now when a specific item is selected (booking_item_id != 0), the logic checks if that specific item is in the unavailable_items list. The "all items unavailable" check is only used when "Any item" is selected. This aligns the end date selection behavior with the start date selection behavior, which already correctly checks only the selected item. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.derscheid@lmscloud.de Attachment #191768|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #32 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Had to obsolete the type correction patch since it needs to be resolved in Bug 39916 as this bug depends on it. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|nick@bywatersolutions.com |me@paulderscheid.xyz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191855|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191856|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191857|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #33 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191941 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191941&action=edit Bug 39584: Add Cypress tests for bookings lead and trail period behavior This commit adds comprehensive Cypress tests for the lead and trail period functionality in the bookings modal date picker. These tests validate the hover effects, conflict detection, and date selection constraints. The tests use cy.clock() to fix "today" to June 10, 2026, enabling deterministic testing without date arithmetic complications. Test coverage includes: - Lead period visual hints (CSS classes on hover) - Lead period conflict prevention with past dates - Lead period conflict prevention with existing bookings - Trail period visual hints (CSS classes on hover) - Trail period conflict prevention with existing bookings - Max date selection when trail period is clear (no false restrictions) Test setup: - Fixed date: June 10, 2026 - Lead period: 2 days - Trail period: 3 days - Issue length: 3 days with 2 renewals of 2 days each - Max booking period: 7 days - Blocker booking: June 25-27 (tests both lead and trail conflicts) Test phases: 1. Hover June 13 - lead period (June 11-12) is clear, no leadDisable 2. Select June 13, hover June 16 - trail period (June 17-19) is clear 3a. Hover June 11 - lead period includes past date (June 9), leadDisable 3b. Hover June 29 - lead period overlaps blocker (June 27), leadDisable 4. Select June 20, hover June 23 - trail overlaps blocker, trailDisable 5. Select June 13, hover June 20 (max) - trail is clear, selectable Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #34 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191942 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191942&action=edit Bug 39584: Fix trail period incorrectly limiting max booking date This commit fixes a bug where the trail period was preventing selection of the maximum end date allowed by circulation rules, even when there were no booking conflicts in the trail period. The Problem: ============ The hover logic in place_booking.js checked if ANY disabled date fell within the trail period and would prevent selection. However, dates can be disabled for multiple reasons: 1. They conflict with an existing booking (correct reason to disable) 2. They are beyond the maxDate set by circulation rules (incorrect!) 3. They are in the past When hovering over the max selectable end date, the trail period would extend beyond the maxDate. Those dates were disabled by flatpickr automatically, and the code incorrectly interpreted this as a booking conflict, preventing selection of the otherwise valid max date. The Fix: ======== Modified the trail period conflict check (lines 995-1005) to only consider dates that are within the max date range. Disabled dates beyond the maxDate are now ignored when checking for trail conflicts. Before: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { trailDisable = true; } After: if (elemDate.isAfter(trailStart) && elemDate.isSameOrBefore(trailEnd)) { const maxDate = periodPicker.config.maxDate ? dayjs(periodPicker.config.maxDate) : null; if (!maxDate || elemDate.isSameOrBefore(maxDate)) { trailDisable = true; } } This ensures trail periods only prevent selection when they conflict with actual bookings, not when they extend beyond the circulation rules' maximum date. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #35 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 191943 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191943&action=edit Bug 39584: Fix end date disable to check selected item, not all items When a specific item is selected in the booking modal, the end date disable logic was incorrectly checking if ALL bookable items were unavailable before disabling a date. This meant dates with existing bookings for the selected item remained selectable if other items were available. Now when a specific item is selected (booking_item_id != 0), the logic checks if that specific item is in the unavailable_items list. The "all items unavailable" check is only used when "Any item" is selected. This aligns the end date selection behavior with the start date selection behavior, which already correctly checks only the selected item. Signed-off-by: Kristi Krueger <kkrueger@cuyahogalibrary.org> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40134 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40134 [Bug 40134] Fix and optimise 'Any item' functionality of bookings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|37707 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37707 [Bug 37707] Lead/Trail times should work in combination -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|37354 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37354 [Bug 37354] Bookings should respect circulation rules for max loan periods -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #36 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com | |, | |jacob.omara@openfifth.co.uk --- Comment #37 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- It'd be nice to get this backported to 25.11 if possible. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.02 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 --- Comment #38 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39584 Laura Escamilla <Laura.escamilla@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Needs documenting CC| |Laura.escamilla@bywatersolu | |tions.com --- Comment #39 from Laura Escamilla <Laura.escamilla@bywatersolutions.com> --- This will not be backported to 25.05.x as it depends on bug 39916, which does not apply cleanly to that branch. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org