Bug 37363 - Booking dates should respect closed days
Summary: Booking dates should respect closed days
Status: ASSIGNED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on: 34440
Blocks: 36383
  Show dependency treegraph
 
Reported: 2024-07-15 15:01 UTC by Martin Renvoize (ashimema)
Modified: 2024-09-05 19:02 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37363: Initial work on supporting closed days (3.08 KB, patch)
2024-07-26 08:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2024-07-15 15:01:38 UTC
The bookings datepicker is not aware of open/closed days at present and as such a booking may be made that would expect fulfilment or return on a closed day.

We should update the flatpickr to disable such dates for direct selection, but allow spanning them.
Comment 1 Martin Renvoize (ashimema) 2024-07-15 15:02:07 UTC
Flatpickr doesn't appear to support this spanning functionality natively.. there are a few idea's here though: https://github.com/flatpickr/flatpickr/issues/955
Comment 2 Martin Renvoize (ashimema) 2024-07-25 12:17:43 UTC
This works from onDayCreate:


```
    // Make closed days unclickable (while keeping them part of the range)
    if (date.getDay() === 0 || date.getDay() === 6) {
        dayElem.classList.add("closed-day");

        // Remove the click event to disable the day
        dayElem.addEventListener('click', function(event) {
            event.stopImmediatePropagation();
        }, true);
    }
```

I'll submit the patch once I've finished work on bug 34440
Comment 3 Martin Renvoize (ashimema) 2024-07-26 08:19:19 UTC
Created attachment 169687 [details] [review]
Bug 37363: Initial work on supporting closed days

This is just a proof of concept at this point.. we need api's for
fetching regular and irregular closed days before we can fully impliment
the functionality.
Comment 4 Aude Charillon 2024-08-12 08:32:39 UTC
This is of interest to a library we work with: they use the Tools > Calendar to mark closed days and would like to see those closed days greyed out when placing bookings.
Comment 5 Martin Renvoize (ashimema) 2024-08-23 20:41:47 UTC
The main blocker here is the lack of API's for fetching calendar open/closed days.

We need to work on that first and also consider how opening hours and days work together.