From 4383cd6d55877d93b9f61aa0ff6ccfb0d4e5d3ee 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index badd78f..40dccb4 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -32,6 +32,7 @@ use C4::Members; use C4::Output qw( pagination_bar output_html_with_http_headers output_and_exit_if_error ); use C4::XSLT qw( XSLTParse4Display ); +use Koha qw (Preference); use Koha::Biblios; use Koha::Biblioitems; use Koha::Items; @@ -115,6 +116,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 Preference('marcflavour')=='UNIMARC'){ + $sortfield = 'publicationyear'; + } if ( $shelf->can_be_managed( $loggedinuser ) ) { $shelf->shelfname( scalar $query->param('shelfname') ); $shelf->sortfield( $sortfield ); -- 2.43.0