From bea95a3ec80b8c1f21c64ecab7c4636c0a68848e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 17 Jul 2024 09:43:52 +0100 Subject: [PATCH] Bug 37364: Add requested RDA handling to generate_marc_host_field This patch adds handling for the 264 field in precedence to the 260 for the generate_marc_host_field method and also adds subfields n and p to the 245 handling. --- Koha/Biblio.pm | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 8029be8e430..36260ca1a58 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -1806,10 +1806,26 @@ sub generate_marc_host_field { } # Publication - if ( $host_field = $marc_host->field('260') ) { - my $s = $host_field->as_string('abc'); - if ($s) { - $sfd{d} = $s; + my @publication_fields = $marc_host->field('264'); + # Fallback to 260 if there are no 264 + @publication_fields = $marc_host->field('260') unless (@publication_fields); + my $index = 0; + for my $host_field (@publication_fields) { + + # Use first entry unless we find a prefered indicator1 = 3 + if ( $index == 0 ) { + my $s = $host_field->as_string('abc'); + if ($s) { + $sfd{d} = $s; + } + $index++; + } + if ( $host_field->indicator(1) == 3 ) { + my $s = $host_field->as_string('abc'); + if ($s) { + $sfd{d} = $s; + } + last; } } @@ -1823,7 +1839,7 @@ sub generate_marc_host_field { # Title if ( $host_field = $marc_host->field('245') ) { - my $s = $host_field->as_string('ab'); + my $s = $host_field->as_string('abnp'); if ($s) { $sfd{t} = $s; } -- 2.45.2