Bug 29278 - write_age function broken by Flatpickr conversion
Summary: write_age function broken by Flatpickr conversion
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 28937
Blocks: 26244
  Show dependency treegraph
 
Reported: 2021-10-19 16:18 UTC by Owen Leonard
Modified: 2022-06-06 20:24 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the display of a patron's age in the staff interface after the date of birth field (for example: Age: 63 years 4 months). This was not displaying after the switch to Flatpickr for date entry on this page in the 21.11 release development cycle.
Version(s) released in:
21.11.00
Circulation function:


Attachments
Bug 29278: Fix selector of hint used to show age (2.83 KB, patch)
2021-10-19 16:30 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 29278: Fix selector of hint used to show age (2.88 KB, patch)
2021-10-20 22:55 UTC, David Nind
Details | Diff | Splinter Review
Bug 29278: Fix selector of hint used to show age (2.94 KB, patch)
2021-10-23 23:01 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 2021-10-19 16:18:44 UTC
The write_age() function builds a string describing the patron's age based on the date of birth field in the patron entry form.

The function has been broken by Bug 28937 because the HTML structure of the page has changed.
Comment 1 Owen Leonard 2021-10-19 16:30:49 UTC
Created attachment 126528 [details] [review]
Bug 29278: Fix selector of hint used to show age

This patch modifies the patron entry form to correct a problem with the
write_age() function introduced by the switch to Flatpickr on this page
(Bug 28937).

Rather than selecting the element based on the sequence of elements on
the page, we should add an ID for direct selection.

To test, apply the patch and go to Patrons.

- Locate a patron record which has a date of birth saved.
  - When you open that patron for editing, you should see their age
    displayed below the date of birth input field, e.g. "Age: 23 years 9
    months."
  - Changing the date in the date of birth field should update the age
    string correctly.
- Go to Patrons -> New patron.
  - The date of birth field should have a hint showing the required date
    format, e.g. "(DD.MM.YYYY)".
  - When you select a date of birth using the Flatpickr calendar the age
    string should be updated correctly.
Comment 2 David Nind 2021-10-20 22:55:54 UTC
Created attachment 126631 [details] [review]
Bug 29278: Fix selector of hint used to show age

This patch modifies the patron entry form to correct a problem with the
write_age() function introduced by the switch to Flatpickr on this page
(Bug 28937).

Rather than selecting the element based on the sequence of elements on
the page, we should add an ID for direct selection.

To test, apply the patch and go to Patrons.

- Locate a patron record which has a date of birth saved.
  - When you open that patron for editing, you should see their age
    displayed below the date of birth input field, e.g. "Age: 23 years 9
    months."
  - Changing the date in the date of birth field should update the age
    string correctly.
- Go to Patrons -> New patron.
  - The date of birth field should have a hint showing the required date
    format, e.g. "(DD.MM.YYYY)".
  - When you select a date of birth using the Flatpickr calendar the age
    string should be updated correctly.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Katrin Fischer 2021-10-21 14:19:43 UTC
While I LOVE the text to go in the release notes I wonder if it's useful for a case like this when the feature that causes it will only be released with 21.11 - so the bug this fixes hasn't had a chance to hit anyone (my favourite bugs of all). 

Maybe we should focus on the enh/new features and behaviour changing ones?
Comment 4 Katrin Fischer 2021-10-23 23:01:31 UTC
Created attachment 126794 [details] [review]
Bug 29278: Fix selector of hint used to show age

This patch modifies the patron entry form to correct a problem with the
write_age() function introduced by the switch to Flatpickr on this page
(Bug 28937).

Rather than selecting the element based on the sequence of elements on
the page, we should add an ID for direct selection.

To test, apply the patch and go to Patrons.

- Locate a patron record which has a date of birth saved.
  - When you open that patron for editing, you should see their age
    displayed below the date of birth input field, e.g. "Age: 23 years 9
    months."
  - Changing the date in the date of birth field should update the age
    string correctly.
- Go to Patrons -> New patron.
  - The date of birth field should have a hint showing the required date
    format, e.g. "(DD.MM.YYYY)".
  - When you select a date of birth using the Flatpickr calendar the age
    string should be updated correctly.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2021-10-25 13:59:11 UTC
Pushed to master for 21.11, thanks to everybody involved!