https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43483 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 209025 (full commit message, for the test plan) Bug 43483: Don't treat blank thesaurus indicator as 'notdefined' for matching C4::Heading::MARC21::_get_subject_thesaurus coerced a blank/undefined 2nd indicator on a 6XX field to the literal thesaurus value 'notdefined', while parse_heading leaves the thesaurus undef for the equivalent 1XX/7XX name field. C4::Heading::_search only applies a thesaurus constraint to the authority-matching query when thesaurus is defined, so the same personal name ended up searched/created without any thesaurus constraint via a 100/700 field, but with a hard 'notdefined' constraint via a 600 field with no thesaurus recorded - letting the linker create two separate authority records for the same heading, which Koha's own duplicate-authority detection then flags as duplicates. A blank/undefined 2nd indicator asserts no thesaurus at all, so it should be treated the same as a non-subject field: leave thesaurus undef, and only apply a constraint when a thesaurus is explicitly coded (indicator 0-7). Note that a 6XX 2nd indicator is not defined as blank in MARC21 for name headings, but blank is what many imported and legacy records carry. Records using 2nd indicator 0 are unaffected by this patch. To test: 1. Run the unit tests inside KTD: ktd --shell --run 'prove t/db_dependent/Heading_MARC21.t t/db_dependent/Heading.t' They pass. To see them fail, revert only the change to C4/Heading/MARC21.pm and run them again: the new blank-indicator cases fail. 2. Enable the LinkerConsiderThesaurus, AutoLinkBiblios and AutoCreateAuthorities system preferences. 3. Make sure there is no authority for "Goddard, Giles" yet. 4. Catalogue a new bibliographic record with the same name as author and as subject (an autobiography), leaving the 6XX 2nd indicator blank: 100 1_ $a Goddard, Giles $d 1962- 600 1_ $a Goddard, Giles $d 1962- 5. Save the record, then search Authorities for "Goddard". - Without this patch: two authority records are created for the same heading. - With this patch: a single authority record, linked from both the 100 and the 600. 6. Catalogue a second record with a different author and 700 1_ $a Goddard, Giles $d 1962- Save it and confirm it links to that same authority record, and that no further authority was created. 7. Sign off Sponsored-by: Martin Renvoize <martin.renvoize@gmail.com> -- You are receiving this mail because: You are watching all bug changes.