Bugzilla – Attachment 183544 Details for
Bug 39545
Construct more complete 773 content when creating a child record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39545: (QA follow-up) Restore 240 field processing for subfield s
Bug-39545-QA-follow-up-Restore-240-field-processin.patch (text/plain), 3.34 KB, created by
Martin Renvoize (ashimema)
on 2025-06-26 15:14:10 UTC
(
hide
)
Description:
Bug 39545: (QA follow-up) Restore 240 field processing for subfield s
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-06-26 15:14:10 UTC
Size:
3.34 KB
patch
obsolete
>From 8deecfcf6ea3ba6319b27f64b35db5b28b04b34b Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 26 Jun 2025 16:08:28 +0100 >Subject: [PATCH] Bug 39545: (QA follow-up) Restore 240 field processing for > subfield s > >This patch restores the generation of subfield s from field 240 (Uniform Title) >in the MARC21 773 field generation, addressing cataloger feedback about the >critical importance of this field for: > >- Bibles and books of the Bible >- Laws and statutes >- Translations >- Academic and specialized library materials >- Legal materials and treaties > >The MARC21 standard defines subfield s as "Uniform title (NR)" and this data >is essential for proper bibliographic relationships. > >This patch also fixes a warning when 245 indicator 2 contains non-numeric >values by adding proper validation. > >Test plan: >1. Create a record with a 240 field containing uniform title data >2. Generate a child record from it >3. Verify the 773 field now contains subfield s with the uniform title >4. Run prove t/db_dependent/Koha/Biblio.t to ensure all tests pass > >Signed-off-by: Heather Hernandez <flyingendpaper@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/Biblio.pm | 9 +++++++++ > t/db_dependent/Koha/Biblio.t | 11 ++++++++++- > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index acaadc61892..175b68f971c 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -1972,6 +1972,7 @@ sub generate_marc_host_field { > my $t = $f245c->as_string; > $t =~ s/[\s\/\\.]+$//; > my $nonfiling = $f245c->indicator('2') // 0; >+ $nonfiling = 0 unless $nonfiling =~ /^\d+$/; > $t = ucfirst substr( $t, $nonfiling ); > push @sfd, ( 't' => $t ); > } >@@ -1985,6 +1986,14 @@ sub generate_marc_host_field { > } > } > >+ # Subfield s - uniform title from 240 >+ if ( my $f240 = $marc_host->field('240') ) { >+ my $s = $f240->as_string('a'); >+ if ($s) { >+ push @sfd, ( 's' => $s ); >+ } >+ } >+ > # Subfield d - publication info from 264/260 > my $d; > my @publication_fields = $marc_host->field('264'); >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 731278cc364..1aefd2d543a 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -1016,7 +1016,7 @@ subtest 'get_volumes_query' => sub { > }; > > subtest 'generate_marc_host_field' => sub { >- plan tests => 35; >+ plan tests => 36; > > $schema->storage->txn_begin; > >@@ -1101,6 +1101,15 @@ subtest 'generate_marc_host_field' => sub { > $link = $biblio->generate_marc_host_field(); > is( $link->subfield('t'), 'The capital test', "Title is capitalized after indicator offset" ); > >+ # 240 uniform title tests >+ $record->append_fields( >+ MARC::Field->new( '240', '1', '0', 'a' => 'Bible. English', 'l' => 'English' ) >+ ); >+ ($biblio_id) = AddBiblio( $record, qw{} ); >+ $biblio = Koha::Biblios->find($biblio_id); >+ $link = $biblio->generate_marc_host_field(); >+ is( $link->subfield('s'), 'Bible. English', "Subfield s contains uniform title from 240a" ); >+ > # 260/264 handling tests > $record->append_fields( > MARC::Field->new( '264', '', '', a => 'Publication 264' ), >-- >2.49.0
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 39545
:
180571
|
180572
|
180600
|
180601
|
181876
|
181877
|
181970
|
181987
|
181988
|
183542
|
183543
|
183544
|
183600
|
183601
|
183602
|
183758
|
183759
|
183760