@@ -, +, @@
---
admin/preferences.pl | 11 +++++++++--
koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js | 5 ++++-
.../intranet-tmpl/prog/en/modules/admin/preferences.tt | 12 ++++++++++++
svc/config/systempreferences | 2 +-
4 files changed, 26 insertions(+), 4 deletions(-)
--- a/admin/preferences.pl
+++ a/admin/preferences.pl
@@ -17,8 +17,7 @@
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI;
use C4::Auth;
@@ -104,6 +103,14 @@ sub _get_chunk {
map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } }
keys %{ $options{'choices'} }
];
+ } elsif ( $options{'multiple'} ) {
+ my @values = split /\|/, $value;
+ $chunk->{type} = 'multiple';
+ $chunk->{CHOICES} = [
+ sort { $a->{'text'} cmp $b->{'text'} }
+ map { { text => $options{multiple}->{$_}, value => $_, selected => ( $_ ~~ @values ) } }
+ keys %{ $options{multiple} }
+ ];
}
$chunk->{ 'type_' . $chunk->{'type'} } = 1;
--- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js
+++ a/koha-tmpl/intranet-tmpl/prog/en/js/pages/preferences.js
@@ -11,6 +11,9 @@ KOHA.Preferences = {
Save: function ( form ) {
modified_prefs = $( form ).find( '.modified' );
data = modified_prefs.serialize();
+ if ( data.length == 0 && $(modified_prefs).attr('multiple') ) {
+ data = $(modified_prefs).attr('name') + "=";
+ }
if ( !data ) {
humanMsg.displayAlert( MSG_NOTHING_TO_SAVE );
return;
@@ -44,7 +47,7 @@ $( document ).ready( function () {
$( this.form ).find( '.save-all' ).removeAttr( 'disabled' );
$( this ).addClass( 'modified' );
var name_cell = $( this ).parents( '.name-row' ).find( '.name-cell' );
- if ( !name_cell.find( '.modified-warning' ).length )
+ if ( !name_cell.find( '.modified-warning' ).length )
name_cell.append( '('+MSG_MODIFIED+')' );
KOHA.Preferences.Modified = true;
}
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
@@ -105,6 +105,18 @@
[% END %]
+ [% ELSIF ( CHUNK.type_multiple ) %]
+
[% ELSIF ( CHUNK.type_textarea ) %]
Click to Edit
--- a/svc/config/systempreferences
+++ a/svc/config/systempreferences
@@ -96,7 +96,7 @@ sub set_preferences {
next if ( !defined( $pref ) );
- my $value = join( ',', $query->param( $param ) );
+ my $value = join( '|', $query->param( $param ) );
C4::Context->set_preference( $pref, $value );
logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value );
--