Bug 34571

Summary: Remove use of onclick for ExpandField
Product: Koha Reporter: David Cook <dcook>
Component: Architecture, internals, and plumbingAssignee: David Cook <dcook>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: minor    
Priority: P5 - low CC: fridolin.somers
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.10
Bug Depends on:    
Bug Blocks: 20397    
Attachments: Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors
Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors
Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors

Description David Cook 2023-08-18 03:51:54 UTC
Like bug 34570, we want to get rid of "onclick".

In this case, I'm targeting ExpandField.
Comment 1 David Cook 2023-08-18 04:24:49 UTC
Actually this one needs to be in both Cataloguing and Authorities...
Comment 2 David Cook 2023-08-18 04:35:06 UTC
Created attachment 154584 [details] [review]
Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors

This change replaces the onclick HTML attribute with a Javascript binding
to make it more in line with Koha conventions and make it CSP compatible.

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=#
2. Try hiding/unhiding fields
3. Try cloning fields and hiding/unhiding those too
4. Note that everything works as expected
5. Do the same thing for authorities by going to
http://localhost:8081/cgi-bin/koha/authorities/authorities.pl?authtypecode=#
Comment 3 Owen Leonard 2023-08-18 06:45:07 UTC
Created attachment 154586 [details] [review]
Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors

This change replaces the onclick HTML attribute with a Javascript binding
to make it more in line with Koha conventions and make it CSP compatible.

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=#
2. Try hiding/unhiding fields
3. Try cloning fields and hiding/unhiding those too
4. Note that everything works as expected
5. Do the same thing for authorities by going to
http://localhost:8081/cgi-bin/koha/authorities/authorities.pl?authtypecode=#

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Katrin Fischer 2023-08-25 11:53:56 UTC
Created attachment 154803 [details] [review]
Bug 34571: Remove use of "onclick" for ExpandField in cataloguing editors

This change replaces the onclick HTML attribute with a Javascript binding
to make it more in line with Koha conventions and make it CSP compatible.

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=#
2. Try hiding/unhiding fields
3. Try cloning fields and hiding/unhiding those too
4. Note that everything works as expected
5. Do the same thing for authorities by going to
http://localhost:8081/cgi-bin/koha/authorities/authorities.pl?authtypecode=#

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2023-08-30 13:06:54 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-08-30 20:21:43 UTC
Pushed to 23.05.x for 23.05.04
Comment 7 Matt Blenkinsop 2023-08-31 10:47:23 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x