diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index eb18cc3a0f..94b971f063 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -164,14 +164,6 @@ sub generate_subfield_form {
$value = $input->param('barcode');
}
- # Getting list of subfields to keep when restricted editing is enabled
- my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing');
- my $allowAllSubfields = (
- not defined $subfieldsToAllowForRestrictedEditing
- or $subfieldsToAllowForRestrictedEditing == q||
- ) ? 1 : 0;
- my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEditing);
-
if ( $subfieldlib->{authorised_value} ) {
my @authorised_values;
my %authorised_lib;
@@ -241,13 +233,6 @@ sub generate_subfield_form {
labels => \%authorised_lib,
default => $value,
};
- # If we're on restricted editing, and our field is not in the list of subfields to allow,
- # then it is read-only
- $subfield_data{marc_value}->{readonlyselect} = (
- not $allowAllSubfields
- and $restrictededition
- and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow
- ) ? 1: 0;
}
}
# it's a thesaurus / authority field
@@ -333,7 +318,23 @@ sub generate_subfield_form {
value => $value,
};
}
-
+
+ # Getting list of subfields to keep when restricted editing is enabled
+ my $subfieldsToAllowForRestrictedEditing = C4::Context->preference('SubfieldsToAllowForRestrictedEditing');
+ my $allowAllSubfields = (
+ not defined $subfieldsToAllowForRestrictedEditing
+ or $subfieldsToAllowForRestrictedEditing == q||
+ ) ? 1 : 0;
+ my @subfieldsToAllow = split(/ /, $subfieldsToAllowForRestrictedEditing);
+
+ # If we're on restricted editing, and our field is not in the list of subfields to allow,
+ # then it is read-only
+ $subfield_data{marc_value}->{readonly} = (
+ not $allowAllSubfields
+ and $restrictededition
+ and !grep { $tag . '$' . $subfieldtag eq $_ } @subfieldsToAllow
+ ) ? 1: 0;
+
return \%subfield_data;
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
index 26ecf45d14..65f3101c50 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
@@ -266,7 +266,7 @@ function confirm_deletion() {
[% IF ( mv.type == 'hidden' ) %]
[% ELSIF ( mv.type == 'select' ) %]
- [% IF ( mv.readonlyselect ) %]
+ [% IF ( mv.readonly ) %]