Summary: | Cannot link authorities with other authorities | ||
---|---|---|---|
Product: | Koha | Reporter: | Andreas Roussos <a.roussos> |
Component: | MARC Authority data support | Assignee: | Andreas Roussos <a.roussos> |
Status: | Pushed to main --- | QA Contact: | Lucas Gass (lukeg) <lucas> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, lucas |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: |
This fixes adding (or editing) authority terms to authority records (for example, 500$a)- choosing a term using the authority finder was not adding the selected term to the authority record (it was staying on authority finder pop up window, and generated a JavaScript error).
|
|
Version(s) released in: |
25.05.00
|
Circulation function: | |
Attachments: |
Bug 38987: Use the correct HTML id attribute
Bug 38987: Use the correct HTML id attribute Bug 38987: Use the correct HTML id attribute |
Description
Andreas Roussos
2025-01-28 15:52:14 UTC
Steps to reproduce: 1) Navigate to Koha's Authorities module and create a new authority (using the 'Default' authority type). In tab 5, expand field 500 by clicking on its description. 2) Launch the Authority finder form by clicking on the small 'Tag editor' button on the far right of subfield 500$a. 3) Click the yellow 'Search' button at the bottom of the page. When the results appear, click on the '+ Choose' button for one of the authorities (any authority will do). Notice that nothing happens and the Authority finder stays open, whereas normally it should close automatically at this point and transfer you back to the authority editor, copying the info from the authority you selected into the subfields of field 500. Press F12 (works in Chrome and Firefox) to launch the Developer Tools of your browser and notice that in the JavaScript console the following error message has been registered: "Uncaught TypeError: e is null" Analysis of the Bug: Clicking on one of the '+ Choose' buttons actually calls the doauth() function, defined in koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt: 143 function doauth(authid, index, repet){ 144 [% IF source == 'auth' %] 145 var e = document.getElementById("relationship"); 146 var relationship = e.options[e.selectedIndex].value; 147 148 jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet + '&relationship=' + relationship); 149 [% ELSE %] 150 jumpfull('blinddetail-biblio-search.pl?authid=' + authid + '&index=' + index + '&repet=' + repet); 151 [% END %] 152 } As per the code above, whenever authority-to-authority linking takes place (source == 'auth'), `e` is the JavaScript variable assigned to the object/HTML element with an id attribute equal to 'relationship'. This refers to the 'Special relationship' dropdown menu that allows you to select a relationship code before picking an authority with the '+ Choose' button. Commit a605c070c7 (from Bug 31470) introduced a change to koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc which renamed the id attribute of the 'Special relationship' <select> element from 'relationship' to 'special_relationship'. Therefore the fix for this Bug is trivial, and involves just a change in the `getElementById()` call. Additionally, to avoid any confusion regarding the variable name (AIUI `e` is often used for Event objects), I'm suggesting we rename it to `elem` (short for 'element'). Created attachment 177284 [details] [review] Bug 38987: Use the correct HTML id attribute Starting with Koha 24.11.01, we can no longer link authorities with other authorities (linking a bibliographic record with an authority still works fine). This affects both MARC21 and UNIMARC instances, and is valid on the main branch, too. This patch fixes that. Test plan: 1) Navigate to Koha's Authorities module and create a new authority (using the 'Default' authority type). In tab 5, expand field 500 by clicking on its description. 2) Launch the Authority finder form by clicking on the small 'Tag editor' button on the far right of subfield 500$a. 3) Click the yellow 'Search' button at the bottom of the page. When the results appear, click on the '+ Choose' button for one of the authorities (any authority will do). Notice that nothing happens and the Authority finder stays open, whereas normally it should close automatically at this point and transfer you back to the authority editor, copying the info from the authority you selected into the subfields of field 500. Press F12 (works in Chrome and Firefox) to launch the Developer Tools of your browser and notice that in the JavaScript console the following error message has been registered: "Uncaught TypeError: e is null" 4) Apply this patch (and restart_all for good measure), then press CTRL-F5 to reload all JS assets. 5) Repeat step 3) above; this time, when you click on the '+ Choose' button the authority finder window will close and the contents of the authority you selected will be copied into the subfields of field 500. Created attachment 177310 [details] [review] Bug 38987: Use the correct HTML id attribute Starting with Koha 24.11.01, we can no longer link authorities with other authorities (linking a bibliographic record with an authority still works fine). This affects both MARC21 and UNIMARC instances, and is valid on the main branch, too. This patch fixes that. Test plan: 1) Navigate to Koha's Authorities module and create a new authority (using the 'Default' authority type). In tab 5, expand field 500 by clicking on its description. 2) Launch the Authority finder form by clicking on the small 'Tag editor' button on the far right of subfield 500$a. 3) Click the yellow 'Search' button at the bottom of the page. When the results appear, click on the '+ Choose' button for one of the authorities (any authority will do). Notice that nothing happens and the Authority finder stays open, whereas normally it should close automatically at this point and transfer you back to the authority editor, copying the info from the authority you selected into the subfields of field 500. Press F12 (works in Chrome and Firefox) to launch the Developer Tools of your browser and notice that in the JavaScript console the following error message has been registered: "Uncaught TypeError: e is null" 4) Apply this patch (and restart_all for good measure), then press CTRL-F5 to reload all JS assets. 5) Repeat step 3) above; this time, when you click on the '+ Choose' button the authority finder window will close and the contents of the authority you selected will be copied into the subfields of field 500. Signed-off-by: David Nind <david@davidnind.com> Thank you very much, David, for adding the release notes for this! Created attachment 177325 [details] [review] Bug 38987: Use the correct HTML id attribute Starting with Koha 24.11.01, we can no longer link authorities with other authorities (linking a bibliographic record with an authority still works fine). This affects both MARC21 and UNIMARC instances, and is valid on the main branch, too. This patch fixes that. Test plan: 1) Navigate to Koha's Authorities module and create a new authority (using the 'Default' authority type). In tab 5, expand field 500 by clicking on its description. 2) Launch the Authority finder form by clicking on the small 'Tag editor' button on the far right of subfield 500$a. 3) Click the yellow 'Search' button at the bottom of the page. When the results appear, click on the '+ Choose' button for one of the authorities (any authority will do). Notice that nothing happens and the Authority finder stays open, whereas normally it should close automatically at this point and transfer you back to the authority editor, copying the info from the authority you selected into the subfields of field 500. Press F12 (works in Chrome and Firefox) to launch the Developer Tools of your browser and notice that in the JavaScript console the following error message has been registered: "Uncaught TypeError: e is null" 4) Apply this patch (and restart_all for good measure), then press CTRL-F5 to reload all JS assets. 5) Repeat step 3) above; this time, when you click on the '+ Choose' button the authority finder window will close and the contents of the authority you selected will be copied into the subfields of field 500. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Reported yesterday, pushed today... not too bad :) Pushed for 25.05! Well done everyone, thank you! |