From 55739dac40100d74396e923d4d76c64b905e7d57 Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Wed, 31 Jul 2024 14:47:28 +0200 Subject: [PATCH] Bug 37434: Sort by publicationyear when copyrightdate is set in UNIMARC --- virtualshelves/shelves.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index badd78f..5c98023 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -115,6 +115,9 @@ if ( $op eq 'add_form' ) { $op = $referer; my $sortfield = $query->param('sortfield'); $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); + if ($sortfield == 'copyrightdate' and Koha.Preference('marcflavour')=='UNIMARC'){ + $sortfield = 'publicationyear'; + } if ( $shelf->can_be_managed( $loggedinuser ) ) { $shelf->shelfname( scalar $query->param('shelfname') ); $shelf->sortfield( $sortfield ); -- 2.43.0