Bugzilla – Attachment 141482 Details for
Bug 19693
Update of an authority record creates inconsistency when the heading tag is changed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19693: (QA follow-up) Replace changed tag test
Bug-19693-QA-follow-up-Replace-changed-tag-test.patch (text/plain), 2.71 KB, created by
Marcel de Rooy
on 2022-10-07 09:42:15 UTC
(
hide
)
Description:
Bug 19693: (QA follow-up) Replace changed tag test
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-10-07 09:42:15 UTC
Size:
2.71 KB
patch
obsolete
>From 79aab6a1449128b5e310b92ad84c5af12dbefe68 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 7 Oct 2022 08:41:20 +0000 >Subject: [PATCH] Bug 19693: (QA follow-up) Replace changed tag test >Content-Type: text/plain; charset=utf-8 > >The test > $MARCfrom->field('1..', '2..'))[0]->tag ne ($MARCto->field('1..', '2..'))[0]->tag >is not completely consistent with following code in sub merge. >I decided to get the authtype code from the old record that comes >from Koha and should include the type. >Remaining changes refer to indentation/comments. > >Test plan: >Run t/db_dependent/Authority/Merge.t >Note: The test actually could be extended a bit for mocking MARC >flavor, but needs some additional framework support to work. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/AuthoritiesMarc.pm | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index 6a2733ebcf..863ca3d610 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1418,15 +1418,18 @@ sub merge { > # Search authtypes and reporting tags > my $authfrom = Koha::Authorities->find($mergefrom); > my $authto = Koha::Authorities->find($mergeto); >- my $authtypefrom = $authfrom ? Koha::Authority::Types->find($authfrom->authtypecode) : undef; >- # If it is a mod ($authfrom == $authto) and there was a change of a heading tag $authtypefrom read from the database is of the current version of the auth rec., which is misleading, so we ignore it >- if ($mergeto && $mergefrom == $mergeto && $MARCfrom && $MARCto && >- $MARCfrom->field('1..', '2..') && $MARCto->field('1..', '2..') && ($MARCfrom->field('1..', '2..'))[0]->tag ne ($MARCto->field('1..', '2..'))[0]->tag) { >- undef $authtypefrom; >- undef $authfrom; >- } >- >+ my $authtypefrom; > my $authtypeto = $authto ? Koha::Authority::Types->find($authto->authtypecode) : undef; >+ if( $mergeto && $mergefrom == $mergeto && $MARCfrom ) { >+ # bulkmarcimport may have changed the authtype; see BZ 19693 >+ my $old_type = $MARCfrom->subfield( get_auth_type_location() ); # going via default >+ if( $old_type && $authto && $old_type ne $authto->authtypecode ) { >+ # Type change: handled by simulating a postponed merge where the auth record has been deleted already >+ # This triggers a walk through all auth controlled tags >+ undef $authfrom; >+ } >+ } >+ $authtypefrom = Koha::Authority::Types->find($authfrom->authtypecode) if $authfrom; > my $auth_tag_to_report_from = $authtypefrom ? $authtypefrom->auth_tag_to_report : ''; > my $auth_tag_to_report_to = $authtypeto ? $authtypeto->auth_tag_to_report : ''; > >-- >2.30.2
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 19693
:
69344
|
69349
|
69350
|
138121
|
138122
|
140915
|
140916
|
141480
|
141481
| 141482