Bug 8823

Summary: CatalogModuleRelink Creates Multiple Links between Bib and Auth record ($9 RLIN)
Product: Koha Reporter: Joy Nelson <1joynelson>
Component: CatalogingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Paul Poulain <paul.poulain>
Severity: normal    
Priority: P5 - low CC: chris, m.de.rooy, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9149
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Screenshot of edit screen
Bug 8823: CatalogModuleRelink Creates Multiple Links between Bib and Auth record
Bug 8823: CatalogModuleRelink Creates Multiple Links between Bib and Auth record

Description Joy Nelson 2012-09-25 23:05:21 UTC
Created attachment 12510 [details]
Screenshot of edit screen

Following system preferences are set in Authorities tab:
AutoCreateAuthorities 	--GENERATE
BiblioAddsAuthorities 	--ALLOW
dontmerge 	        --DO
UseAuthoritiesForTracings --DON'T	

Linker
CatalogModuleRelink 	--DO
LinkerKeepStale 	--DON'T
LinkerModule 	        --First Match
LinkerOptions 	        <blank>
LinkerRelink 	        --DO

When editing a bibliographic record, (editing anything) Koha relinks the bib record to a machine generated auth record and retains the previous link.  So, multiple $9 fields are created for every tag that links to an authority record.


Part of MARCxml in biblioitems
<datafield tag="100" ind1=" " ind2=" ">
    <subfield code="a">Einstein, Albert</subfield>
    <subfield code="d">1800-2010</subfield>
    <subfield code="9">260394</subfield>
    <subfield code="c">Numero Uno</subfield>
    <subfield code="9">260395</subfield>
    <subfield code="9">260399</subfield>
    <subfield code="9">260403</subfield>
    <subfield code="9">260407</subfield>
    <subfield code="9">260411</subfield>
    <subfield code="9">260415</subfield>
  </datafield>
  <datafield tag="650" ind1=" " ind2="0">
    <subfield code="a">Relativity (Physics)</subfield>
    <subfield code="9">253848</subfield>
    <subfield code="9">260396</subfield>
    <subfield code="9">260400</subfield>
    <subfield code="9">260404</subfield>
    <subfield code="9">260408</subfield>
    <subfield code="9">260412</subfield>
    <subfield code="9">260416</subfield>
  </datafield>
  <datafield tag="700" ind1="1" ind2=" ">
    <subfield code="9">195045</subfield>
    <subfield code="a">Einstein, Albert,</subfield>
    <subfield code="d">1879-1955.</subfield>
    <subfield code="9">260397</subfield>
    <subfield code="9">260401</subfield>
    <subfield code="9">260405</subfield>
    <subfield code="9">260409</subfield>
    <subfield code="9">260413</subfield>
    <subfield code="9">260417</subfield>
  </datafield>
  <datafield tag="830" ind1=" " ind2="0">
    <subfield code="a">Bonanza paperback.</subfield>
    <subfield code="9">253849</subfield>
    <subfield code="9">260398</subfield>
    <subfield code="9">260402</subfield>
    <subfield code="9">260406</subfield>
    <subfield code="9">260410</subfield>
    <subfield code="9">260414</subfield>
    <subfield code="9">260418</subfield>
Comment 1 Jared Camins-Esakov 2012-09-25 23:50:14 UTC
Could you please provide a test plan for replicating this problem? I have my settings exactly the same as yours, and can edit and save to my heart's content without any extra $9s showing up.
Comment 2 Joy Nelson 2012-09-26 14:40:03 UTC
Jared-
Here is a screencast:  http://screencast.com/t/gsopfG4y7M4
I have replicated it on 3.8.1 through 3.8.5

(In reply to comment #1)
> Could you please provide a test plan for replicating this problem? I have my
> settings exactly the same as yours, and can edit and save to my heart's
> content without any extra $9s showing up.
Comment 3 Jared Camins-Esakov 2012-09-26 21:39:13 UTC Comment hidden (obsolete)
Comment 4 Chris Cormack 2012-10-14 20:20:01 UTC
Created attachment 12806 [details] [review]
Bug 8823: CatalogModuleRelink Creates Multiple Links between Bib and Auth record

On 3.8.x, it was possible for multiple automatically generated
authorities to be linked to a single heading. This patch deletes
previous links from headings prior to linking them to
automatically-generated headings. This patch also corrects a
potential problem wherein multiple authorities might be generated if
a record is edited repeatedly in quick succession. The latter problem
exists on Master and 3.6.x as well, and the code that corrects the
multiple linkages is equally applicable if seemingly unnecessary.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 5 Paul Poulain 2012-10-28 18:37:26 UTC
QA comment:
 * passes koha-qa.pl
 * 99% of the patch is reindenting of code after adding a if() {} else {}

passed QA
Comment 6 Paul Poulain 2012-10-28 18:37:47 UTC
Patch pushed to master
Comment 7 Chris Cormack 2012-10-28 20:29:22 UTC
Pushed to 3.8.x will be in 3.8.7