Bug 36136

Summary: Flatpickr allows selecting date from the past on copied serial subscriptions
Product: Koha Reporter: Johanna Räisä <johanna.raisa>
Component: SerialsAssignee: Olli Kautonen <ollikautonen72>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, ollikautonen72
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: Sponsored
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 36136: Add validation to subscription end date
Bug 36136: Make sure 'to' dates are instantiated with the 'from' dates as minimum
Bug 36136: Make sure 'to' dates are instantiated with the 'from' dates as minimum

Description Johanna Räisä 2024-02-20 08:19:34 UTC
If a librarian copies a serial subscription and changes dates the Flatpickr allows to put end date to the past. Flatpickr prevents the action only if the start date is first added. In this case the old input value should be passed to the Flatpickr so the selection is not allowed.

I think this happens everywhere where we are using Flatpickr.
Comment 1 Olli Kautonen 2025-07-03 08:03:20 UTC
Created attachment 183724 [details] [review]
Bug 36136: Add validation to subscription end date

Fixed an issue where editing an existing subscription as a duplicate would result in being able to select the end date before the start date.

To test:

1)In Koha go to Serials
2)Search for existing subscriptions
3)Select a subscription
4)Select Edit, Edit as new(duplicate)
5)On the second page set the end date before the start date
6)When pressing save subscription a warning pops up, preventing you from selecting the end date before the start date.

Sponsored-by: Koha-Suomi Oy
Comment 2 Jonathan Druart 2025-07-18 13:14:40 UTC
Created attachment 184377 [details] [review]
Bug 36136: Make sure 'to' dates are instantiated with the 'from' dates as minimum
Comment 3 Jonathan Druart 2025-07-18 13:15:35 UTC
Sorry I don't have more time to test this patch, but the issue is global and must be fixed globally.

This patch is not perfect, but it is the least invasive and won't require to add a back reference to all "to" elements.
Comment 4 Owen Leonard 2025-07-18 18:07:09 UTC
Created attachment 184411 [details] [review]
Bug 36136: Make sure 'to' dates are instantiated with the 'from' dates as minimum

To test you should check the behavior of forms which have sets of "from"
and "to" dates. It shouldn't be possible to select a "to" date which is
before the "from" date. For example:

- Overdues report
- Invoice search

In some cases we need to check that the fields work correctly when the
"from" date is already filled:

- Editing vendor issues
- Editing a budget
- Duplicating a subscription

Signed-off-by: Owen Leonard <oleonard@myacpl.org>