From dfa0b3da252ea301702a970bbe86fc1fe46e620d Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 6 Sep 2017 13:44:41 +0200 Subject: [PATCH] Bug 19261: Never hide biblionumber field in view policy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followed test plan and biblionumber subfield 999c is visible in OPAC irrespective of visibility now. Patch applies and works as expected. Test plan: 0a) Use koha-testing-docker 0b) Do not apply patch 1) Hide 999$c in "Books, Booklets, Workbooks" framework 2) Search for "local-number:29 or local-number:30) 3) Note the search results include links like the following: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=&searchid=scs_1595477248050 http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=&searchid=scs_1595477248050 4) Apply the patch 5) restart_all 6) Search for "local-number:29 or local-number:30) 7) Note the search results include links like the following: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29&searchid=scs_1595477625746 http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=30&searchid=scs_1595477625746 Signed-off-by: Dilan Johnpullé Signed-off-by: Kyle M Hall Signed-off-by: David Cook Signed-off-by: Katrin Fischer --- Koha/Filter/MARC/ViewPolicy.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Filter/MARC/ViewPolicy.pm b/Koha/Filter/MARC/ViewPolicy.pm index a963e3f129..3d12fab9eb 100644 --- a/Koha/Filter/MARC/ViewPolicy.pm +++ b/Koha/Filter/MARC/ViewPolicy.pm @@ -127,7 +127,8 @@ sub _filter_field { my $visibility = $marcsubfieldstructure->{$tag}->{$subtag}->{hidden}; $visibility //= 0; - if ( $hide->{$interface}->{$visibility} ) { + my $kohafield = $marcsubfieldstructure->{$tag}->{$subtag}->{kohafield} // ''; + if ( $hide->{$interface}->{$visibility} && $kohafield ne 'biblio.biblionumber' ) { # deleting last subfield doesn't delete field, so # this detects that case to delete the field. @@ -147,7 +148,8 @@ sub _filter_field { # -8 is flagged, and 9/-9 are not implemented. my $visibility = $marcsubfieldstructure->{$tag}->{q{@}}->{hidden}; $visibility //= 0; - if ( $hide->{$interface}->{$visibility} ) { + my $kohafield = $marcsubfieldstructure->{$tag}->{q{@}}->{kohafield} // ''; + if ( $hide->{$interface}->{$visibility} && $kohafield ne 'biblio.biblionumber' ) { $result->delete_fields($field); } -- 2.11.0