Bugzilla – Attachment 145961 Details for
Bug 32782
Add UNIMARC support to the ERM module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32782: ERM UNIMARC support - Create the biblio record when a resource is created
Bug-32782-ERM-UNIMARC-support---Create-the-biblio-.patch (text/plain), 1.77 KB, created by
Jonathan Druart
on 2023-02-01 15:52:35 UTC
(
hide
)
Description:
Bug 32782: ERM UNIMARC support - Create the biblio record when a resource is created
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-01 15:52:35 UTC
Size:
1.77 KB
patch
obsolete
>From 8626cef6b39b1573c6a2b1f13bc677298d234415 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 1 Feb 2023 14:06:30 +0100 >Subject: [PATCH] Bug 32782: ERM UNIMARC support - Create the biblio record > when a resource is created > >--- > Koha/ERM/EHoldings/Resource.pm | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > >diff --git a/Koha/ERM/EHoldings/Resource.pm b/Koha/ERM/EHoldings/Resource.pm >index fa776cf081f..2457b2d6443 100644 >--- a/Koha/ERM/EHoldings/Resource.pm >+++ b/Koha/ERM/EHoldings/Resource.pm >@@ -21,6 +21,7 @@ use MARC::Record; > > use Koha::Database; > >+use C4::Biblio qw( AddBiblio TransformKohaToMarc ); > use Koha::Acquisition::Booksellers; > use Koha::Biblios; > use Koha::ERM::EHoldings::Titles; >@@ -47,16 +48,23 @@ sub store { > > # FIXME This is terrible and ugly, we need to: > # * Provide a mapping for each attribute of title >- # * Deal with marcflavour > # * Create a txn > my $title = $self->title; >- my $biblio = $title->biblio_id ? Koha::Biblios->find($title->biblio_id) : undef; >- my $marc_record = $biblio ? $biblio->metadata->record : MARC::Record->new; >- eval {$marc_record->field('245')->delete_subfield('a');}; >- $marc_record->add_fields(MARC::Field->new(245, '', '', a => $title->publication_title)); >+ my $biblio = >+ $title->biblio_id >+ ? Koha::Biblios->find( $title->biblio_id )->unblessed >+ : {}; >+ >+ my $marc_record = TransformKohaToMarc( >+ { >+ %$biblio, >+ 'biblio.title' => $title->publication_title, >+ >+ } >+ ); > > my $biblio_id; >- if ( $biblio ) { >+ if ( %$biblio ) { > $biblio_id = $title->biblio_id; > C4::Biblio::ModBiblio($marc_record, $title->biblio_id, ''); > } else { >-- >2.25.1
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 32782
:
145961
|
148516
|
148517
|
148998
|
148999
|
149000