Bugzilla – Attachment 42580 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 Include item data only in extended mode
Bug-12252-Include-item-data-only-in-extended-mode.patch (text/plain), 4.29 KB, created by
Jonathan Druart
on 2015-09-16 09:53:24 UTC
(
hide
)
Description:
Bug 12252 Include item data only in extended mode
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-09-16 09:53:24 UTC
Size:
4.29 KB
patch
obsolete
>From 03e3041501bd11723822bb38602178552f29e389 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians@tamil.fr> >Date: Thu, 23 Jul 2015 18:38:25 +0200 >Subject: [PATCH] Bug 12252 Include item data only in extended mode > >Previous patches attached to this bug have been refactored to merge bug >3206 and bug 13568 features. So OAI server must be carrefully tested to >ensure that there is no regression in this area: deleted records and >resumption token. > >This last patch fixed the way items are returned. They are returned only >if OAI server operates in extended mode, and specifically for format >having the parameter include_item set to 1 (true). For example this >configuration file set via OAI-PMH:ConfFile syspref will return items: > >Signed-off-by: Signed-off-by: Gaetan Boisson <gaetan.boisson@biblibre.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Biblio.pm | 1 + > opac/oai.pl | 31 +++++++++++++++++++++---------- > 2 files changed, 22 insertions(+), 10 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 191e9c7..9b83962 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1276,6 +1276,7 @@ OpacHiddenItems to be applied. > sub GetMarcBiblio { > my $biblionumber = shift; > my $embeditems = shift || 0; >+ my $opac = shift || 0; > > if (not defined $biblionumber) { > carp 'GetMarcBiblio called with undefined biblionumber'; >diff --git a/opac/oai.pl b/opac/oai.pl >index bb6fecb..875801b 100755 >--- a/opac/oai.pl >+++ b/opac/oai.pl >@@ -61,6 +61,9 @@ else { > binmode STDOUT, ':encoding(UTF-8)'; > my $repository = C4::OAI::Repository->new(); > >+ >+ >+ > # __END__ Main Prog > > >@@ -103,7 +106,7 @@ sub new { > $from .= 'T00:00:00Z' if length($from) == 10; > $until .= 'T23:59:59Z' if length($until) == 10; > $offset = $args{ offset } || 0; >- $set = $args{set}; >+ $set = $args{set} || ''; > } > > $self->{ metadata_prefix } = $metadata_prefix; >@@ -308,7 +311,7 @@ sub new { > my $prefix = $repository->{koha_identifier} . ':'; > my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; > $sth->execute( $biblionumber ); >- my ($timestamp); >+ my ($timestamp, $deleted); > unless ( ($timestamp) = $sth->fetchrow ) { > unless ( ($timestamp) = $dbh->selectrow_array(q/ > SELECT timestamp >@@ -331,10 +334,8 @@ sub new { > # We fetch it using this method, rather than the database directly, > # so it'll include the item data > my $marcxml; >- unless ($deleted) { >- my $record = GetMarcBiblio($biblionumber, 1); >- $marcxml = $record->as_xml(); >- } >+ $marcxml = $repository->get_biblio_marcxml->($biblionumber, $args{metadataPrefix}) >+ unless $deleted; > my $oai_sets = GetOAISetsBiblio($biblionumber); > my @setSpecs; > foreach (@$oai_sets) { >@@ -345,7 +346,7 @@ sub new { > $self->record( > $deleted > ? C4::OAI::DeletedRecord->new($timestamp, \@setSpecs, %args) >- : C4::OAI::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args); >+ : C4::OAI::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args) > ); > return $self; > } >@@ -552,7 +553,7 @@ sub new { > } > my $max = $repository->{koha_max_count}; > my $sql = " >- SELECT biblioitems.biblionumber, biblioitems.timestamp >+ (SELECT biblioitems.biblionumber, biblioitems.timestamp, marcxml > FROM biblioitems > "; > $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; >@@ -590,8 +591,7 @@ sub new { > ); > last; > } >- my $record = GetMarcBiblio($biblionumber, 1, 1); >- my $marcxml = $record->as_xml(); >+ my $marcxml = $repository->get_biblio_marcxml($biblionumber, $args{metadataPrefix}); > my $oai_sets = GetOAISetsBiblio($biblionumber); > my @setSpecs; > foreach (@$oai_sets) { >@@ -710,6 +710,17 @@ sub new { > } > > >+sub get_biblio_marcxml { >+ my ($self, $biblionumber, $format) = @_; >+ my $with_items = 0; >+ if ( my $conf = $self->{conf} ) { >+ $with_items = $conf->{format}->{$format}->{include_items}; >+ } >+ my $record = GetMarcBiblio($biblionumber, $with_items, 1); >+ $record ? $record->as_xml() : undef; >+} >+ >+ > sub stylesheet { > my ( $self, $format ) = @_; > >-- >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