Bugzilla – Attachment 182652 Details for
Bug 38142
UNIMARC: Choose heading to use from the authority record in the bibliographic record by language
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38142, Follow-up: Choose language to report from authority to bibliographic record.
Bug-38142-Follow-up-Choose-language-to-report-from.patch (text/plain), 8.40 KB, created by
Matthias Meusburger
on 2025-05-20 10:05:43 UTC
(
hide
)
Description:
Bug 38142, Follow-up: Choose language to report from authority to bibliographic record.
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2025-05-20 10:05:43 UTC
Size:
8.40 KB
patch
obsolete
>From 6599851914d5c858396e115d443d1094995d3e10 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Tue, 20 May 2025 09:53:52 +0000 >Subject: [PATCH] Bug 38142, Follow-up: Choose language to report from > authority to bibliographic record. > > - Rename LanguageToReportOnMerge system preference to LanguageToUseOnMerge > - Use "use" instead of "report" in system preference description > - Mark this feature as UNIMARC-only. >--- > C4/AuthoritiesMarc.pm | 4 ++-- > installer/data/mysql/atomicupdate/Bug38142.pl | 6 +++--- > .../modules/admin/preferences/authorities.pref | 4 ++-- > t/db_dependent/Authority/Merge.t | 18 ++++++++++-------- > 4 files changed, 17 insertions(+), 15 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index 8b3ccf1923e..064b840a259 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1620,10 +1620,10 @@ sub merge { > > my @record_to; > >- my $short_langcode = C4::Context->preference('LanguageToReportOnMerge'); >+ my $short_langcode = C4::Context->preference('LanguageToUseOnMerge'); > if ( $auth_tag_to_report_to && $MARCto && $MARCto->field($auth_tag_to_report_to) ) { > my $chosen_field = $MARCto->field($auth_tag_to_report_to); >- if ($short_langcode) { >+ if ( uc( C4::Context->preference('marcflavour') ) eq 'UNIMARC' && $short_langcode ) { > foreach my $field ( $MARCto->field($auth_tag_to_report_to) ) { > my $subfield = $field->subfield('7'); > if ( >diff --git a/installer/data/mysql/atomicupdate/Bug38142.pl b/installer/data/mysql/atomicupdate/Bug38142.pl >index f94ba2012b6..bfe26d7b4a3 100755 >--- a/installer/data/mysql/atomicupdate/Bug38142.pl >+++ b/installer/data/mysql/atomicupdate/Bug38142.pl >@@ -2,17 +2,17 @@ use Modern::Perl; > > return { > bug_number => "38142", >- description => "LanguageToReportOnMerge", >+ description => "LanguageToUseOnMerge", > up => sub { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; > $dbh->do( > q{ > INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES >- ('LanguageToReportOnMerge','','','If set, the authority field having the given language code in its $7 subfield will be reported to the bibliographic record if it exists, rather than the first field. The code can be in a short, 2 characters long form (example: ba for latin) or in a long, 8 characters long form, with the short form in position 5 and 6 starting from 1 (example: ba0yba0y for latin). A list of available codes can be found here: https://documentation.abes.fr/sudoc/formats/unmb/DonneesCodees/CodesZone104.htm#$d','Free'); >+ ('LanguageToUseOnMerge','','','If set, the authority field having the given language code in its $7 subfield will be used in the bibliographic record if it exists, rather than the first field. The code can be in a short, 2 characters long form (example: ba for latin) or in a long, 8 characters long form, with the short form in position 5 and 6 starting from 1 (example: ba0yba0y for latin). A list of available codes can be found here: https://documentation.abes.fr/sudoc/formats/unmb/DonneesCodees/CodesZone104.htm#$d. Please note that this feature is available only for UNIMARC.','Free'); > } > ); > >- say $out "Added new syspref 'LanguageToReportOnMerge'"; >+ say_success( $out, "Added new syspref 'LanguageToUseOnMerge'" ); > } > }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >index b824bb9b1ca..575e6d2ee14 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >@@ -104,8 +104,8 @@ Authorities: > - consider the intended use of MARC21 authority records (008/14-16) during cataloging and linking. > - "<br/>NOTE: If you enable this preference, 'No attempt to code' in 008/14-16 is excluded from search results too." > - >- - "If set, the authority field having the given language code in its $7 subfield will be reported to the bibliographic record if it exists, rather than the first field. The code can be in a short, 2 characters long form (example: ba for latin) or in a long, 8 characters long form, with the short form in position 5 and 6 starting from 1 (example: ba0yba0y for latin). A list of available codes can be found here: https://documentation.abes.fr/sudoc/formats/unmb/DonneesCodees/CodesZone104.htm#$d" >- - pref: LanguageToReportOnMerge >+ - "If set, the authority field having the given language code in its $7 subfield will be used in the bibliographic record if it exists, rather than the first field. The code can be in a short, 2 characters long form (example: ba for latin) or in a long, 8 characters long form, with the short form in position 5 and 6 starting from 1 (example: ba0yba0y for latin). A list of available codes can be found here: https://documentation.abes.fr/sudoc/formats/unmb/DonneesCodees/CodesZone104.htm#$d. Please note that this feature is available only for UNIMARC." >+ - pref: LanguageToUseOnMerge > Linker: > - > - Use the >diff --git a/t/db_dependent/Authority/Merge.t b/t/db_dependent/Authority/Merge.t >index bf1a5fc6ff7..37a112966a0 100755 >--- a/t/db_dependent/Authority/Merge.t >+++ b/t/db_dependent/Authority/Merge.t >@@ -213,7 +213,8 @@ subtest 'Test merge A1 to modified A1, test strict mode' => sub { > subtest 'Test merge A1 to B1 (choosing language)' => sub { > plan tests => 4; > >- t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', '' ); >+ t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); >+ t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', '' ); > > my $auth1 = MARC::Record->new; > $auth1->append_fields( >@@ -236,27 +237,27 @@ subtest 'Test merge A1 to B1 (choosing language)' => sub { > > is( > $biblio->subfield( '609', 'a' ), 'language da', >- 'When LanguageToReportOnMerge is not set, the first authority field is used' >+ 'When LanguageToUseOnMerge is not set, the first authority field is used' > ); > >- t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', 'ba' ); >+ t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', 'ba' ); > C4::AuthoritiesMarc::merge( { mergefrom => $authid1, MARCfrom => $auth1, mergeto => $authid1, MARCto => $auth1 } ); > $biblio = Koha::Biblios->find($biblionumber)->metadata->record; > is( > $biblio->subfield( '609', 'a' ), 'language ba', >- 'When LanguageToReportOnMerge is set, the field with the matching language is reported' >+ 'When LanguageToUseOnMerge is set, the field with the matching language is used' > ); > >- t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', 'xx' ); >+ t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', 'xx' ); > C4::AuthoritiesMarc::merge( { mergefrom => $authid1, MARCfrom => $auth1, mergeto => $authid1, MARCto => $auth1 } ); > $biblio = Koha::Biblios->find($biblionumber)->metadata->record; > is( > $biblio->subfield( '609', 'a' ), 'language da', >- 'When LanguageToReportOnMerge is set to a value that does not exist in the authority, the first authority field is used' >+ 'When LanguageToUseOnMerge is set to a value that does not exist in the authority, the first authority field is used' > ); > > # Long form of lang code >- t::lib::Mocks::mock_preference( 'LanguageToReportOnMerge', 'ba' ); >+ t::lib::Mocks::mock_preference( 'LanguageToUseOnMerge', 'ba' ); > my $auth2 = MARC::Record->new; > $auth2->append_fields( > MARC::Field->new( '109', '0', '0', 'a' => 'language da (long form)', '7' => 'ba0yda0y' ), >@@ -277,9 +278,10 @@ subtest 'Test merge A1 to B1 (choosing language)' => sub { > my $biblio2 = Koha::Biblios->find($biblionumber2)->metadata->record; > is( > $biblio2->subfield( '609', 'a' ), 'language ba (long form)', >- 'When LanguageToReportOnMerge is set, the field with the matching language in its long form is reported' >+ 'When LanguageToUseOnMerge is set, the field with the matching language in its long form is used' > ); > >+ t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ) if $marcflavour; > }; > > subtest 'Test merge A1 to B1 (changing authtype)' => sub { >-- >2.39.5
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 38142
:
172684
|
172802
|
172923
|
177508
|
180178
|
180222
|
182652
|
182671