From 71160944702fd1e0fea0b840a67c7a4daa9e134a Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Mon, 23 Jun 2014 17:16:50 +1200 Subject: [PATCH] Bug 12252: include item data in OAI-PMH ListRecords result Same in spirit to the other patch, this also includes the item detail in ListRecords. Test plan: * Fetch a URL like: http://koha/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marcxml * Verify that there are 952 entries in the returned records where appropriate. Signed-off-by: Frederic Demians ListRecords OAI verb returns a list of records including items in 952/995 which are not hidden based on OpacHiddenItems syspref. Signed-off-by: Jonathan Druart Signed-off-by: Signed-off-by: Gaetan Boisson Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- opac/oai.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/opac/oai.pl b/opac/oai.pl index 630e53d063..bb6fecb0aa 100755 --- a/opac/oai.pl +++ b/opac/oai.pl @@ -531,8 +531,10 @@ package C4::OAI::ListRecords; use strict; use warnings; +use C4::Biblio; use HTTP::OAI; use C4::OAI::Sets; +use MARC::File::XML; use base ("HTTP::OAI::ListRecords"); @@ -550,7 +552,7 @@ sub new { } my $max = $repository->{koha_max_count}; my $sql = " - (SELECT biblioitems.biblionumber, biblioitems.marcxml, biblioitems.timestamp + SELECT biblioitems.biblionumber, biblioitems.timestamp FROM biblioitems "; $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; @@ -574,7 +576,7 @@ sub new { $sth->execute( @bind_params ); my $count = 0; - while ( my ($biblionumber, $marcxml, $timestamp) = $sth->fetchrow ) { + while ( my ($biblionumber, $timestamp) = $sth->fetchrow ) { $count++; if ( $count > $max ) { $self->resumptionToken( @@ -588,6 +590,8 @@ sub new { ); last; } + my $record = GetMarcBiblio($biblionumber, 1, 1); + my $marcxml = $record->as_xml(); my $oai_sets = GetOAISetsBiblio($biblionumber); my @setSpecs; foreach (@$oai_sets) { -- 2.39.5