Bug 30797 - Subfields linked to the dateaccessioned.pl value builder on addbiblio.pl throw a JS error
Summary: Subfields linked to the dateaccessioned.pl value builder on addbiblio.pl thro...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Alex Buckley
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-18 04:24 UTC by Alex Buckley
Modified: 2023-06-08 22:26 UTC (History)
6 users (show)

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


Attachments
Bug 30797: Add the calendar.inc include to addbiblio.tt (1.91 KB, patch)
2022-05-18 04:38 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 30797: Add the calendar.inc include to addbiblio.tt (2.00 KB, patch)
2022-05-18 11:11 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 30797: (follow-up) Hide default Flatpickr clear-field button (980 bytes, patch)
2022-05-18 12:31 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buckley 2022-05-18 04:24:24 UTC
By default the dateaccessioned.pl cataloguing value builder is linked to the 952$d subfield. When the additem.pl page loads the 952$d is pre-populated with today's date.

However, some libraries link the dateaccessioned.pl cataloguing value builder plugin to subfields displayed in the addbiblio.pl (biblio cataloguing page). For example, 902$d.

When you load the addbiblio.pl page those subfields are not pre-populated with today's date. Instead in the console you get the following JavaScript error:

Uncaught TypeError: $(...).flatpickr is not a function
Comment 1 Alex Buckley 2022-05-18 04:38:58 UTC
Created attachment 135088 [details] [review]
Bug 30797: Add the calendar.inc include to addbiblio.tt

addbiblio.tt throws the '$(...).flatpickr is not a function' because it
is missing includes to flatpickr.min.js and shortcut-buttons-flatpickr.min.js

To fix this the addbiblio.tt should include the calendar.inc file (like
additem.tt does) which includes to those aforementioned JS files.

Test plan:
1. Edit a MARC bibliographic framework
2. Make the 902$d subfield visible in the Editor
3. Also set the 902$d subfield plugin='dateaccessioned.pl'
4. Catalogue a new biblio record
5. Notice the 902$d subfield has not been pre-populated with todays date
6. Right click, choose 'Inspect', observe this JS error in the console: "Uncaught
TypeError: $(...).flatpickr is not a function"
7. Apply patch, and restart services
8. Repeat steps 4-6 and this time observe the 902$d is pre-populated,
and there is no flatpickr JS error in the console

Sponsored-by: Chartered Accountants Australia and New Zealand
Comment 2 Marcel de Rooy 2022-05-18 11:11:36 UTC
Created attachment 135098 [details] [review]
Bug 30797: Add the calendar.inc include to addbiblio.tt

addbiblio.tt throws the '$(...).flatpickr is not a function' because it
is missing includes to flatpickr.min.js and shortcut-buttons-flatpickr.min.js

To fix this the addbiblio.tt should include the calendar.inc file (like
additem.tt does) which includes to those aforementioned JS files.

Test plan:
1. Edit a MARC bibliographic framework
2. Make the 902$d subfield visible in the Editor
3. Also set the 902$d subfield plugin='dateaccessioned.pl'
4. Catalogue a new biblio record
5. Notice the 902$d subfield has not been pre-populated with todays date
6. Right click, choose 'Inspect', observe this JS error in the console: "Uncaught
TypeError: $(...).flatpickr is not a function"
7. Apply patch, and restart services
8. Repeat steps 4-6 and this time observe the 902$d is pre-populated,
and there is no flatpickr JS error in the console

Sponsored-by: Chartered Accountants Australia and New Zealand

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2022-05-18 11:14:48 UTC
Taking the liberty to promote to PQA directly. Trivial fix.

Note: There is a display problem with the red cross to clear the date field. I linked dateaccessioned to 100$b.
The red cross is directly next to Numeration label. The Tag editor button is at the far right side. And the text field is on the line under the red cross.

Could you have a look, Owen ?
Comment 4 Marcel de Rooy 2022-05-18 11:16:34 UTC
Note for RM: The previous comment should not block you from pushing this one.
Comment 5 Owen Leonard 2022-05-18 12:31:11 UTC
Created attachment 135103 [details] [review]
Bug 30797: (follow-up) Hide default Flatpickr clear-field button

The basic MARC editor has its own button associated with each subfield
for emptying the contents of the input. Since the Flatpickr "X" icon
causes a layout problem and would be redundant, we can hide it on this page.
Comment 6 Alex Buckley 2022-05-18 21:39:37 UTC
Thank you Marcel and Owen!
Comment 7 Fridolin Somers 2022-05-19 03:23:15 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑
Comment 8 Fridolin Somers 2022-10-07 20:10:38 UTC
This should be backported to 21.11
Comment 9 Arthur Suzuki 2022-10-12 08:49:27 UTC
applied to 21.11.x for 21.11.13
Comment 10 Victor Grousset/tuxayo 2022-10-13 15:12:20 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.
Comment 11 Arthur Suzuki 2022-10-22 22:08:16 UTC
Thanks!

Pushed to 21.11 for 21.11.12