From 8d3b0f4d499a357b2ca7ead8ced601966dfae7b1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 14 May 2025 14:18:47 +0100 Subject: [PATCH] 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. --- koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js index 634cce0c36e..5b58be66375 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js +++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js @@ -767,7 +767,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { const maxDate = new Date(startDate.getTime()); maxDate.setDate( - maxDate.getDate() + totalIssueLength + maxDate.getDate() + totalIssueLength + parseInt(trailDays) ); // Update the maxDate option of the flatpickr instance -- 2.49.0