@@ -, +, @@ --- opac/oai.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/opac/oai.pl +++ a/opac/oai.pl @@ -259,14 +259,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 ) { + unless ( ($timestamp) = $sth->fetchrow ) { return HTTP::OAI::Response->new( requestURL => $repository->self_url(), errors => [ new HTTP::OAI::Error( @@ -275,6 +275,8 @@ sub new { ) ] , ); } + my $record = C4::Biblio::GetMarcBiblio( $biblionumber, 1); + $marcxml = C4::Record::marc2marcxml( $record ); my $oai_sets = GetOAISetsBiblio($biblionumber); my @setSpecs; @@ -452,6 +454,7 @@ use strict; use warnings; use HTTP::OAI; use C4::OAI::Sets; +use C4::Record; use base ("HTTP::OAI::ListRecords"); @@ -468,7 +471,7 @@ sub new { $set = GetOAISetBySpec($token->{'set'}); } 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; @@ -485,12 +488,14 @@ sub new { $sth->execute( @bind_params ); my $pos = $token->{offset}; - while ( my ($biblionumber, $marcxml, $timestamp) = $sth->fetchrow ) { + while ( my ($biblionumber, $timestamp) = $sth->fetchrow ) { my $oai_sets = GetOAISetsBiblio($biblionumber); my @setSpecs; foreach (@$oai_sets) { push @setSpecs, $_->{spec}; } + my $record = C4::Biblio::GetMarcBiblio( $biblionumber, 1 ); + $marcxml = C4::Record::marc2marcxml( $record ); $self->record( C4::OAI::Record->new( $repository, $marcxml, $timestamp, \@setSpecs, identifier => $repository->{ koha_identifier } . ':' . $biblionumber, --