From cfcb55329f0e3dd8c3e8fbea45b30f6b445f27ec Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Wed, 3 Jul 2024 12:45:51 +0200 Subject: [PATCH] Bug 37218: Sorting by publication date works unexpectedly in UNIMARC Steps to reproduce: 1 - Open a Koha with syspref "UNIMARC" set 2 - Search for items 3 - Sort by publication date -> there should be no change whatever you do In my previous comment, I had not noticed that this is clearly a bug: the results from search are put in the field "copyrightdate" whatever the MARC flavour so the line checking for marcflavour to pick the sort field is obsolete TEST PLAN: 1 - Open a Koha with syspref "UNIMARC" set 2 - Search for items 3 - Sort by publication date -> there should be no change whatever you do 4 - Apply patch and repeat 2&3 -> items should be changed --- catalogue/itemsearch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index bd25081..b565476 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -239,7 +239,7 @@ if ( defined $format ) { } my $sortby = $cgi->param('sortby') || 'itemnumber'; - if (C4::Context->preference("marcflavour") ne "UNIMARC" && $sortby eq 'publicationyear') { + if ($sortby eq 'publicationyear') { $sortby = 'copyrightdate'; } my $search_params = { -- 2.43.0