Bug 34025

Summary: Uniform titles (130 / 240 /730) in biblio to link to authority file
Product: Koha Reporter: Bernard <bernard.scaife>
Component: OPACAssignee: Janusz Kaczmarek <januszop>
Status: Signed Off --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: ashley.day, januszop, lucas, martin.renvoize, r.delahunty, roman.dolny, verolencinas
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19558
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25156
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: code to be cloned
Bug 34025: Make more controlled fields linkable (130, 240, 730 + 7XX $a + $t) [XSLT]
Bug 34025: Make more controlled fields linkable (130, 240, 730 + 7XX $a + $t) [XSLT]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Bug 34025: Make more controlled fields linkable (130, 240, 730 + 7XX $a + $t) [XSLT]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Bug 34025: (follow-up) Fix subfield $t handling for 7XX contained works

Description Bernard 2023-06-15 15:57:46 UTC
Created attachment 152389 [details]
code to be cloned

Please could we add the part of the code that appears in the author (7XX) stanza which relates to the $9 link to its authority file to the Uniform title fields stanza (130/730) of the same file - MARC21slim2OPACDetail.xsl 

At present, the customer cannot link to their authority file in this way, even if they configure it in the cataloguing framework.
Comment 1 Martin Renvoize (ashimema) 2023-09-28 09:19:13 UTC
Lets work on this together when you get a moment Bernard, I'll help get a patch submitted but will need your input on the XSLT (and probably zebra/elastic config).. I'm sure between us we can get this submitted up.
Comment 2 Janusz Kaczmarek 2025-04-03 09:30:19 UTC
Created attachment 180475 [details] [review]
Bug 34025: Make more controlled fields linkable (130, 240, 730 + 7XX $a + $t) [XSLT]

MARC21 contain linking fields (130, 240, 730 + 7XX $a + $t) that currently
currently are not 'clickable'. This patch adds the links, similarly to the links
created for contributors', both in OPAC and staff interface.

Test plan:
==========
1. Add some 130, 240, 730 + 7XX $a + $t fields to a record. Note that 730
   and 7XX $a + $t fields have to have 2nd indicator set to 2.
   You can link the fields to authority records.
2. Not that the information displayed from these fields is not
   'clickable' neither in OPAC, nor in the staff interface.
3. Apply the patch ; restart all.
4. You should be able to see and use the links now. If the fields are
   linked to authotiry record and UseAuthoritiesForTracings
   systempreference is set, the search will be performed with
   authid identifier. There should be also a magnifying glass icon
   with a link to the authority record.
Comment 3 Roman Dolny 2025-04-04 20:41:01 UTC
Created attachment 180681 [details] [review]
Bug 34025: Make more controlled fields linkable (130, 240, 730 + 7XX $a + $t) [XSLT]

MARC21 contain linking fields (130, 240, 730 + 7XX $a + $t) that currently
currently are not 'clickable'. This patch adds the links, similarly to the links
created for contributors', both in OPAC and staff interface.

Test plan:
==========
1. Add some 130, 240, 730 + 7XX $a + $t fields to a record. Note that 730
   and 7XX $a + $t fields have to have 2nd indicator set to 2.
   You can link the fields to authority records.
2. Not that the information displayed from these fields is not
   'clickable' neither in OPAC, nor in the staff interface.
3. Apply the patch ; restart all.
4. You should be able to see and use the links now. If the fields are
   linked to authotiry record and UseAuthoritiesForTracings
   systempreference is set, the search will be performed with
   authid identifier. There should be also a magnifying glass icon
   with a link to the authority record.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 4 Bernard 2025-07-02 13:37:28 UTC
Created attachment 183702 [details] [review]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Comment 5 Janusz Kaczmarek 2025-07-02 13:49:35 UTC
Created attachment 183703 [details] [review]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content
Comment 6 Janusz Kaczmarek 2025-07-02 13:51:35 UTC
Created attachment 183704 [details] [review]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content

Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>
Comment 7 Bernard 2025-07-03 16:11:36 UTC
Works as described
Comment 8 Lucas Gass (lukeg) 2025-07-11 21:16:34 UTC
I see this was signed off. Bernard, if you Passed QA here can you attach a patch back with your sign-off?
Comment 9 Bernard 2025-07-16 13:52:21 UTC
Created attachment 184151 [details] [review]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content

Test plan:
==========
1. Add some 130, 240, 730 + 7XX $a + $t fields to a record. Note that 730
   and 7XX $a + $t fields have to have 2nd indicator set to 2.
   You can link the fields to authority records. Ensure that one of the fields is not linkable to an authority record and leave it unlinked.
2. Note that the information displayed from these fields is not
   'clickable' neither in OPAC, nor in the staff interface.
3. Apply the patch ; restart all.
4. You should be able to see and use the links now. If the fields are
   linked to authotiry record and UseAuthoritiesForTracings
   systempreference is set, the search will be performed with
   authid identifier. There should be also a magnifying glass icon
   with a link to the authority record.
5. The links for any unlinked authority should now point to ti,phr - eg /cgi-bin/koha/catalogue/search.pl?q=ti,phr:%22Uniform%20Bernard%22 instead of au
6. Click that link and ensure it finds at least one record (the one you started with)
Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Comment 10 Martin Renvoize (ashimema) 2025-08-27 15:05:18 UTC
Created attachment 185830 [details] [review]
Bug 34025: Make more controlled fields linkable (130, 240, 730 + 7XX $a + $t) [XSLT]

MARC21 contain linking fields (130, 240, 730 + 7XX $a + $t) that currently
currently are not 'clickable'. This patch adds the links, similarly to the links
created for contributors', both in OPAC and staff interface.

Test plan:
==========
1. Add some 130, 240, 730 + 7XX $a + $t fields to a record. Note that 730
   and 7XX $a + $t fields have to have 2nd indicator set to 2.
   You can link the fields to authority records.
2. Not that the information displayed from these fields is not
   'clickable' neither in OPAC, nor in the staff interface.
3. Apply the patch ; restart all.
4. You should be able to see and use the links now. If the fields are
   linked to authotiry record and UseAuthoritiesForTracings
   systempreference is set, the search will be performed with
   authid identifier. There should be also a magnifying glass icon
   with a link to the authority record.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 11 Martin Renvoize (ashimema) 2025-08-27 15:05:20 UTC
Created attachment 185831 [details] [review]
Bug 34025: Changing default link search from au to ti,phr for X30 fields as they are are title type ones. These apply if there is no authorised term linked to for the content

Test plan:
==========
1. Add some 130, 240, 730 + 7XX $a + $t fields to a record. Note that 730
   and 7XX $a + $t fields have to have 2nd indicator set to 2.
   You can link the fields to authority records. Ensure that one of the fields is not linkable to an authority record and leave it unlinked.
2. Note that the information displayed from these fields is not
   'clickable' neither in OPAC, nor in the staff interface.
3. Apply the patch ; restart all.
4. You should be able to see and use the links now. If the fields are
   linked to authotiry record and UseAuthoritiesForTracings
   systempreference is set, the search will be performed with
   authid identifier. There should be also a magnifying glass icon
   with a link to the authority record.
5. The links for any unlinked authority should now point to ti,phr - eg /cgi-bin/koha/catalogue/search.pl?q=ti,phr:%22Uniform%20Bernard%22 instead of au
6. Click that link and ensure it finds at least one record (the one you started with)

Signed-off-by: Bernard Scaife <bernard.scaife@openfifth.co.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 12 Martin Renvoize (ashimema) 2025-08-27 15:05:23 UTC
Created attachment 185832 [details] [review]
Bug 34025: (follow-up) Fix subfield $t handling for 7XX contained works

When 7XX fields contain both name ($a) and title ($t) subfields,
the link should search for the title rather than the name.
This is important for contained works that reference titles
within larger works.

This patch updates both intranet and OPAC XSLT files to check
for the presence of subfield $t and use title search (ti,phr:)
instead of author search (au:) when $t is present.

Test plan:
1. Find or create a bibliographic record with 7XX fields containing both $a (name) and $t (title) subfields
   - For example: 700 $a Smith, John $t The Great Adventure
2. View the record detail page in both staff interface and OPAC
3. In the "Contained works" section, click on the link for the 7XX field entry
4. Verify the search is performed as a title search (ti,phr:"The Great Adventure") rather than author search (au:"Smith, John")
5. Confirm the search results show records matching the title from subfield $t
6. Test with records that have 7XX fields with only $a subfields to ensure they still search by author
7. Repeat testing for different 7XX field types (700, 710, 711)
Comment 13 Bernard 2025-08-28 12:08:54 UTC
Test plan works in all scenarios except for the 130 or 730 (with indicator 2) fields. Same issue in both intranet and opac.

The X30 is rendered as a hyperlink but there is no content embedded in the link to search:

http://127.0.0.1:81/cgi-bin/koha/catalogue/search.pl?q=ti,phr:%22%22