Here is a use case that caused the problem (for historical reference and 
testing for QA)

In admin set sysprefs
 AutoCreateAuthorities - generate
 BiblioAddsAuthorities  - allow
   dontmerge  don't
LinkerModule   Default
LinkerOptions broader_headings

Catalogueing -> Z3950 search 
Subject [Bible.]
Library of Congress[x]

Import the one with:
        1 Corinthians :                 2005            080282577X 
(cloth:alkpaper)     2005052170

Edit koha itemtype books 942c, and 003

Save (  and get software error mentioning indicators)


With the patch, we fixend how the biblio is merged with existing data.

wajasu


>From fa11bb8f88445d43bbd95f5526ba64be1c870a5f Mon Sep 17 00:00:00 2001
From: Jared Camins-Esakov <[email protected]>
Date: Fri, 7 Sep 2012 10:58:53 -0400
Subject: [PATCH] [SIGNED-OFF] Bug 8447: Make sure we have enough subfields
 for broader_headings

Thanks to wajasu for providing the debugging information, as I cannot
seem to duplicate the problem, even seeing where it could come from.

Fix corrects cases where upon save, a software error complaing about
indicators being wrong as a side effect of a poorly autogenerated
biblio/authority record.

Behvior with this fix causes existing bilio data to to be preserved
while linking to the authority via subtag 9.

Signed-off-by: wajasu <[email protected]>
---
 C4/Linker/Default.pm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/C4/Linker/Default.pm b/C4/Linker/Default.pm
index 653dabd..445b408 100644
--- a/C4/Linker/Default.pm
+++ b/C4/Linker/Default.pm
@@ -56,17 +56,16 @@ sub get_link {
 
         if ( !defined $authid && $self->{'broader_headings'} ) {
             my $field     = $heading->field();
-            my @subfields = $field->subfields();
+            my @subfields = grep { $_->[0] ne '9' } $field->subfields();
             if ( scalar @subfields > 1 ) {
                 pop @subfields;
-                $field->replace_with(
+                $field =
                     MARC::Field->new(
                         $field->tag,
                         $field->indicator(1),
                         $field->indicator(2),
-                        map { $_[0] => $_[1] } @subfields
-                    )
-                );
+                        map { $_->[0] => $_->[1] } @subfields
+                    );
                 ( $authid, $fuzzy ) =
                   $self->get_link( C4::Heading->new_from_bib_field($field),
                     $behavior );
-- 
1.7.11.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to