Bugzilla – Attachment 67434 Details for
Bug 15173
SubfieldsToAllowForRestrictedEditing not working properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing
Bug-15173-Restore-SubfieldsToAllowForRestrictedEdi.patch (text/plain), 9.64 KB, created by
Julian Maurice
on 2017-09-29 09:19:24 UTC
(
hide
)
Description:
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2017-09-29 09:19:24 UTC
Size:
9.64 KB
patch
obsolete
>From 19d031cef2e95f450d80c313c350ab45afcd3ce4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 16 Aug 2016 15:12:07 +0100 >Subject: [PATCH] Bug 15173: Restore SubfieldsToAllowForRestrictedEditing > >Bug 7673 introduced SubfieldsToAllowForRestrictedEditing but bug 12176 >broke it assuming that only selects were impacted by this feature. > >Test plan: >Go back on bug 7673 and confirm that >SubfieldsToAllowForRestrictedEditing is working as expected with this >patch applied. > >Signed-off-by: Lee Jamison <ldjamison@marywood.edu> >For clarification, the item fields that are entered in >SubfieldsToAllowForRestrictedEditing should EXCLUDE the desired >fields you want to disable. > >Test plan (updated to test the scenario in the bug Description): >1. Create a patron with only the following permissions: > - catalogue (Required for staff login) > - editcatalogue -> edit_catalogue > - editcatalogue -> edit_items > - editcatalogue -> edit_items_restricted >2. Navigate to Administration -> Global system preferences -> Cataloging > -> Record Structure -> SubfieldsToAllowForRestrictedEditing >3. In the input field for SubfieldsToAllowForRestrictedEditing enter in > all the 952 fields EXCEPT the ones desired to be disabled. In this > case, we want to disallow editing of 952$2, 952$a, 952$b, 952$e, 952$h, > and 952$o so we enter the following into the > SubfieldsToAllowForRestrictedEditing (without quotes) "952$0 952$1 > 952$3 952$4 952$5 952$7 952$8 952$c 952$d 952$f 952$g 952$i 952$j > 952$p 952$t 952$u 952$v 952$w 952$x 952$y 952$z" >4. Click Save all Cataloging preferences >5. Login to the staff client as the created restricted editing patron >6. Edit an item >7. Note that all fields except for the ones excluded from the syspref > are editable > >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > cataloguing/additem.pl | 33 +++++++++--------- > .../prog/en/modules/cataloguing/additem.tt | 40 +++++++++++++++------- > 2 files changed, 45 insertions(+), 28 deletions(-) > >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' ) %] > <input type="hidden" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]"> > [% ELSIF ( mv.type == 'select' ) %] >- [% IF ( mv.readonlyselect ) %] >+ [% IF ( mv.readonly ) %] > <select name="field_value" id="[%- mv.id -%]" size="1" class="input_marceditor" readonly="readonly" disabled="disabled"> > [% ELSE %] > <select name="field_value" id="[%- mv.id -%]" size="1" class="input_marceditor"> >@@ -280,21 +280,37 @@ function confirm_deletion() { > [% END %] > </select> > [% ELSIF ( mv.type == 'text_auth' ) %] >- <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> >- [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %] >- <a href="#" class="buttonDot" onclick="[%- dopop -%]; return false;" title="Tag editor">...</a> >+ [% IF mv.readonly %] >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" readonly="readonly" /> >+ [% ELSE %] >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> >+ [% SET dopop = "Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=\"${mv.authtypecode}\"&index=${mv.id}','${mv.id}')" %] >+ <a href="#" class="buttonDot" onclick="[%- dopop -%]; return false;" title="Tag editor">...</a> >+ [% END %] > [% ELSIF ( mv.type == 'text_plugin' ) %] >- <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> >- [% IF ( mv.nopopup ) %] >- <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="No popup">...</a> >- [% ELSE %] >- <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="Tag editor">...</a> >+ [% IF mv.readonly %] >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" readonly="readonly" /> >+ [% ELSE %] >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> >+ [% IF ( mv.nopopup ) %] >+ <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="No popup">...</a> >+ [% ELSE %] >+ <a href="#" id="buttonDot_[%- mv.id -%]" class="[%- mv.class -%]" title="Tag editor">...</a> >+ [% END %] >+ [%- mv.javascript -%] > [% END %] >- [%- mv.javascript -%] > [% ELSIF ( mv.type == 'text' ) %] >- <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> >+ [% IF mv.readonly %] >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" readonly="readonly" /> >+ [% ELSE %] >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> >+ [% END %] > [% ELSIF ( mv.type == 'textarea' ) %] >- <textarea id="[%- mv.id -%]" name="field_value" class="input_marceditor" rows="5" cols="64" >[% mv.value %]</textarea> >+ [% IF mv.readonly %] >+ <textarea id="[%- mv.id -%]" name="field_value" class="input_marceditor" rows="5" cols="64" readonly="readonly" >[% mv.value %]</textarea> >+ [% ELSE %] >+ <textarea id="[%- mv.id -%]" name="field_value" class="input_marceditor" rows="5" cols="64" >[% mv.value %]</textarea> >+ [% END %] > [% END %] > > <input type="hidden" name="tag" value="[% ite.tag %]" /> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15173
:
54511
|
66856
| 67434