@@ -, +, @@ the pref is empty --- cataloguing/additem.pl | 10 ++++++++-- .../prog/en/modules/admin/preferences/cataloguing.pref | 2 ++ tools/batchMod.pl | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) --- a/cataloguing/additem.pl +++ a/cataloguing/additem.pl @@ -160,13 +160,18 @@ sub generate_subfield_form { # Getting list of subfields to keep when restricted edition is enabled my $subfieldsToAllowForRestrictedEdition = C4::Context->preference('SubfieldsToAllowForRestrictedEdition'); + my $allowAllSubfields = ( + not defined $subfieldsToAllowForRestrictedEdition + or $subfieldsToAllowForRestrictedEdition == q|| + ) ? 1 : 0; my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEdition); # If we're on restricted edition, and our field is not in the list of subfields to allow, # then it is read-only $attributes_no_value .= 'readonly="readonly" ' if ( - $restrictededition + not $allowAllSubfields + and $restrictededition and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow ); @@ -246,7 +251,8 @@ sub generate_subfield_form { # then it is read-only push @scrparam, (-readonly => "readonly"), (-disabled => "disabled") if ( - $restrictededition + not $allowAllSubfields + and $restrictededition and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow ); $subfield_data{marc_value} =CGI::scrolling_list(@scrparam); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -116,6 +116,7 @@ Cataloging: - 'UNIMARC: "995$f 995$h 995$j"' - 'MARC21: "952$a 952$b 952$c"' - Note that the FA framework is excluded from the permission. + - If the pref is empty, no fields are restricted. - - Define a list of subfields for which edition is authorized when items_batchmod_restricted permission is enabled, separated by spaces. - pref: SubfieldsToAllowForRestrictedBatchmod @@ -123,6 +124,7 @@ Cataloging: - 'UNIMARC: "995$f 995$h 995$j"' - 'MARC21: "952$a 952$b 952$c"' - Note that the FA framework is excluded from the permission. + - If the pref is empty, no fields are restricted. Display: - - 'Separate multiple displayed authors, series or subjects with ' --- a/tools/batchMod.pl +++ a/tools/batchMod.pl @@ -301,13 +301,17 @@ my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); # Getting list of subfields to keep when restricted batchmod edit is enabled my $subfieldsToAllowForBatchmod = C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod'); +my $allowAllSubfields = ( + not defined $subfieldsToAllowForBatchmod + or $subfieldsToAllowForBatchmod == q|| +) ? 1 : 0; my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod); foreach my $tag (sort keys %{$tagslib}) { # loop through each subfield foreach my $subfield (sort keys %{$tagslib->{$tag}}) { next if subfield_is_koha_internal_p($subfield); - next if ($restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow ); + next if (not $allowAllSubfields and $restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow ); next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10"); # barcode and stocknumber are not meant to be batch-modified next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode'; --