From 6e1688e5b046da5e71dcd59d9f1754b63eaeee2c 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 --- 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 63f495c7714..66f72089981 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 f18de5130e3..801b3a1f82b 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 ) %] + [% 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 14122b4b6aa..0dd9f4077c6 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 e5babfd0d6f..bd5bc10b82c 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 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 7b86e36e8fb..023392e87f4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -949,7 +949,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.34.1