Bug 41685

Summary: MARC21: Sort 4xx/5xx in BuildSummary alphabetic within hierarchy ($w: g or h)
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: MARC Authority data supportAssignee: Marcel de Rooy <m.de.rooy>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: j.de.meester
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 46185: Sort see from / see also in BuildSummary
Bug 41685: Sort seefrom/seealso in BuildSummary
Bug 41685: Unit tests

Description Marcel de Rooy 2026-01-22 13:17:24 UTC
Currently, the list of seefrom/seealso is sorted in the order of the MARC fields. We would like to sort the Broader terms first and the Narrower terms last, with other terms in the middle. All groups should be sorted alphabetically on $a.

This summary is mainly used in the authority search results on OPAC and intranet.
Comment 1 Marcel de Rooy 2026-01-28 13:01:05 UTC
Created attachment 192118 [details] [review]
Bug 46185: Sort see from / see also in BuildSummary

Test plan:
Comes very soon.
Comment 2 Marcel de Rooy 2026-02-02 11:04:51 UTC
Comment on attachment 192118 [details] [review]
Bug 46185: Sort see from / see also in BuildSummary

Wrong bug number
Comment 3 Marcel de Rooy 2026-02-02 13:51:06 UTC
Created attachment 192318 [details] [review]
Bug 41685: Sort seefrom/seealso in BuildSummary

Test plan (MARC21):
[1] Create an authority record, say a term. Include two 450s, the first
    one starting with Z and second with A. Include five 550s, where two
    are narrower ($w==h), two broader ($w==g) and one without $w. Make
    sure that the terms will sort differently than the field order (go
    back in alphabet when filling subsequent $a's or so).
[2] Perform an authority search that includes the new authority.
[3] Verify that the terms in the Summary column for this authority
    are sorted first on hierarchy, second alphabetically. The one
    without hierarchy should be in the middle.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2026-02-02 13:51:07 UTC
Created attachment 192319 [details] [review]
Bug 41685: Unit tests

Test plan:
Run t/db_dependent/AuthoritiesMarc.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>