Bug 19249 - Date picker broken in "Quick add new patron" form
Summary: Date picker broken in "Quick add new patron" form
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Nick Clemens (kidclamp)
URL:
Keywords:
Depends on: 3534
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-04 11:00 UTC by Fridolin Somers
Modified: 2023-12-28 20:44 UTC (History)
13 users (show)

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


Attachments
Bug 19249: Fix date inputs on patron quick add form (7.70 KB, patch)
2023-05-03 14:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19249: Fix date inputs on patron quick add form (7.76 KB, patch)
2023-05-04 08:39 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 19249: Fix date inputs on patron quick add form (7.82 KB, patch)
2023-05-04 10:45 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 19249: Fix date inputs on patron quick add form (7.82 KB, patch)
2023-05-04 15:01 UTC, Nicolas Giraud
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2017-09-04 11:00:04 UTC
If a date input like date of birth is mandatory, in quick add brief form the calendar icon appears but clicking on it does nothing.
This is because quick add brief form creates a clone of inputs in the original form.
An input with date picker is changed and linked to Javascript code (see calendar.inc) so it can not be cloned.

Note also that creating a clone of an input in another form does not update the form value in its DOM. It can generate errors.

In my opinion this feature should be reconsidered to hide unwanted fields instead of cloning wanted ones. Many bugs may be avoided.
Comment 1 Fridolin Somers 2017-09-04 11:02:43 UTC
Also date of birth has a small JS code showing age when date is changed.
Comment 2 Feli Kramer 2017-09-23 14:24:28 UTC
How to reproduce this bug?

1. In the system preferences, add "dateofbirth" to "Patrons > General > BorrowerMandatoryField".
2. Go to the "Patrons" page.
3. Click "Quick add new patron" and select a patron category.
4. You will be shown the brief form.
5. Click on the calendar icon next to the "Date of birth" input field.
Comment 3 Katrin Fischer 2019-08-18 10:28:51 UTC
This is still valid - when marking dateofbirth mandatory, the datepicker doesn't work on the quick add patron form.
Comment 4 Jonathan Druart 2019-09-01 19:48:53 UTC
Yes, as well as all other date fields.

As Fridolin said we should rework the way the fields are displayed/hidden. It's not an easy fix.
Comment 5 Sally 2022-06-15 13:10:30 UTC
I came here to log this bug - the clone of inputs has been giving me a headache this week when trying to target those areas with jQuery, and the non-working datepicker is a real issue for us.

I realise it's not an easy fix from what's been said, but just adding a 'still valid' comment.
Comment 6 Katrin Fischer 2022-06-17 21:00:48 UTC
I can confirm this is still an issue on master. Kind of a sore spot: a quick is not as quick with a broken datepicker.
Comment 7 Agnes Rivers-Moore 2022-07-29 18:08:00 UTC
In our system we do not have Date of Birth as mandatory. We actually have DateOfBirth in BorrowerUnwantedField so it does not appear in either the long or quick patron form. I wanted to comment that we are unable to get the registration date and expiry date fields to appear in the Quick Add form. They are listed as in the Preference PatronQuickAddFields, but are absent from the staff interface. Not sure if this is related to the broken picker issue.
Comment 8 Carolyn Hughesman 2022-12-07 13:51:03 UTC
This is an issue for us.  Quick add is not as useful to us without the datepicker. 

If fact, when adding a dateofbirth manually, it does not save. The dateofbirth field is empty when one goes back to edit said patron.
Comment 9 Koha Team University Lyon 3 2023-02-13 16:01:40 UTC
On koha version 20.11, we could still enter the date manually but from 21.11.11, it's not even possible.
Comment 10 Katrin Fischer 2023-04-16 14:23:08 UTC
Updating severity - this is a bad issue and we have kept it around for too long.
Comment 11 Jonathan Druart 2023-05-03 14:17:14 UTC
Created attachment 150589 [details] [review]
Bug 19249: Fix date inputs on patron quick add form

This patch create a "apply_flatpickr" JS function to make the code
reusable from the template, where we loop over the date inputs to
reinstantiate flatpickr.
Comment 12 PTFS Europe Sandboxes 2023-05-04 08:39:57 UTC
Created attachment 150632 [details] [review]
Bug 19249: Fix date inputs on patron quick add form

This patch create a "apply_flatpickr" JS function to make the code
reusable from the template, where we loop over the date inputs to
reinstantiate flatpickr.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 13 Sally 2023-05-04 08:40:35 UTC
Works as described, thanks for this important fix!
Comment 14 Nick Clemens (kidclamp) 2023-05-04 10:45:28 UTC
Created attachment 150644 [details] [review]
Bug 19249: Fix date inputs on patron quick add form

This patch create a "apply_flatpickr" JS function to make the code
reusable from the template, where we loop over the date inputs to
reinstantiate flatpickr.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 15 Nicolas Giraud 2023-05-04 15:01:58 UTC
Created attachment 150679 [details] [review]
Bug 19249: Fix date inputs on patron quick add form

This patch create a "apply_flatpickr" JS function to make the code
reusable from the template, where we loop over the date inputs to
reinstantiate flatpickr.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Nicolas Giraud <nicolas.giraud@inlibro.com>
Comment 16 Tomás Cohen Arazi 2023-05-05 12:16:44 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 17 Martin Renvoize 2023-05-11 11:23:47 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 18 Lucas Gass 2023-05-15 22:22:00 UTC
Does not apply cleanly to 22.05.x, no backport.