Bug 25387 - Avoid merge different type of authorities
Summary: Avoid merge different type of authorities
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Marion Durand
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-06 10:40 UTC by Hugo Agud
Modified: 2023-02-03 17:33 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 25387: Merging different authority types create no warning (6.77 KB, patch)
2021-10-18 09:06 UTC, Marion Durand
Details | Diff | Splinter Review
Bug 25387: Merging different authority types create no warning (5.99 KB, patch)
2021-10-20 13:54 UTC, Marion Durand
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Agud 2020-05-06 10:40:08 UTC
When a librarian tries to merge two differents authorities for exampletopic_authority with geogrpahic_authority  (Turkey) it deletes one of the  authority and all the tags associated

for example merging Turkey(topic) with Turkey(geographic) the result is all 650$aTurkey dissapear

We should add a lock to avoid merge two different authorities...
Comment 1 Marcel de Rooy 2020-09-28 09:07:39 UTC
(In reply to Hugo Agud from comment #0)
> When a librarian tries to merge two differents authorities for
> exampletopic_authority with geogrpahic_authority  (Turkey) it deletes one of
> the  authority and all the tags associated
> 
> for example merging Turkey(topic) with Turkey(geographic) the result is all
> 650$aTurkey dissapear
> 
> We should add a lock to avoid merge two different authorities...

Or should we warn?
We have sometimes corporates that should be persons, or v.v.
Comment 2 Fridolin Somers 2020-09-28 14:13:34 UTC
(In reply to Marcel de Rooy from comment #1)
> 
> Or should we warn?
> We have sometimes corporates that should be persons, or v.v.

Good point, we have the same question from librarians.

And also more display of auth type during merge.
Comment 3 Marion Durand 2021-10-18 09:06:28 UTC
Created attachment 126415 [details] [review]
Bug 25387: Merging different authority types create no warning

Merging two different authorities types can result in the loss of some
field. This patch adds a warning when merging different type of
authorities and add more display of authorities types during merge.

To test:
1- Find two authorities you what to merge. Be sure that these
authorities have different type
2- Search for these authorities (be sure to have both results on the
results page)
3- For the first authority click on "Actions" then on "Merge", same for
the second one
4- Check that koha is asking you to choose a framework and that
authority types are not displayed
5- Choose a framework, then click on next
6- Check that the authority type is not displayed in the tabs and that
no warning appear
7- Apply the patch
8- Repeat step 1 to 3 again
9- Check that authority type is now displayed next to their ID
10- Repeate setp 5 again
11- Check that the authority types is now displayed in the tabs next to
their ID and that a warning appear
Comment 4 Fridolin Somers 2021-10-20 08:57:14 UTC
Hi,

misc/translator/po/fr-FR-staff-prog-MT29830.po
You must not integrate this file in Bugzilla, it is a Biblibre-specific system.
Comment 5 Marcel de Rooy 2021-10-20 09:14:50 UTC
I think we should not block. We should warn.
We should allow catalogers in some way to e.g. move a corporate name into a personal name.
Comment 6 Marion Durand 2021-10-20 13:54:16 UTC
Created attachment 126588 [details] [review]
Bug 25387: Merging different authority types create no warning

Merging two different authorities types can result in the loss of some
field. This patch adds a warning when merging different type of
authorities and add more display of authorities types during merge.

To test:
1- Find two authorities you what to merge. Be sure that these
authorities have different type
2- Search for these authorities (be sure to have both results on the
results page)
3- For the first authority click on "Actions" then on "Merge", same for
the second one
4- Check that koha is asking you to choose a framework and that
authority types are not displayed
5- Choose a framework, then click on next
6- Check that the authority type is not displayed in the tabs and that
no warning appear
7- Apply the patch
8- Repeat step 1 to 3 again
9- Check that authority type is now displayed next to their ID
10- Repeate setp 5 again
11- Check that the authority types is now displayed in the tabs next to
their ID and that a warning appear
Comment 7 Marion Durand 2021-10-20 13:55:29 UTC
(In reply to Fridolin Somers from comment #4)
> Hi,
> 
> misc/translator/po/fr-FR-staff-prog-MT29830.po
> You must not integrate this file in Bugzilla, it is a Biblibre-specific
> system.

Oups ! I have removed it
Comment 8 Marion Durand 2021-10-20 14:01:35 UTC
(In reply to Marcel de Rooy from comment #5)
> I think we should not block. We should warn.
> We should allow catalogers in some way to e.g. move a corporate name into a
> personal name.

Currently the patch display the authority types and warn the cataloger but it is still possible to merge authority with different authority type.

Here is the message : "Multiple authority types are used. There may be a data loss while merging." (If you have an idea of a more appropriate want feel free to propose)
Comment 9 Katrin Fischer 2021-11-04 10:47:36 UTC
Could it be an option to only allow merging when the 'losing' record is unused? In this case there would be no data loss and a warning would not be necessary.
Comment 10 Marcel de Rooy 2021-11-04 11:00:29 UTC
(In reply to Katrin Fischer from comment #9)
> Could it be an option to only allow merging when the 'losing' record is
> unused? In this case there would be no data loss and a warning would not be
> necessary.

I dont think so. Manual relinking wont be fun.
Comment 11 Katrin Fischer 2021-11-08 18:20:33 UTC
(In reply to Marcel de Rooy from comment #10)
> (In reply to Katrin Fischer from comment #9)
> > Could it be an option to only allow merging when the 'losing' record is
> > unused? In this case there would be no data loss and a warning would not be
> > necessary.
> 
> I dont think so. Manual relinking wont be fun.

Not sure if we understood each other. What I mean it merging an authority record that is not linked (used) in any bibliographic record. So no relinking would be necessary.
Comment 12 Marcel de Rooy 2021-11-09 12:20:12 UTC
(In reply to Katrin Fischer from comment #11)
> (In reply to Marcel de Rooy from comment #10)
> > (In reply to Katrin Fischer from comment #9)
> > > Could it be an option to only allow merging when the 'losing' record is
> > > unused? In this case there would be no data loss and a warning would not be
> > > necessary.
> > 
> > I dont think so. Manual relinking wont be fun.
> 
> Not sure if we understood each other. What I mean it merging an authority
> record that is not linked (used) in any bibliographic record. So no
> relinking would be necessary.

We understand each other :) And I would say: No, thats a bad idea. Manual relinking the ones who are used, wont be fun.
Comment 13 Katrin Fischer 2021-11-10 08:45:17 UTC
But why would you have to manually relink those if the used record is the winner? No changes in the bibliographic record woudl be necessary.
Comment 14 Marion Durand 2022-01-03 13:42:22 UTC
Hi !
In my understanding (I can be wrong), Marcel is saying that we shouldn't only allow merging when the losing record is unused, because if we notice two record we want to merge and both of them are used, we will have to manually relink them (to make one used and the other not). And only then we can merge the record. 

So it's not the actual merging that would be a problem but the process before, to make the merge possible.
Comment 15 Katrin Fischer 2022-01-08 22:52:58 UTC
(In reply to marion.durand from comment #14)
> Hi !
> In my understanding (I can be wrong), Marcel is saying that we shouldn't
> only allow merging when the losing record is unused, because if we notice
> two record we want to merge and both of them are used, we will have to
> manually relink them (to make one used and the other not). And only then we
> can merge the record. 
> 
> So it's not the actual merging that would be a problem but the process
> before, to make the merge possible.

I think the relinking of records of the same authority type is a solved problem. 

I was thinking about use cases where we could safely allow merging of different auhority types where the relinking is much harder because the MARC fields are not the same in MARC21 for different.
Comment 16 Katrin Fischer 2022-01-08 22:53:36 UTC
... for different types of entries (think of 100/110/111 etc.)
Comment 17 Thibault Keromnès 2022-09-08 14:29:26 UTC
Tried on a sandbox, doesn't apply : 
TASK [Apply bug 25387 via git-bz in docker container] **************************
fatal: [localhost -> koha-bz25387]: FAILED! => {"changed": true, "cmd": "cd /kohadevbox/koha && yes | git bz apply 25387", "delta": "0:00:07.694919", "end": "2022-09-08 14:15:09.992354", "msg": "non-zero return code", "rc": 1, "start": "2022-09-08 14:15:02.297435", "stderr": "error: Failed to merge in the changes.\nhint: Use 'git am --show-current-patch=diff' to see the failed patch\nPatch left in /tmp/Bug-25387-Merging-different-authority-types-create-RaNVft.patch", "stderr_lines": ["error: Failed to merge in the changes.", "hint: Use 'git am --show-current-patch=diff' to see the failed patch", "Patch left in /tmp/Bug-25387-Merging-different-authority-types-create-RaNVft.patch"], "stdout": "Applying: Bug 25387: Merging different authority types create no warning\nUsing index info to reconstruct a base tree...\nM\tkoha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc\nM\tkoha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt\nFalling back to patching base and 3-way merge...\nAuto-merging koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt\nAuto-merging koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc\nCONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc\nPatch failed at 0001 Bug 25387: Merging different authority types create no warning\nWhen you have resolved this problem run \"git bz apply --continue\".\nIf you would prefer to skip this patch, instead run \"git bz apply --skip\".\nTo restore the original branch and stop patching run \"git bz apply --abort\".\n\nBug 25387 - Avoid merge different type of authorities\n\n126588 - Bug 25387: Merging different authority types create no warning\n\nApply? [(y)es, (n)o, (i)nteractive] ", "stdout_lines": ["Applying: Bug 25387: Merging different authority types create no warning", "Using index info to reconstruct a base tree...", "M\tkoha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc", "M\tkoha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt", "Falling back to patching base and 3-way merge...", "Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt", "Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc", "CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc", "Patch failed at 0001 Bug 25387: Merging different authority types create no warning", "When you have resolved this problem run \"git bz apply --continue\".", "If you would prefer to skip this patch, instead run \"git bz apply --skip\".", "To restore the original branch and stop patching run \"git bz apply --abort\".", "", "Bug 25387 - Avoid merge different type of authorities", "", "126588 - Bug 25387: Merging different authority types create no warning", "", "Apply? [(y)es, (n)o, (i)nteractive] "]}
Comment 18 Heather 2022-09-23 14:08:41 UTC
I am late to this party, but if I'm merging auts together where the correct/new one is a 151 and wrong/old one is a 150 (with wrong/old 650s in the bibs), then I want the 650s in the bibs changed to 651s, linked to the new aut.  I would want a warning during the aut merge to alert me that this is a weird/unusual merge, and to make me think about it, but then I'd want to be able to go ahead.

Fictitious people headings do change, e.g., 150 _0 Baggins, Bilbo (Fictitious character) to 100 1_ Baggins, Bilbo 
And if I accidentally have these two authorities in my catalog, I would want to merge them, and have the 650s in the bibs updated to linked 600s.

If I can't have the bibs updated with the merge, then a warning directing me to the fact that I'll have to somehow manually update the now incorrect 650s in the bibs would be very good.

Cheers!
--h2
Comment 19 Esther Melander 2023-02-03 17:33:43 UTC
I agree with Heather.

I recently tried merging a 155 (genre) with a 150 (topical). I wanted the corresponding 655 to survive and the 650's changed to 655 with the correct link. The merge appeared to fail as both merge candidates disappeared -  meaning I can't find them in the database.

From a workflow perspective this kind of a merge, with warning, is an ideal way to clean up authorities.

As a workaround, which I have not tested, I would need to do a batch bib change to the authority records linked with the incorrect 650 to the correct 655 and then go back and delete the 150 authority. This is much more work, in my opinion.