[Koha-bugs] [Bug 6657] New: Making 999 visible in framework duplicates 999 entry and affects index

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Aug 1 16:01:53 CEST 2011


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6657

             Bug #: 6657
           Summary: Making 999 visible in framework duplicates 999 entry
                    and affects index
    Classification: Unclassified
 Change sponsored?: ---
           Product: Koha
           Version: rel_3_6
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P5
         Component: Cataloging
        AssignedTo: gmcharlt at gmail.com
        ReportedBy: jwagner at ptfs.com
         QAContact: koha-bugs at lists.koha-community.org
                CC: ian.walls at bywatersolutions.com


The 999 field is usually hidden in the frameworks; the 999$c is where Koha
stores the biblionumber for the title.  If someone edits the framework to make
any field of the 999 visible, then any edit to any field of the MARC record
results in a duplicate 999 with the biblionumber repeated.  This can cause the
record to appear twice in the zebra index, and can also make OPAC suppression
not work.  I have verified this behavior in current development head and
several other versions.  To replicate, export a title record and check its 999
field. There should only be one.  For example:

=999  \\$c219$d219

or

 <datafield tag="999" ind1=" " ind2=" ">
    <subfield code="c">219</subfield>
    <subfield code="d">219</subfield>
  </datafield>


Then edit the framework to make any field of the 999 visible, and edit that
same record.  Make any change to the title, such as adding a 5xx note.  Export
the record again and check the 999.  There will now be two of them, repeating
the biblionumber:

=999  \\$c219$d219
=999  \\$c219

or

 <datafield tag="999" ind1=" " ind2=" ">
    <subfield code="c">219</subfield>
    <subfield code="d">219</subfield>
  </datafield>
  <datafield tag="999" ind1=" " ind2=" ">
    <subfield code="c">219</subfield>
  </datafield>


Changing the framework field back to hidden and forcing the MARC record back
through zebraqueue does not fix the problem.  The only fix we've found is to
manually remove the extra 999 at the table level, then rebuild indexes.

The first solution for the problem is to not set the 999 field as visible in
any framework, but since you can't stop people from being adventurous, we also
developed a code safeguard.  It has not yet been backported from our current
development head to the version in our public git repository; when it is, I'll
add a link.  In the meantime, here are the details of that commit.


   If the framework allows the biblionumber (999$c) field to be displayed and
   edited within the MARC editor, then this results in an additional 999$c
value
   being added to the MARC record.  This is because the code already pulled the
   biblionumber from the biblio table.  This patch removes the addition of the
   extra 999$c field, although this field shouldn't really be editable in the
   first place.

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 2e28f3f..3f61519 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1858,13 +1858,13 @@ sub TransformHtmlToMarc {
     my $record  = MARC::Record->new();
     my $i=0;
     my @fields;
+    my ( $biblionumbertagfield, $biblionumbertagsubfield ) =
+        &GetMarcFromKohaField( "biblio.biblionumber", '' );
     while ($params->[$i]){ # browse all CGI params
         my $param = $params->[$i];
         my $newfield=0;
         # if we are on biblionumber, store it in the MARC::Record (it may not
be in the edited fields)
         if ($param eq 'biblionumber') {
-            my ( $biblionumbertagfield, $biblionumbertagsubfield ) =
-                &GetMarcFromKohaField( "biblio.biblionumber", '' );
             if ($biblionumbertagfield < 10) {
                 $newfield = MARC::Field->new(
                     $biblionumbertagfield,
@@ -1903,6 +1903,12 @@ sub TransformHtmlToMarc {
             } else {
                 while(defined $params->[$j] && $params->[$j] =~ /_code_/){ #
browse all it's subfield
                     my $inner_param = $params->[$j];
+                    my $biblionumbertagsubfield_string = "_code_" .
$biblionumbertagsubfield . "_";
+                    if (($tag eq $biblionumbertagfield) &&
+                        ($inner_param =~ /$biblionumbertagsubfield_string/)) {
+                      $j += 2;
+                      next;
+                    }
                     if ($newfield){

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


More information about the Koha-bugs mailing list