Bugzilla – Attachment 106074 Details for
Bug 25189
AutoCreateAuthorities can repeatedly generate authority records when using Default linker
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25189: Don't create authority if results found
Bug-25189-Dont-create-authority-if-results-found.patch (text/plain), 3.29 KB, created by
Martin Renvoize (ashimema)
on 2020-06-19 11:50:38 UTC
(
hide
)
Description:
Bug 25189: Don't create authority if results found
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-06-19 11:50:38 UTC
Size:
3.29 KB
patch
obsolete
>From c44618bdf48c49e55a4646da070c26417a663083 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 28 Apr 2020 15:34:20 +0000 >Subject: [PATCH] Bug 25189: Don't create authority if results found > >Automatic authority creation assumes that if we don't match we need a new authority. > >Using the Default linker, however, we don't match if there exists more than one match. >This leads to repeatedly generating authorities once there is a duplicate in the system > >We shoudl instead only create a new authority if there are no results > >To test: >1 - Set Linker Module to 'Default' >2 - Enable AutoCreateAuthorities and BiblioAddsAuthorities and CatalogModuleRelink and LinkerRelink >3 - Add two copies of a single authority via Z39 >4 - Add a heading for that authority to a bib record >5 - Save the record and note a new authority is generated >6 - Repeat and see another is generated >7 - Apply patch >8 - Restart all the things >9 - Save the record again, no new authority created > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Biblio.pm | 4 ++-- > C4/Linker/Default.pm | 4 +++- > 2 files changed, 5 insertions(+), 3 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 9eb3696a54..9307a215b3 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -506,7 +506,7 @@ sub LinkBibHeadingsToAuthorities { > next; > } > >- my ( $authid, $fuzzy ) = $linker->get_link($heading); >+ my ( $authid, $fuzzy, $match_count ) = $linker->get_link($heading); > if ($authid) { > $results{ $fuzzy ? 'fuzzy' : 'linked' } > ->{ $heading->display_form() }++; >@@ -526,7 +526,7 @@ sub LinkBibHeadingsToAuthorities { > if ( _check_valid_auth_link( $current_link, $field ) ) { > $results{'linked'}->{ $heading->display_form() }++; > } >- else { >+ elsif ( !$match_count ) { > my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); > my $marcrecordauth = MARC::Record->new(); > if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { >diff --git a/C4/Linker/Default.pm b/C4/Linker/Default.pm >index bfe1d72308..934e87536a 100644 >--- a/C4/Linker/Default.pm >+++ b/C4/Linker/Default.pm >@@ -33,6 +33,7 @@ sub get_link { > my $auth_type = $heading->auth_type(); > my $authid; > my $fuzzy = 0; >+ my $match_count; > > if ( $self->{'cache'}->{$search_form.$auth_type}->{'cached'} ) { > $authid = $self->{'cache'}->{$search_form.$auth_type}->{'authid'}; >@@ -42,6 +43,7 @@ sub get_link { > > # look for matching authorities > my $authorities = $heading->authorities(1); # $skipmetadata = true >+ $match_count = scalar @$authorities; > > if ( $behavior eq 'default' && $#{$authorities} == 0 ) { > $authid = $authorities->[0]->{'authid'}; >@@ -77,7 +79,7 @@ sub get_link { > $self->{'cache'}->{$search_form.$auth_type}->{'authid'} = $authid; > $self->{'cache'}->{$search_form.$auth_type}->{'fuzzy'} = $fuzzy; > } >- return $self->SUPER::_handle_auth_limit($authid), $fuzzy; >+ return $self->SUPER::_handle_auth_limit($authid), $fuzzy, $match_count; > } > > sub update_cache { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25189
:
103858
|
103870
|
103871
|
103894
|
103895
|
106073
| 106074