From 10ca4392b443088a3464241a1a5a35255fec4a1d Mon Sep 17 00:00:00 2001
From: Lucas Gass <lucas@bywatersolutions.com>
Date: Fri, 7 Jul 2023 19:31:15 +0000
Subject: [PATCH] Bug 34232: Make dropdown on additem page rescept display
order
To test:
1. EnableItemGroups
2. Find a record and add some new item groups with different display orders
3. Now edit an item on the record and scroll down to the dropdown underneath "+ Add to item group"
4. Notice that the values in the dropdown do not respect the display order.
5. Apply patch and restart_all
6. The display order should now be respected
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
---
cataloguing/additem.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index 2c9871280c..4d7b00b4b0 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -752,11 +752,13 @@ if( my $default_location = C4::Context->preference('NewItemsDefaultLocation') )
}
my @ig = Koha::Biblio::ItemGroups->search({ biblio_id => $biblionumber })->as_list();
+#sort by display order
+my @sorted_ig = sort { $a->display_order <=> $b->display_order } @ig;
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
$template->param(
biblio => $biblio,
items => \@items,
- item_groups => \@ig,
+ item_groups => \@sorted_ig,
item_header_loop => \@header_value_loop,
subfields => $subfields,
itemnumber => $itemnumber,
--
2.34.1