binmode STDOUT, ':encoding(UTF-8)';
my $repository = C4::OAI::Repository->new();
+
+
+
# __END__ Main Prog
$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;
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
# 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) {
$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;
}
}
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;
);
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) {
}
+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 ) = @_;