From e7088fd06c59f9f576498ee1cab77bf093678772 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 20 Oct 2023 13:23:38 +0200 Subject: [PATCH] Bug 33568: Fix ordering MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use search_ordered for default ordering It also fixes a crash when StaffDetailItemSelection is turned off. Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi Signed-off-by: Katrin Fischer --- Koha/REST/V1/Biblios.pm | 3 +-- .../en/includes/html_helpers/tables/items/catalogue_detail.inc | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index b5a092332a..edb5165314 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -301,10 +301,9 @@ sub get_items { return try { # FIXME We need to order_by serial.publisheddate if we have _order_by=+me.serial_issue_number - # Should we use search_ordered here? Maybe as well in Koha::REST::V1::Items::list? # FIXME Do we always need host_items => 1 or depending on a flag? # FIXME Should we prefetch => ['issue','branchtransfer']? - my $items_rs = $biblio->items( { host_items => 1 } )->search( {}, { join => 'biblioitem' } ) ); + my $items_rs = $biblio->items( { host_items => 1 } )->search_ordered( {}, { join => 'biblioitem' } ); $items_rs = $items_rs->filter_by_bookable if $bookable_only; # FIXME We need to order_by serial.publisheddate if we have _order_by=+me.serial_issue_number my $items = $c->objects->search($items_rs); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 0e077c30fe..4cf9583935 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -275,7 +275,7 @@ }; var items_table = $("#" + tab_id + '_table').kohaTable({ ajax: { url: item_table_url }, - order: [[ 0, "asc" ]], + order: [], embed, autoWidth: false, bKohaColumnsUseNames: true, -- 2.39.5