From 8c92b9ada4d8c11d242bafad3429d1e7e2149f89 Mon Sep 17 00:00:00 2001 From: Johanna Raisa Date: Tue, 22 Mar 2022 11:11:22 +0200 Subject: [PATCH] Bug 30327: Sort component parts This patch adds ascending sorting by biblionumber to component parts. Test plan: 1) Enable ShowComponentRecords on systempreference 2) Go to detail page of a record which has component parts 3) See that the component parts are in random order 4) Apply the patch 5) Reload the detail page 6) Now the component parts should be in ascending biblionumber order Sponsored-by: Koha-Suomi Oy --- Koha/Biblio.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 4022819e9c..5e3d372edb 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -547,7 +547,7 @@ sub get_marc_components { } ); } - $components = $results if defined($results) && @$results; + @$components = sort { $searcher->extract_biblionumber($a) <=> $searcher->extract_biblionumber($b) } @$results if defined($results) && @$results; } return $components // []; -- 2.25.1