From 7e222bb0796196f1e466b73d909fd28d529cab75 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 15 Jun 2017 12:30:27 +0200 Subject: [PATCH] Bug 18811: Change visibility checks in authorities.pl The check is now <=-4 or >=5, but the framework uses 0 for Show all and -5 for Hide all. (Note that sql installer scripts also use 8.) When modifying an authority, the script also showed hidden fields when filled, since it did not check the hidden field but only the tab field. NOTE: The proposed solution restores consistency, but will remove hidden fields from the MARC record. Test plan: [1] Set field 942a to Show all in an authority framework. [2] Open a new record in this framework and verify that you see 942a. [3] Edit an existing record in this framework and verify again. [4] Set field 942a now to Hide all in this framework. [5] Open a new record in this framework and verify that 942a is hidden. [6] Edit an existing record in this framework and verify again. Signed-off-by: Marcel de Rooy Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- authorities/authorities.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index e45f5dd902..5935b07195 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -404,6 +404,7 @@ sub build_tabs { $subfield = '@'; } next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); + next if $tagslib->{$tag}->{$subfield}->{hidden}; push( @subfields_data, &create_input( @@ -419,6 +420,7 @@ sub build_tabs { my $value = $subfields[$subfieldcount][1]; next if ( length $subfield != 1 ); next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); + next if $tagslib->{$tag}->{$subfield}->{hidden}; push( @subfields_data, &create_input( @@ -435,10 +437,7 @@ sub build_tabs { next if ( length $subfield != 1 ); next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); next if ( $tag < 10 ); - next - if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 ) - or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) - ); #check for visibility flag + next if $tagslib->{$tag}->{$subfield}->{hidden}; next if ( defined( $field->subfield($subfield) ) ); push( @subfields_data, @@ -477,9 +476,7 @@ sub build_tabs { my @subfields_data; foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) ) { next if ( length $subfield != 1 ); - next if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -5 ) - or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 4 ) ) - ; #check for visibility flag + next if $tagslib->{$tag}->{$subfield}->{hidden}; next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); push( @subfields_data, -- 2.39.5