Bug Fix 3320 : condition on enabling field input was wrong
[koha.git] / cataloguing / addbiblio.pl
index 89b8e0e..b49b187 100755 (executable)
@@ -373,7 +373,7 @@ sub create_input {
     # it's a thesaurus / authority field
     }
     elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
-               $readonly=(C4::Context->preference("BiblioAddsAuthorities")?qq(readonly="readonly"):"");
+               my $readonly=(C4::Context->preference("BiblioAddsAuthorities")?"":qq(readonly="readonly"));
         $subfield_data{marc_value} =
             "<input type=\"text\"
                     id=\"".$subfield_data{id}."\"
@@ -776,9 +776,21 @@ AND (authtypecode IS NOT NULL AND authtypecode<>\"\")|);
          # FIXME: AddAuthority() instead should simply explicitly require that the MARC::Record
          # use UTF-8, but as of 2008-08-05, did not want to introduce that kind
          # of change to a core API just before the 3.0 release.
-         if (C4::Context->preference('marcflavour') eq 'MARC21') {
-            SetMarcUnicodeFlag($marcrecordauth, 'MARC21');
-         }
+         # 
+         # This isn't needed if we set the UTF flag in the leader below
+               #if (C4::Context->preference('marcflavour') eq 'MARC21') {
+        #    SetMarcUnicodeFlag($marcrecordauth, 'MARC21');
+        # }
+
+                               if (C4::Context->preference('marcflavour') eq 'MARC21') {
+                                       $marcrecordauth->leader('     nz  a22     o  4500');
+                                       $marcrecordauth->insert_fields_ordered(MARC::Field->new('667','','','a'=>"Machine generated authority record."));
+                                       my $cite = $record->author() . ", " .  $record->title_proper() . ", " . $record->publication_date() . " "; 
+                                       $cite =~ s/^[\s\,]*//;
+                                       $cite =~ s/[\s\,]*$//;
+                                       $cite = "Work cat.: (" . C4::Context->preference('MARCOrgCode') . ")". $record->subfield('999','c') . ": " . $cite;
+                                       $marcrecordauth->insert_fields_ordered(MARC::Field->new('670','','','a'=>$cite));
+                               }
 
 #          warn "AUTH RECORD ADDED : ".$marcrecordauth->as_formatted;