Lines 247-253
package C4::OAI::GetRecord;
Link Here
|
247 |
use strict; |
247 |
use strict; |
248 |
use warnings; |
248 |
use warnings; |
249 |
use HTTP::OAI; |
249 |
use HTTP::OAI; |
|
|
250 |
use C4::Biblio; |
250 |
use C4::OAI::Sets; |
251 |
use C4::OAI::Sets; |
|
|
252 |
use MARC::File::XML; |
251 |
|
253 |
|
252 |
use base ("HTTP::OAI::GetRecord"); |
254 |
use base ("HTTP::OAI::GetRecord"); |
253 |
|
255 |
|
Lines 259-272
sub new {
Link Here
|
259 |
|
261 |
|
260 |
my $dbh = C4::Context->dbh; |
262 |
my $dbh = C4::Context->dbh; |
261 |
my $sth = $dbh->prepare(" |
263 |
my $sth = $dbh->prepare(" |
262 |
SELECT marcxml, timestamp |
264 |
SELECT timestamp |
263 |
FROM biblioitems |
265 |
FROM biblioitems |
264 |
WHERE biblionumber=? " ); |
266 |
WHERE biblionumber=? " ); |
265 |
my $prefix = $repository->{koha_identifier} . ':'; |
267 |
my $prefix = $repository->{koha_identifier} . ':'; |
266 |
my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; |
268 |
my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; |
267 |
$sth->execute( $biblionumber ); |
269 |
$sth->execute( $biblionumber ); |
268 |
my ($marcxml, $timestamp); |
270 |
my ($timestamp); |
269 |
unless ( ($marcxml, $timestamp) = $sth->fetchrow ) { |
271 |
unless ( ($timestamp) = $sth->fetchrow ) { |
270 |
return HTTP::OAI::Response->new( |
272 |
return HTTP::OAI::Response->new( |
271 |
requestURL => $repository->self_url(), |
273 |
requestURL => $repository->self_url(), |
272 |
errors => [ new HTTP::OAI::Error( |
274 |
errors => [ new HTTP::OAI::Error( |
Lines 276-281
sub new {
Link Here
|
276 |
); |
278 |
); |
277 |
} |
279 |
} |
278 |
|
280 |
|
|
|
281 |
# We fetch it using this method, rather than the database directly, |
282 |
# so it'll include the item data |
283 |
my $record = GetMarcBiblio($biblionumber, 1); |
284 |
my $marcxml = $record->as_xml(); |
279 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
285 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
280 |
my @setSpecs; |
286 |
my @setSpecs; |
281 |
foreach (@$oai_sets) { |
287 |
foreach (@$oai_sets) { |
282 |
- |
|
|