Bugzilla – Attachment 107886 Details for
Bug 25826
Hiding biblionumber in the frameworks breaks links in result list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25826: Forbid changing the hidden attributes for biblionumber
Bug-25826-Forbid-changing-the-hidden-attributes-fo.patch (text/plain), 5.79 KB, created by
Nick Clemens (kidclamp)
on 2020-08-06 12:41:27 UTC
(
hide
)
Description:
Bug 25826: Forbid changing the hidden attributes for biblionumber
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-08-06 12:41:27 UTC
Size:
5.79 KB
patch
obsolete
>From c5fbcf4aef16fc2a339c000a8223812ee066f131 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 27 Jul 2020 12:18:36 -0300 >Subject: [PATCH] Bug 25826: Forbid changing the hidden attributes for > biblionumber > >This patch tweaks the UI so it forbids changing the hidden values when >they are correct (i.e. when they are not hidden in OPAC and intranet). > >To test: >1. Apply the first patch >2. Play with the hidden values of the subfield you have mapped to > biblio.biblionumber in your picked framework. This is usually 999$c > in MARC21, and 001 in UNIMARC. >=> SUCCESS: When you verify the about.pl, it mentions issues when you >hide in some of the interfaces >3. Apply this patch and reload everything >4. Repeat 2 >=> SUCCESS: If your framework is 'ok', it prevents you from editing this >values, otherwise you can change them. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > admin/marc_subfields_structure.pl | 28 ++++++++++++++++++++++ > .../en/modules/admin/marc_subfields_structure.tt | 2 +- > .../prog/js/marc_subfields_structure.js | 18 +++++++++++--- > 3 files changed, 44 insertions(+), 4 deletions(-) > >diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl >index 0dce186c6f..c02633a940 100755 >--- a/admin/marc_subfields_structure.pl >+++ b/admin/marc_subfields_structure.pl >@@ -25,6 +25,7 @@ use C4::Context; > > use Koha::Authority::Types; > use Koha::AuthorisedValueCategories; >+use Koha::Filter::MARC::ViewPolicy; > > use List::MoreUtils qw( uniq ); > >@@ -192,6 +193,33 @@ if ( $op eq 'add_form' ) { > $row_data{isurl} = $data->{isurl}; > $row_data{row} = $i; > $row_data{link} = $data->{'link'}; >+ >+ if ( defined $data->{kohafield} >+ and $data->{kohafield} eq 'biblio.biblionumber' ) >+ { >+ my $hidden_opac = Koha::Filter::MARC::ViewPolicy->should_hide_marc( >+ { >+ frameworkcode => $frameworkcode, >+ interface => "opac", >+ } >+ )->{biblionumber}; >+ >+ my $hidden_intranet = Koha::Filter::MARC::ViewPolicy->should_hide_marc( >+ { >+ frameworkcode => $frameworkcode, >+ interface => "intranet", >+ } >+ )->{biblionumber}; >+ >+ if ( $hidden_opac or $hidden_intranet ) { >+ # We should allow editing for fixing it >+ $row_data{hidden_protected} = 0; >+ } >+ else { >+ $row_data{hidden_protected} = 1; >+ } >+ } >+ > push( @loop_data, \%row_data ); > $i++; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >index 7736f1f248..81815e7803 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >@@ -129,7 +129,7 @@ > <ol><li><label for="defaultvalue[% loo.row | html %]">Default value:</label> > <input type="text" name="defaultvalue" id="defaultvalue[% loo.row | html %]" value="[% loo.defaultvalue | html %]" /></li> > <li><label for="maxlength[% loo.row | html %]">Max length:</label><input type="text" id="maxlength[% loo.row | html %]" name="maxlength" value="[% loo.maxlength | html %]" size="4" /></li> >- <li><input type="hidden" id="hidden-[% loo.row | html %]" name="hidden" value="[% loo.hidden | html %]" /> >+ <li><input type="hidden" id="hidden-[% loo.row | html %]" name="hidden" value="[% loo.hidden | html %]" [%- IF loo.hidden_protected -%]data-koha-protected="1"[%- END -%] /> > <label for="hidden[% loo.row | html %]" style="float: none;">Visibility: </label> > <input type="checkbox" id="hidden_opac_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_opac_[% loo.row | html %]"/> > <label for="hidden_opac_[% loo.row | html %]" style="float: none;">OPAC</label> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >index aa90be610a..081afd2484 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >@@ -70,7 +70,10 @@ function setHiddenValue() { > hidden_value='8'; > } > >- enable_cb(tab); >+ var hidden_protected = $('#hidden-'+ tab).attr('data-koha-protected'); >+ if ( hidden_protected != 1 ) { >+ enable_cb(tab); >+ } > > $('#hidden-' + tab).val(hidden_value); > >@@ -79,6 +82,7 @@ function setHiddenValue() { > function populateHiddenCheckboxes(tab) { > // read the serialized value > var hidden_value = $('#hidden-' + tab).val(); >+ var hidden_protected = $('#hidden-'+ tab).attr('data-koha-protected'); > // deafult to false > var opac_checked = false; > var intranet_checked = false; >@@ -143,6 +147,14 @@ function populateHiddenCheckboxes(tab) { > $("#hidden_collapsed_" + tab).prop('checked',collapsed_checked); > $("#hidden_flagged_" + tab).prop('checked',flagged_checked); > >- enable_cb(tab); >- >+ if ( hidden_protected == 1 ) { >+ $("#hidden_opac_" + tab).prop('disabled','disabled'); >+ $("#hidden_intranet_" + tab).prop('disabled','disabled'); >+ $("#hidden_editor_" + tab).prop('disabled','disabled'); >+ $("#hidden_collapsed_" + tab).prop('disabled','disabled'); >+ $("#hidden_flagged_" + tab).prop('disabled','disabled'); >+ } >+ else { >+ enable_cb(tab); >+ } > } >-- >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 25826
:
107179
|
107437
|
107438
|
107885
| 107886 |
107887
|
107982
|
114868
|
114869
|
114870
|
114871