From 1a98b003f40946684404e8e70c60b0314bf98dd5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 30 Apr 2021 13:25:42 +0100 Subject: [PATCH] Bug 27565: Add sorting to search_by_koha_field This patch adds sorting by 'category', 'lib' and finally 'lib_opac' as found in other AV search methods. Test plan 1 --- Koha/AuthorisedValues.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Koha/AuthorisedValues.pm b/Koha/AuthorisedValues.pm index b23190da72..b352bd3289 100644 --- a/Koha/AuthorisedValues.pm +++ b/Koha/AuthorisedValues.pm @@ -65,11 +65,14 @@ sub search_by_koha_field { return unless $kohafield; return $self->SUPER::search( - { 'marc_subfield_structures.frameworkcode' => $frameworkcode, + { + 'marc_subfield_structures.frameworkcode' => $frameworkcode, 'marc_subfield_structures.kohafield' => $kohafield, - ( defined $category ? ( category_name => $category ) : () ), + ( defined $category ? ( category_name => $category ) : () ), }, - { join => { category => 'marc_subfield_structures' }, + { + join => { category => 'marc_subfield_structures' }, + order_by => [ 'category', 'lib', 'lib_opac' ], distinct => 1, } ); -- 2.20.1