Bugzilla – Attachment 171100 Details for
Bug 37380
Move GetMarcControlnumber to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37380: Add get_control_number() to the metadata extractor
Bug-37380-Add-getcontrolnumber-to-the-metadata-ext.patch (text/plain), 1.52 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-09-05 18:45:12 UTC
(
hide
)
Description:
Bug 37380: Add get_control_number() to the metadata extractor
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-09-05 18:45:12 UTC
Size:
1.52 KB
patch
obsolete
>From 3872b00a3d97269da49bff8650f434740235fe4a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 16 Jul 2024 15:21:04 -0300 >Subject: [PATCH] Bug 37380: Add get_control_number() to the metadata extractor > >This simple patch implements C4::Biblio::GetMarcControlnumber in the >right spot on the Koha::* namespace. > >To test: >1. Apply this patches >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > Koha/Biblio/Metadata/Extractor/MARC.pm | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > >diff --git a/Koha/Biblio/Metadata/Extractor/MARC.pm b/Koha/Biblio/Metadata/Extractor/MARC.pm >index ceaabf2aa19..99e3f6032c5 100644 >--- a/Koha/Biblio/Metadata/Extractor/MARC.pm >+++ b/Koha/Biblio/Metadata/Extractor/MARC.pm >@@ -76,6 +76,30 @@ sub metadata { > return $self->{metadata}; > } > >+=head2 get_control_number >+ >+ my $control_number = $extractor->get_control_number(); >+ >+Returns the control number/record identifier as extracted from the metadata. >+It returns an empty string if no 001 present or if undef. >+ >+=cut >+ >+sub get_control_number { >+ my ($self) = @_; >+ >+ my $record = $self->metadata; >+ my $field = $record->field('001'); >+ >+ my $control_number = q{}; >+ >+ if ($field) { >+ $control_number = $field->data() // q{}; >+ } >+ >+ return $control_number; >+} >+ > =head3 _normalize_string > > my $normalized_string = $self->_normalize_string($string); >-- >2.46.0
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 37380
:
169058
|
169059
|
169060
|
169777
|
169778
|
169779
|
171099
|
171100
|
171101
|
171189
|
171190
|
171191