Bug 39501

Summary: Incorrect relationship code chosen when linking authorities with other authorities
Product: Koha Reporter: Andreas Roussos <a.roussos>
Component: MARC Authority data supportAssignee: Andreas Roussos <a.roussos>
Status: Pushed to main --- QA Contact: Lucas Gass (lukeg) <lucas>
Severity: normal    
Priority: P5 - low CC: laurence.rault, 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:
Version(s) released in:
25.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 21453    
Attachments: Screenshot of the Staff interface showing the problem
Bug 39501: add "value=" attributes to the HTML select element
Bug 39501: add "value=" attributes to the HTML select element
Bug 39501: add "value=" attributes to the HTML select element

Description Andreas Roussos 2025-03-31 14:12:50 UTC
Created attachment 180049 [details]
Screenshot of the Staff interface showing the problem

While working on something unrelated (Bug 21453), I noticed that
in the current main branch, when linking authorities with other
authorities, if you select a relationship you no longer get the
associated letter (i.e. the "relationship code") copied to the
appropriate subfield. Rather, the whole description gets copied.

So, if you select "g - Broader term" (in MARC21), the following
value gets copied to subfield $w:

g - Broader term

Instead of the correct value, which is simply:

g

The attached screenshot is an example of what I'm referring to.
Comment 1 Andreas Roussos 2025-03-31 14:13:39 UTC
This comes from commit 1f6d58f523bcb420fe01bbc16ccd56d43ac07e7b
(Bug 38714), which introduced changes to auth-finder-search.inc
and in the process removed the "value=" attributes from the HTML
<select> element responsible for selecting the relationship code
between authorities (when linking authorities with authorities).

The fix is trivial -- expect a patch soon ;-)

P.S. Greetings from the Hackfest in Marseille!
Comment 2 Andreas Roussos 2025-03-31 14:20:14 UTC
Created attachment 180054 [details] [review]
Bug 39501: add "value=" attributes to the HTML select element

In the current main branch, when linking authorities with other
authorities, if you select a relationship you no longer get the
associated letter (i.e. the "relationship code") copied to the
appropriate subfield. Rather, the whole description gets copied.

This patch fixes that.

Test plan:

0) [PREREQUISITES in order for the authority finder plugin to come up]
   a) You must have at least one authority type besides the 'Default'.
   b) View the MARC structure of the 'Default' auth type, then click
      on 'Actions->Subfields' for tag 500; click on 'Edit subfields'.
      Select the subfield 'a' tab, then pick an auth type from the
      'Thesaurus:' dropdown menu; click 'Save changes' at the top.

1) In the Staff client, go to Authorities, then click 'New Authority'
   and pick the 'Default' authority type (or edit an existing auth).

2) When the authority editor comes up, go to tag 500 and expand it.

3) Click on the ellipsis (...) next to subfield $a.

4) When the authority finder comes up, search for an authority, pick
   a relator code from the 'Special relationship:' dropdown, and then
   click on the 'Choose' button for one of the authorities you found.

5) Notice that the whole description for the relationship you selected
   gets copied (instead of just the single letter relationship code).

6) Apply this patch.

7) Repeat steps 1-4.
   Notice that, this time, only the relationship code gets copied over.
Comment 3 Biblibre Sandboxes 2025-04-02 14:59:04 UTC
Created attachment 180413 [details] [review]
Bug 39501: add "value=" attributes to the HTML select element

In the current main branch, when linking authorities with other
authorities, if you select a relationship you no longer get the
associated letter (i.e. the "relationship code") copied to the
appropriate subfield. Rather, the whole description gets copied.

This patch fixes that.

Test plan:

0) [PREREQUISITES in order for the authority finder plugin to come up]
   a) You must have at least one authority type besides the 'Default'.
   b) View the MARC structure of the 'Default' auth type, then click
      on 'Actions->Subfields' for tag 500; click on 'Edit subfields'.
      Select the subfield 'a' tab, then pick an auth type from the
      'Thesaurus:' dropdown menu; click 'Save changes' at the top.

1) In the Staff client, go to Authorities, then click 'New Authority'
   and pick the 'Default' authority type (or edit an existing auth).

2) When the authority editor comes up, go to tag 500 and expand it.

3) Click on the ellipsis (...) next to subfield $a.

4) When the authority finder comes up, search for an authority, pick
   a relator code from the 'Special relationship:' dropdown, and then
   click on the 'Choose' button for one of the authorities you found.

5) Notice that the whole description for the relationship you selected
   gets copied (instead of just the single letter relationship code).

6) Apply this patch.

7) Repeat steps 1-4.
   Notice that, this time, only the relationship code gets copied over.

Signed-off-by: Laurence <laurence.rault@biblibre.com>
Comment 4 Laurence Rault 2025-04-02 15:00:09 UTC
The functionality is working as expected
Comment 5 Lucas Gass (lukeg) 2025-04-18 19:39:55 UTC
Created attachment 181193 [details] [review]
Bug 39501: add "value=" attributes to the HTML select element

In the current main branch, when linking authorities with other
authorities, if you select a relationship you no longer get the
associated letter (i.e. the "relationship code") copied to the
appropriate subfield. Rather, the whole description gets copied.

This patch fixes that.

Test plan:

0) [PREREQUISITES in order for the authority finder plugin to come up]
   a) You must have at least one authority type besides the 'Default'.
   b) View the MARC structure of the 'Default' auth type, then click
      on 'Actions->Subfields' for tag 500; click on 'Edit subfields'.
      Select the subfield 'a' tab, then pick an auth type from the
      'Thesaurus:' dropdown menu; click 'Save changes' at the top.

1) In the Staff client, go to Authorities, then click 'New Authority'
   and pick the 'Default' authority type (or edit an existing auth).

2) When the authority editor comes up, go to tag 500 and expand it.

3) Click on the ellipsis (...) next to subfield $a.

4) When the authority finder comes up, search for an authority, pick
   a relator code from the 'Special relationship:' dropdown, and then
   click on the 'Choose' button for one of the authorities you found.

5) Notice that the whole description for the relationship you selected
   gets copied (instead of just the single letter relationship code).

6) Apply this patch.

7) Repeat steps 1-4.
   Notice that, this time, only the relationship code gets copied over.

Signed-off-by: Laurence <laurence.rault@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 6 Katrin Fischer 2025-04-22 06:50:47 UTC
Pushed for 25.05!

Well done everyone, thank you!