Bugzilla – Attachment 180418 Details for
Bug 35095
Bibliographic record from local title only has 245$a
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35095: [POC] Bibliographic record created from local ERM title/KBart file contains only the title
Bug-35095-POC-Bibliographic-record-created-from-lo.patch (text/plain), 4.65 KB, created by
Janusz Kaczmarek
on 2025-04-02 15:16:12 UTC
(
hide
)
Description:
Bug 35095: [POC] Bibliographic record created from local ERM title/KBart file contains only the title
Filename:
MIME Type:
Creator:
Janusz Kaczmarek
Created:
2025-04-02 15:16:12 UTC
Size:
4.65 KB
patch
obsolete
>From c9277d2934017479d45ac86005404a801528a34a Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Wed, 2 Apr 2025 11:29:45 +0000 >Subject: [PATCH] Bug 35095: [POC] Bibliographic record created from local ERM > title/KBart file contains only the title > >According to the manuals page for ERM >(https://koha-community.org/manual/24.11/en/html/erm.html#create-a-new-local-title-record), >a local bibliographic record with basic fields taken from ERM resource >information (publication_title, print_identifier, online_identifier, >date_first_issue_online, date_last_issue_online, num_first_vol_online, >num_last_vol_online, title_url, first_author, coverage_depth, notes, >publisher_name) could be created. > >However, it seems that a bibliographic record created either from a KBart >file line, or from an ERM resource info entered by hand contains only the >title (cf. Koha::ERM::EHoldings::Title->store). > >Attached is a POC how one could enrich the record. > >It covers not only KBart import but also manual ER title creation. >--- > Koha/ERM/EHoldings/Title.pm | 81 ++++++++++++++++++++++++++++++++++++- > 1 file changed, 79 insertions(+), 2 deletions(-) > >diff --git a/Koha/ERM/EHoldings/Title.pm b/Koha/ERM/EHoldings/Title.pm >index ea62ecb360..543c70ec01 100644 >--- a/Koha/ERM/EHoldings/Title.pm >+++ b/Koha/ERM/EHoldings/Title.pm >@@ -59,11 +59,14 @@ sub store { > } else { > > # If it's not linked, we create a simple biblio and save the biblio id to the 'title' >- my $marc_record = TransformKohaToMarc( >+ my $marc_record = >+ C4::Context->preference('marcflavour') eq 'MARC21' >+ ? $self->_make_simple_marc21_record >+ : TransformKohaToMarc( > { > 'biblio.title' => $self->publication_title, > } >- ); >+ ); > my ($biblio_id) = C4::Biblio::AddBiblio( $marc_record, '', { skip_record_index => 1 } ); > $self->biblio_id($biblio_id); > } >@@ -102,6 +105,80 @@ sub resources { > > =head2 Internal methods > >+ >+=head3 _make_simple_marc21_record >+ >+=cut >+ >+sub _make_simple_marc21_record { >+ my $self = shift; >+ >+ my $marc_record = MARC::Record->new; >+ my $leader = ' nam a22 5 4500'; >+ my $serial_flag; >+ my @fields; >+ $marc_record->insert_fields_ordered( MARC::Field->new( '245', '0', '0', a => $self->publication_title ) ); >+ if ( $self->print_identifier ) { >+ my $standard_number = $self->print_identifier; >+ my $tag = $standard_number =~ s/\d/$&/g >= 10 ? '020' : '022'; >+ $serial_flag = 1 if $tag eq '022'; >+ push @fields, >+ MARC::Field->new( $tag, ' ', ' ', a => $self->print_identifier ); >+ } >+ if ( $self->online_identifier ) { >+ my $standard_number = $self->print_identifier; >+ my $tag = $standard_number =~ s/\d/$&/g >= 10 ? '020' : '022'; >+ $serial_flag = 1 if $tag eq '022'; >+ push @fields, >+ MARC::Field->new( $tag, ' ', ' ', a => $self->online_identifier ); >+ } >+ my $dates_online = ''; >+ if ( $self->date_first_issue_online ) { >+ $dates_online = $self->date_first_issue_online . '-'; >+ } >+ if ( $self->date_last_issue_online ) { >+ $dates_online .= '-' unless $dates_online; >+ $dates_online .= $self->date_last_issue_online; >+ } >+ if ($dates_online) { >+ push @fields, MARC::Field->new( '866', ' ', ' ', a => $dates_online ); >+ >+ } >+ my $volumes_online = ''; >+ if ( $self->num_first_vol_online ) { >+ $volumes_online = $self->num_first_vol_online . '-'; >+ } >+ if ( $self->num_last_vol_online ) { >+ $volumes_online .= '-' unless $volumes_online; >+ $volumes_online .= $self->num_last_vol_online; >+ } >+ if ($volumes_online) { >+ push @fields, MARC::Field->new( '863', ' ', ' ', a => $volumes_online ); >+ } >+ if ( $self->title_url ) { >+ push @fields, >+ MARC::Field->new( '856', '4', ' ', u => $self->title_url ); >+ } >+ if ( $self->first_author ) { >+ push @fields, >+ MARC::Field->new( '100', '1', ' ', a => $self->first_author ); >+ $marc_record->field('245')->set_indicator( '1', '1' ); >+ } >+ if ( $self->notes ) { >+ push @fields, MARC::Field->new( '852', ' ', ' ', z => $self->notes ); >+ } >+ if ( $self->publisher_name ) { >+ push @fields, >+ MARC::Field->new( '260', ' ', ' ', b => $self->publisher_name ); >+ } >+ $marc_record->insert_fields_ordered(@fields); >+ if ($serial_flag) { >+ substr( $leader, 7, 1 ) = 's'; >+ } >+ $marc_record->leader($leader); >+ return $marc_record; >+} >+ > =head3 _type > > =cut >-- >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 35095
:
157504
|
157505
|
180411
| 180418