Bugzilla – Attachment 168821 Details for
Bug 29560
Add option to create MARC links when adding items to bundles
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29560: Add link_marc_host to Koha::Biblio
Bug-29560-Add-linkmarchost-to-KohaBiblio.patch (text/plain), 5.06 KB, created by
Martin Renvoize (ashimema)
on 2024-07-11 13:34:51 UTC
(
hide
)
Description:
Bug 29560: Add link_marc_host to Koha::Biblio
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-07-11 13:34:51 UTC
Size:
5.06 KB
patch
obsolete
>From 68324c5315f0779c3b8b2e60078046745ae55404 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 18 May 2022 08:23:19 +0100 >Subject: [PATCH] Bug 29560: Add link_marc_host to Koha::Biblio > >This patch adds the new `link_marc_host` method to Koha::Biblio to >facilitate adding a host link to the marc record of this biblio. > >Signed-off-by: Tuomas Kunttu <tuomas.kunttu@kouvola.fi> >--- > Koha/Biblio.pm | 160 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 160 insertions(+) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index ad1807eef1e..614406d2041 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -1764,6 +1764,166 @@ sub get_marc_hostinfo_only { > return $hostinfo; > } > >+=head3 link_marc_host >+ >+=cut >+ >+sub link_marc_host { >+ my ( $self, $params ) = @_; >+ >+ my $host = Koha::Biblios->find( $params->{biblionumber} ); >+ return unless $host; >+ >+ my $marcflavour = C4::Context->preference('marcflavour'); >+ my $marc_host = $host->metadata->record; >+ my %sfd; >+ my $field; >+ my $host_field; >+ >+ if ( $marcflavour eq 'MARC21' ) { >+ # Author >+ if ( $field = >+ $marc_host->field('100') || $marc_host->field('110') || $marc_host->field('111') ) >+ { >+ my $s = $field->as_string('ab'); >+ if ($s) { >+ $sfd{a} = $s; >+ } >+ } >+ # Title >+ if ( $field = $marc_host->field('245') ) { >+ my $s = $field->as_string('ab'); >+ if ($s) { >+ $sfd{t} = $s; >+ } >+ } >+ # Uniform title >+ if ( $field = $marc_host->field('240') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{s} = $s; >+ } >+ } >+ # Publication >+ if ( $field = $marc_host->field('260') ) { >+ my $s = $field->as_string('abc'); >+ if ($s) { >+ $sfd{d} = $s; >+ } >+ } >+ # Edition >+ if ( $field = $marc_host->field('250') ) { >+ my $s = $field->as_string('ab'); >+ if ($s) { >+ $sfd{b} = $s; >+ } >+ } >+ # ISSN >+ if ( $field = $marc_host->field('022') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{x} = $s; >+ } >+ } >+ # ISBN >+ if ( $field = $marc_host->field('020') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{z} = $s; >+ } >+ } >+ if ( C4::Context->preference('UseControlNumber') ) { >+ # Control number >+ if ( $field = $marc_host->field('001') ) { >+ $sfd{w} = $field->data(),; >+ } >+ # Control number identifier >+ if ( $field = $marc_host->field('003') ) { >+ $sfd{w} = '('.$field->data().')'.$sfd{w}; >+ } >+ } >+ $host_field = MARC::Field->new( 773, '0', ' ', %sfd ); >+ } >+ elsif ( $marcflavour eq 'UNIMARC' ) { >+ >+ #author >+ if ( $field = >+ $marc_host->field('700') || $marc_host->field('710') || $marc_host->field('720') ) >+ { >+ my $s = $field->as_string('ab'); >+ if ($s) { >+ $sfd{a} = $s; >+ } >+ } >+ >+ #title >+ if ( $field = $marc_host->field('200') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{t} = $s; >+ } >+ } >+ >+ #place of publicaton >+ if ( $field = $marc_host->field('210') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{c} = $s; >+ } >+ } >+ >+ #date of publication >+ if ( $field = $marc_host->field('210') ) { >+ my $s = $field->as_string('d'); >+ if ($s) { >+ $sfd{d} = $s; >+ } >+ } >+ >+ #edition statement >+ if ( $field = $marc_host->field('205') ) { >+ my $s = $field->as_string(); >+ if ($s) { >+ $sfd{e} = $s; >+ } >+ } >+ >+ #URL >+ if ( $field = $marc_host->field('856') ) { >+ my $s = $field->as_string('u'); >+ if ($s) { >+ $sfd{u} = $s; >+ } >+ } >+ >+ #ISSN >+ if ( $field = $marc_host->field('011') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{x} = $s; >+ } >+ } >+ >+ #ISBN >+ if ( $field = $marc_host->field('010') ) { >+ my $s = $field->as_string('a'); >+ if ($s) { >+ $sfd{y} = $s; >+ } >+ } >+ if ( $field = $marc_host->field('001') ) { >+ $sfd{0} = $field->data(),; >+ } >+ $host_field = MARC::Field->new( 461, '0', ' ', %sfd ); >+ } >+ >+ my $marc_record = $self->metadata->record; >+ $marc_record->append_fields($host_field); >+ >+ C4::Biblio::ModBiblioMarc($marc_record, $self->biblionumber); >+ return $self; >+} >+ > =head3 recalls > > my $recalls = $biblio->recalls; >-- >2.45.2
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 29560
:
135090
|
135091
|
137509
|
137510
|
156299
|
156300
|
159081
|
159082
|
168720
|
168721
|
168722
|
168723
|
168816
|
168817
|
168818
|
168819
|
168820
|
168821
|
168822
|
168823
|
168824
|
168825
|
168885
|
168886
|
168887
|
168888
|
168889
|
168968