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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7e222bb079)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2017-06-15 12:30:27 +02:00 committed by Fridolin Somers
parent d8e09eaec4
commit ae29acfb26
1 changed files with 4 additions and 7 deletions

View File

@ -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,