From 8894d28779b723410aeac3e947c7f5ebb814eb60 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 24 Jun 2008 17:12:23 -0500 Subject: [PATCH] bug 2206: always have $9 for headings fields If a field can be linked to an authority record (i.e., an authtypecode is defined for subfield $a), always include the subfield $9 in a (readonly) input element even if it is marked hidden per the MARC framework. Prior to this patch, a $9 marked hidden per the framework would not be included in the form, causing the authority record number link to not be added when choosing a heading from the authority finder. In other words, with BiblioAddsAuthorities OFF, any authorized headings in bibs added via the MARC editor would not have the subfield $9, and thus would appear to not be used by any bibs. Note that subfield $9 is set to be readonly, as changing the authority number link does not currently change the heading stored in the bib record. Signed-off-by: Joshua Ferraro --- cataloguing/addbiblio.pl | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 6b44cf767e..441fdf9540 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -339,6 +339,25 @@ sub create_input { build_authorized_values_list( $tag, $subfield, $value, $dbh, $authorised_values_sth,$index_tag,$index_subfield ); + # it's a subfield $9 linking to an authority record - see bug 2206 + } + elsif ($subfield eq "9" and + exists($tagslib->{$tag}->{'a'}->{authtypecode}) and + defined($tagslib->{$tag}->{'a'}->{authtypecode}) and + $tagslib->{$tag}->{'a'}->{authtypecode} ne '') { + + $subfield_data{marc_value} = + ""; + # it's a thesaurus / authority field } elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { @@ -602,8 +621,15 @@ sub build_tabs ($$$$$) { next if ( $tag < 10 ); next if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 ) - or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) - ); #check for visibility flag + or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) ) + and not ( $subfield eq "9" and + exists($tagslib->{$tag}->{'a'}->{authtypecode}) and + defined($tagslib->{$tag}->{'a'}->{authtypecode}) and + $tagslib->{$tag}->{'a'}->{authtypecode} ne "" + ) + ; #check for visibility flag + # if subfield is $9 in a field whose $a is authority-controlled, + # always include in the form regardless of the hidden setting - bug 2206 next if ( defined( $field->subfield($subfield) ) ); push( @subfields_data, @@ -644,7 +670,14 @@ sub build_tabs ($$$$$) { next if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -5 ) or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 4 ) ) + and not ( $subfield eq "9" and + exists($tagslib->{$tag}->{'a'}->{authtypecode}) and + defined($tagslib->{$tag}->{'a'}->{authtypecode}) and + $tagslib->{$tag}->{'a'}->{authtypecode} ne "" + ) ; #check for visibility flag + # if subfield is $9 in a field whose $a is authority-controlled, + # always include in the form regardless of the hidden setting - bug 2206 next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); push( -- 2.39.5