Bug 30713 - Patron entry should limit date of birth selection to dates in the past
Summary: Patron entry should limit date of birth selection to dates in the past
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-06 15:18 UTC by Owen Leonard
Modified: 2022-07-12 15:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the date of birth field for the patron entry form so that the calendar widget does not let you select a date in the future.
Version(s) released in:
22.11.00, 22.05.03


Attachments
Bug 30713: Patron entry should limit date of birth selection to dates in the past (1.97 KB, patch)
2022-05-06 16:47 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 30713: Patron entry should limit date of birth selection to dates in the past (2.07 KB, patch)
2022-05-10 14:28 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 30713: Patron entry should limit date of birth selection to dates in the past (2.12 KB, patch)
2022-05-10 21:30 UTC, David Nind
Details | Diff | Splinter Review
Bug 30713: Patron entry should limit date of birth selection to dates in the past (2.17 KB, patch)
2022-05-13 08:05 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2022-05-06 15:18:27 UTC
In the patron entry form, the calendar widget lets the user pick dates in the future. It should require dates in the past.
Comment 1 Owen Leonard 2022-05-06 16:47:15 UTC Comment hidden (obsolete)
Comment 2 David Nind 2022-05-09 03:52:54 UTC
Hi Owen.

This does change the calendar widget, but clicking on 'Yesterday' clears an existing date in the input field and doesn't put yesterday's date in for both an existing patron and a new patron (tried in both Firefox Developer Edition and Google Chrome).

I can select the date from the date picker, and future dates are not shown.

I'm hoping this is something to do with the timezone set for koha-testing-docker and my desktop.

David
Comment 3 Sally 2022-05-10 13:22:47 UTC
I used a sandbox and get the same result as David.
Comment 4 Owen Leonard 2022-05-10 14:28:21 UTC
Created attachment 134816 [details] [review]
Bug 30713: Patron entry should limit date of birth selection to dates in the past

This patch adds to the configuration of the date of birth field in the
patron entry form so that the calendar widget prohibits the selection of
a date in the future.

To test, apply the patch and open a patron record for editing. Try to
select a birth date in the future using the calendar widget. You should
be limited to a selection of today or before.

Confirm that clicking the "Yesterday" and "Today" shortcuts in the
calendar widget works correctly.
Comment 5 Owen Leonard 2022-05-10 14:31:22 UTC
> This does change the calendar widget, but clicking on 'Yesterday' clears an
> existing date in the input field and doesn't put yesterday's date

Further investigation shows that this is a bug in our Flatpickr implementation, not with the change I've made to this particular template. See the "Patrons with no checkouts" report (/cgi-bin/koha/reports/borrowers_out.pl) which has a similarly-configured date picker.

While debugging this I did see that I'd missed one of the options Jonathan implemented in Flatpickr: a "pastinclusive" option which limits to dates in the past OR today. This is both more correct for this situation and working correctly, so I have resubmitted with this change.
Comment 6 David Nind 2022-05-10 21:30:18 UTC
Created attachment 134836 [details] [review]
Bug 30713: Patron entry should limit date of birth selection to dates in the past

This patch adds to the configuration of the date of birth field in the
patron entry form so that the calendar widget prohibits the selection of
a date in the future.

To test, apply the patch and open a patron record for editing. Try to
select a birth date in the future using the calendar widget. You should
be limited to a selection of today or before.

Confirm that clicking the "Yesterday" and "Today" shortcuts in the
calendar widget works correctly.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2022-05-10 21:36:37 UTC
Thanks Owen for fixing - I wasn't sure I had originally tested it correctly (thanks also Sally for testing and confirming as well!).
Comment 8 Katrin Fischer 2022-05-13 08:05:30 UTC
Created attachment 134950 [details] [review]
Bug 30713: Patron entry should limit date of birth selection to dates in the past

This patch adds to the configuration of the date of birth field in the
patron entry form so that the calendar widget prohibits the selection of
a date in the future.

To test, apply the patch and open a patron record for editing. Try to
select a birth date in the future using the calendar widget. You should
be limited to a selection of today or before.

Confirm that clicking the "Yesterday" and "Today" shortcuts in the
calendar widget works correctly.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Comment 9 Tomás Cohen Arazi 2022-06-06 16:51:13 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 10 Lucas Gass 2022-07-12 15:43:09 UTC
Backported to 22.05.x for 22.05.03