From 3c503a159500a7e66d9d63c9905a04480b753f71 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 22 Mar 2024 12:46:21 +0100 Subject: [PATCH] Bug 29948: Fix display of selected values The values were correctly inserted but the display was not sorting correctly Signed-off-by: Signed-off-by: Hugo Agud Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- admin/preferences.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 8c92ec0020..d00672b1ae 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -32,7 +32,7 @@ use Koha::Database::Columns; use IO::File; use YAML::XS; use Encode; -use List::MoreUtils qw( any ); +use List::MoreUtils qw( any uniq ); sub GetTab { my ( $input, $tab ) = @_; @@ -165,8 +165,8 @@ sub _get_chunk { my @values; @values = split /,/, $value if defined($value); $chunk->{type} = 'multiple_sortable'; + my @options = sort keys %{ $options{multiple_sortable} }; $chunk->{CHOICES} = [ - sort { $a->{'text'} cmp $b->{'text'} } map { my $option_value = $_; { @@ -175,7 +175,7 @@ sub _get_chunk { selected => (grep { $_ eq $option_value } @values) ? 1 : 0, } } - keys %{ $options{multiple_sortable} } + uniq(@values, @options) ]; } -- 2.39.5