From 6f1b00e24d83f79ab74d8f6bd1b33ead3ef9a671 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 14 Mar 2024 10:40:29 +0100 Subject: [PATCH] Bug 29948: Allow to sort info With this patch the different info can be ordered when editing the syspref Sponsored-by: Orex Digital 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 | 17 +++++++++++++++++ .../prog/en/modules/admin/preferences.tt | 14 ++++++++++++++ .../prog/en/modules/admin/preferences/opac.pref | 2 +- .../bootstrap/en/modules/opac-auth-detail.tt | 3 ++- .../bootstrap/en/modules/opac-detail.tt | 3 ++- 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index aba2492c35..8c92ec0020 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -161,8 +161,25 @@ sub _get_chunk { } keys %{ $options{multiple} } ]; + } elsif ( $options{'multiple_sortable'} ) { + my @values; + @values = split /,/, $value if defined($value); + $chunk->{type} = 'multiple_sortable'; + $chunk->{CHOICES} = [ + sort { $a->{'text'} cmp $b->{'text'} } + map { + my $option_value = $_; + { + text => $options{multiple_sortable}->{$option_value}, + value => $option_value, + selected => (grep { $_ eq $option_value } @values) ? 1 : 0, + } + } + keys %{ $options{multiple_sortable} } + ]; } + $chunk->{ 'type_' . $chunk->{'type'} } = 1; return $chunk; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 0321b61679..1df62540f1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -151,6 +151,20 @@ [% END %] + [% ELSIF ( CHUNK.type_multiple_sortable ) %] +
    + [% FOREACH CHOICE IN CHUNK.CHOICES %] +
  • + + + [% IF ( CHOICE.selected ) %] + + [% ELSE %] + + [% END %] +
  • + [% END %] +
[% ELSIF ( CHUNK.type_textarea )%] [% IF ( CHUNK.syntax == "text/html" && Koha.Preference('UseWYSIWYGinSystemPreferences') ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 3212c3456f..5de642f1cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -527,7 +527,7 @@ OPAC: - - "Display the following information for authors and contributors to the detail pages in the OPAC." - pref: OPACAuthorIdentifiersAndInformation - multiple: + multiple_sortable: activity: Activity (372$a$s$t) address: Address (371$a$b$d$e) associated_group: Associated group (373$a$s$t$u$v$0) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt index e5babfd0d6..bd5bc10b82 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt @@ -185,7 +185,8 @@
Identifiers/information
    - [% FOR info IN author_information.keys %] + [% FOR info IN Koha.Preference( 'OPACAuthorIdentifiersAndInformation' ).split(',') %] + [% NEXT IF author_information.keys.grep(info).size <= 0 %] [% PROCESS "authority-information.inc" information => author_information.$info, info_type => info %] [% END %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 3f91b3f2e9..ea4e4fb0b6 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -950,7 +950,8 @@
[% author.name | html %]
    - [% FOR info IN author.information.keys %] + [% FOR info IN Koha.Preference( 'OPACAuthorIdentifiersAndInformation' ).split(',') %] + [% NEXT IF author.information.keys.grep(info).size <= 0 %] [% PROCESS "authority-information.inc" information => author.information.$info, info_type => info %] [% END %]
-- 2.39.5