@@ -, +, @@ them --- admin/preferences.pl | 27 +++++++++++++++++-- circ/circulation.pl | 2 +- .../data/mysql/atomicupdate/bug_27652.perl | 11 ++++++++ .../prog/en/includes/circ-menu.inc | 2 +- .../en/modules/admin/preferences/admin.pref | 1 + .../admin/preferences/circulation.pref | 6 +++-- .../en/modules/admin/preferences/opac.pref | 2 +- opac/opac-reserve.pl | 2 +- 8 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_27652.perl --- a/admin/preferences.pl +++ a/admin/preferences.pl @@ -92,6 +92,7 @@ sub _get_chunk { $chunk->{'languages'} = getTranslatedLanguages( $interface, $theme, undef, $current_languages ); $chunk->{'type'} = 'languages'; } elsif ( $options{ 'choices' } ) { + my $add_blank; if ( $options{'choices'} && ref( $options{ 'choices' } ) eq '' ) { if ( $options{'choices'} eq 'class-sources' ) { my $sources = GetClassSources(); @@ -100,6 +101,9 @@ sub _get_chunk { $options{'choices'} = { map { $_ => $_ } getallthemes( 'opac' ) } } elsif ( $options{'choices'} eq 'staff-templates' ) { $options{'choices'} = { map { $_ => $_ } getallthemes( 'intranet' ) } + } elsif ( $options{choices} eq 'patron-categories' ) { + $options{choices} = { map { $_->categorycode => $_->description } Koha::Patron::Categories->search }; + $add_blank = 1; } else { die 'Unrecognized source of preference values: ' . $options{'choices'}; } @@ -107,12 +111,31 @@ sub _get_chunk { $value ||= 0; - $chunk->{'type'} = 'select'; + $chunk->{'type'} = ( $options{class} && $options{class} eq 'multiple' ) ? 'multiple' : 'select'; + + my @values; + @values = split /,/, $value if defined($value); $chunk->{'CHOICES'} = [ sort { $a->{'text'} cmp $b->{'text'} } - map { { text => $options{'choices'}->{$_}, value => $_, selected => ( $_ eq $value || ( $_ eq '' && ( $value eq '0' || !$value ) ) ) } } + map { + my $c = $_; + { + text => $options{'choices'}->{$c}, + value => $c, + selected => ( + grep { $_ eq $c || ( $c eq '' && ($value eq '0' || !$value ) ) } @values + ) ? 1 : 0, + } + } keys %{ $options{'choices'} } ]; + + # Add a first blank value if needed + unshift @{ $chunk->{CHOICES} }, { + text => '', + value => '', + } if $add_blank && $chunk->{type} eq 'select'; + } elsif ( $options{'multiple'} ) { my @values; @values = split /,/, $value if defined($value); --- a/circ/circulation.pl +++ a/circ/circulation.pl @@ -116,7 +116,7 @@ my $batch = $query->param('batch'); my $batch_allowed = 0; if ( $batch && C4::Context->preference('BatchCheckouts') ) { $template_name = q|circ/circulation_batch_checkouts.tt|; - my @batch_category_codes = split '\|', C4::Context->preference('BatchCheckoutsValidCategories'); + my @batch_category_codes = split ',', C4::Context->preference('BatchCheckoutsValidCategories'); my $categorycode = $patron->categorycode; if ( $categorycode && grep { $_ eq $categorycode } @batch_category_codes ) { $batch_allowed = 1; --- a/installer/data/mysql/atomicupdate/bug_27652.perl +++ a/installer/data/mysql/atomicupdate/bug_27652.perl @@ -0,0 +1,11 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + $dbh->do(q{ + UPDATE systempreferences + value=REPLACE(value, '|', ',') + WHERE variable="OPACHoldsIfAvailableAtPickupExceptions" + OR variable="BatchCheckoutsValidCategories" + }); + NewVersion( $DBversion, 27652, "Separate values for OPACHoldsIfAvailableAtPickupExceptions and BatchCheckoutsValidCategories with comma"); +} --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -125,7 +125,7 @@