Bug 14583

Summary: Subfields not deleted when automatically merging authorities.
Product: Koha Reporter: Maxime Beaulieu <maxime.beaulieu>
Component: CatalogingAssignee: Maxime Beaulieu <maxime.beaulieu>
Status: CLOSED DUPLICATE QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: abl, eric.begin, f.demians, francois.charbonnier, m.de.rooy, marjorie.barry-vila, nick, philippe.blouin
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13760
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5572
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11315
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5264
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16802
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 14583 - Subfields not deleted when automatically merging authorities

Description Maxime Beaulieu 2015-07-21 18:50:39 UTC
This problem happens when editing autorities with syspref "dontmerge" enabled.

Subfield deletion is not reflected in the referencing record.

How to reproduce:
0) Set the "dontmerge" syspref to "Do"
1) Create an authority record.
2) Set values in the 245$a and 245$v subfields.
3) Edit or create a biliographic record and link the authority.
4) Edit the linked authority: 
       remove the 245$v subfield
       add a value in the 245$z sufield
5) Check the authority values in the bibliographic record:
       The $v subfield is still there (merge failed)
       The $z subfield was added (merge worked)

(subfields and $v and $z were arbitrarely chosen)

A patch will follow.
Comment 1 Maxime Beaulieu 2015-07-21 19:00:01 UTC
(In reply to Maxime Beaulieu from comment #0)
> 2) Set values in the 245$a and 245$v subfields.

Woops, field tag depends of the authority you create.
Ex: 150 for TOPIC_TERM
Comment 2 Maxime Beaulieu 2015-07-21 19:03:52 UTC
Created attachment 41112 [details] [review]
Bug 14583 - Subfields not deleted when automatically merging authorities

This problem happens when editing autorities with syspref "dontmerge" enabled.

Subfield deletion is not reflected in the referencing record.

How to test:
0) Set the "dontmerge" syspref to "Do"
1) Create a Topical Term authority record.
2) Set values in the 150$a and 150$v subfields.
3) Edit or create a biliographic record and link the authority.
4) Edit the linked authority:
    remove the 150$v subfield
    add a value in the 150$z sufield
5) Check the authority values in the bibliographic record:
    The $v subfield is still there (merge failed)
    The $z subfield was added (merge worked)

6) Apply the patch
7) Edit the linked authority:
    remove the 150$z subfield
    add a value in the 150$x sufield
8) Check the authority values in the bibliographic record:
    The deleted subfields are gone.

modified:   C4/AuthoritiesMarc.pm
Comment 3 Frédéric Demians 2015-11-06 18:21:28 UTC
I can reproduce the issue you describe, and I confirm that your patch solves it. But a) your code leaves a variable ($exclude) which isn't used anymore, and b) you remove a portion of code which was introduced by bug 5264 (see also bug 5572). Have you tried solving your issue with bug 5572?
Comment 4 Frédéric Demians 2015-11-06 18:30:38 UTC
> Have you tried solving your issue with bug 5572?

I have. It make it. You should use it, sign, and obsolete your patch.
Comment 5 Marcel de Rooy 2017-01-14 12:27:14 UTC
I am closing this report in favor of the bugs under omnibus bug 17908. This subject is touched in many reports and we have a lot of duplicated code. The solution under 5572/11315/11700 are more comprehensive and make this behavior pref controlled.

*** This bug has been marked as a duplicate of bug 17908 ***