Bugzilla – Attachment 35006 Details for
Bug 12252
OAI-PMH GetRecord result doesn't include item data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12252 - OAI-PMH result includes item data
Bug-12252---OAI-PMH-result-includes-item-data.patch (text/plain), 3.48 KB, created by
Jonathan Druart
on 2015-01-07 14:25:14 UTC
(
hide
)
Description:
Bug 12252 - OAI-PMH result includes item data
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-01-07 14:25:14 UTC
Size:
3.48 KB
patch
obsolete
>From 28fff68300004cc5d921ffc9c730abd585664551 Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Wed, 14 May 2014 14:39:03 +1200 >Subject: [PATCH] Bug 12252 - OAI-PMH result includes item data > >GetRecord for OAI-PMH was pulling the MARCXML directly from the >database. Now it uses GetMarcBiblio and includes the item data with it, >making it more generally useful. > >Test plan: >* Run an OAI-PMH query, for example: >http://koha/cgi-bin/koha/oai.pl?verb=GetRecord&identifier=KOHA-OAI-TEST:52&metadataPrefix=marcxml > to fetch biblionumber 52 >* Note that it doesn't include the 952 data >* Apply the patch >* Do the same thing, but this time see that the 952 data is at the > bottom of the MARCXML. > >Note: >* This patch also includes a small tidy-up in C4::Biblios to group > things semantically a bit better, so I don't spend ages looking for a > function that was staring me in the face all along again. > >Signed-off-by: David Cook <dcook@prosentient.com.au> > >Works as described. Simple yet useful patch. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> > >952/995 item fields are back in response to GetRecord OAI verb. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Biblio.pm | 16 ++++++++-------- > opac/oai.pl | 12 +++++++++--- > 2 files changed, 17 insertions(+), 11 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 8bdb25f..e7abd7b 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -57,13 +57,14 @@ BEGIN { > > # to get something > push @EXPORT, qw( >- &GetBiblio >- &GetBiblioData >- &GetBiblioItemData >- &GetBiblioItemInfosOf >- &GetBiblioItemByBiblioNumber >- &GetBiblioFromItemNumber >- &GetBiblionumberFromItemnumber >+ GetBiblio >+ GetBiblioData >+ GetMarcBiblio >+ GetBiblioItemData >+ GetBiblioItemInfosOf >+ GetBiblioItemByBiblioNumber >+ GetBiblioFromItemNumber >+ GetBiblionumberFromItemnumber > > &GetRecordValue > &GetFieldMapping >@@ -77,7 +78,6 @@ BEGIN { > &GetMarcISBN > &GetMarcISSN > &GetMarcSubjects >- &GetMarcBiblio > &GetMarcAuthors > &GetMarcSeries > &GetMarcHosts >diff --git a/opac/oai.pl b/opac/oai.pl >index b453408..b580a27 100755 >--- a/opac/oai.pl >+++ b/opac/oai.pl >@@ -247,7 +247,9 @@ package C4::OAI::GetRecord; > use strict; > use warnings; > use HTTP::OAI; >+use C4::Biblio; > use C4::OAI::Sets; >+use MARC::File::XML; > > use base ("HTTP::OAI::GetRecord"); > >@@ -259,14 +261,14 @@ sub new { > > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare(" >- SELECT marcxml, timestamp >+ SELECT timestamp > FROM biblioitems > WHERE biblionumber=? " ); > my $prefix = $repository->{koha_identifier} . ':'; > my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; > $sth->execute( $biblionumber ); >- my ($marcxml, $timestamp); >- unless ( ($marcxml, $timestamp) = $sth->fetchrow ) { >+ my ($timestamp); >+ unless ( ($timestamp) = $sth->fetchrow ) { > return HTTP::OAI::Response->new( > requestURL => $repository->self_url(), > errors => [ new HTTP::OAI::Error( >@@ -276,6 +278,10 @@ sub new { > ); > } > >+ # We fetch it using this method, rather than the database directly, >+ # so it'll include the item data >+ my $record = GetMarcBiblio($biblionumber, 1); >+ my $marcxml = $record->as_xml(); > my $oai_sets = GetOAISetsBiblio($biblionumber); > my @setSpecs; > foreach (@$oai_sets) { >-- >2.1.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 12252
:
28228
|
28229
|
28243
|
28344
|
28345
|
29159
|
29160
|
33120
|
33121
|
33122
|
34890
|
35006
|
35007
|
35008
|
35009
|
35010
|
35011
|
41135
|
41136
|
41137
|
41138
|
41139
|
41140
|
41175
|
41176
|
41177
|
41178
|
41179
|
41180
|
42018
|
42019
|
42020
|
42021
|
42022
|
42023
|
42024
|
42314
|
42575
|
42576
|
42577
|
42578
|
42579
|
42580
|
42581