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.
---
 cataloguing/addbiblio.pl |   37 +++++++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index 6b44cf7..441fdf9 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} =
+            "<input type=\"text\"
+                    id=\"".$subfield_data{id}."\"
+                    name=\"".$subfield_data{id}."\"
+                    value=\"$value\"
+                    class=\"input_marceditor\"
+                    tabindex=\"1\"
+                    size=\"5\"
+                    maxlength=\"255\" 
+                    readonly=\"readonly\"
+                    \/>";
+
     # 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(
-- 
1.5.5.GIT

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to