From 646ce699e4ffa20a5a366814e11e6ad734bb0272 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..392171c 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; 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 Koha.Preference('marcflavour')=='UNIMARC'){ + $sortfield = 'publicationyear'; + } if ( $shelf->can_be_managed( $loggedinuser ) ) { $shelf->shelfname( scalar $query->param('shelfname') ); $shelf->sortfield( $sortfield ); -- 2.43.0