Bugzilla – Attachment 190825 Details for
Bug 39584
Booking post-processing time cuts into circulation period
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39584: Fix trail period incorrectly limiting max booking date
a40207c.patch (text/plain), 3.75 KB, created by
Martin Renvoize (ashimema)
on 2026-01-02 11:37:53 UTC
(
hide
)
Description:
Bug 39584: Fix trail period incorrectly limiting max booking date
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-01-02 11:37:53 UTC
Size:
3.75 KB
patch
obsolete
>From a40207c7d8a67e09e52a0b1582c08fd13d9429a9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Fri, 2 Jan 2026 11:17:02 +0000 >Subject: [PATCH] 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. >--- > .../prog/js/modals/place_booking.js | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 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 8bd0a6aed88..a97348b6bbd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -996,7 +996,21 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > elemDate.isAfter(trailStart) && > elemDate.isSameOrBefore(trailEnd) > ) { >- trailDisable = true; >+ // Only consider this a conflict if the disabled date is within the max date range >+ // (i.e., disabled due to booking conflict, not because it's beyond max date) >+ const maxDate = periodPicker.config >+ .maxDate >+ ? dayjs( >+ periodPicker.config >+ .maxDate >+ ) >+ : null; >+ if ( >+ !maxDate || >+ elemDate.isSameOrBefore(maxDate) >+ ) { >+ trailDisable = true; >+ } > } > } > dayElem.classList.remove("leadDisable"); >-- >2.52.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39584
:
181312
|
181394
|
182448
|
182451
|
182678
|
182679
|
182680
|
182910
|
190822
|
190823
|
190824
|
190825
|
190898
|
190931
|
190932
|
190933
|
191765
|
191766
|
191767
|
191768
|
191855
|
191856
|
191857
|
191941
|
191942
|
191943