From 888acb98ff57fff66c56be5913fa6b1c0730e764 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 20 Oct 2023 11:55:58 +0000 Subject: [PATCH] Bug 35115: Prefix biblio hash with table name It seems TransformKohaToMarc requires the input to be prefixed with the table name, like this: { 'biblio.abstract' => undef, 'biblio.subtitle' => undef, 'biblio.frameworkcode' => 'BKS', 'biblio.medium' => undef, 'biblio.part_name' => undef, 'biblio.copyrightdate' => 2008, 'biblio.seriestitle' => undef, 'biblio.notes' => 'Originally published: 2008.', 'biblio.biblionumber' => 299, 'biblio.serial' => undef, 'biblio.title' => 'Kluge :', 'biblio.datecreated' => '2014-05-07', 'biblio.part_number' => undef, 'biblio.author' => 'Marcus, Gary F.', 'biblio.timestamp' => '2020-04-21 09:38:26', 'biblio.unititle' => undef }; but we were using this: { 'abstract' => undef, 'notes' => 'Originally published: 2008.', 'medium' => undef, 'subtitle' => undef, 'title' => 'Kluge :', 'author' => 'Marcus, Gary F.', 'serial' => undef, 'timestamp' => '2020-04-21 09:38:26', 'biblionumber' => 299, 'part_name' => undef, 'datecreated' => '2014-05-07', 'part_number' => undef, 'seriestitle' => undef, 'unititle' => undef, 'frameworkcode' => 'BKS', 'copyrightdate' => 2008 }; ATTENTION: This does not solve the whole issue, i.e. MARC fields not mapped to Koha fields will still be stripped. More work required. --- Koha/ERM/EHoldings/Resource.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Koha/ERM/EHoldings/Resource.pm b/Koha/ERM/EHoldings/Resource.pm index 2457b2d644..e4d9e4ee89 100644 --- a/Koha/ERM/EHoldings/Resource.pm +++ b/Koha/ERM/EHoldings/Resource.pm @@ -55,6 +55,10 @@ sub store { ? Koha::Biblios->find( $title->biblio_id )->unblessed : {}; + foreach my $biblio_field ( keys %$biblio ) { + $biblio->{ 'biblio.' . $biblio_field } = delete $biblio->{$biblio_field}; + } + my $marc_record = TransformKohaToMarc( { %$biblio, -- 2.30.2