Lines 61-66
else {
Link Here
|
61 |
binmode STDOUT, ':encoding(UTF-8)'; |
61 |
binmode STDOUT, ':encoding(UTF-8)'; |
62 |
my $repository = C4::OAI::Repository->new(); |
62 |
my $repository = C4::OAI::Repository->new(); |
63 |
|
63 |
|
|
|
64 |
|
65 |
|
66 |
|
64 |
# __END__ Main Prog |
67 |
# __END__ Main Prog |
65 |
|
68 |
|
66 |
|
69 |
|
Lines 103-109
sub new {
Link Here
|
103 |
$from .= 'T00:00:00Z' if length($from) == 10; |
106 |
$from .= 'T00:00:00Z' if length($from) == 10; |
104 |
$until .= 'T23:59:59Z' if length($until) == 10; |
107 |
$until .= 'T23:59:59Z' if length($until) == 10; |
105 |
$offset = $args{ offset } || 0; |
108 |
$offset = $args{ offset } || 0; |
106 |
$set = $args{set}; |
109 |
$set = $args{set} || ''; |
107 |
} |
110 |
} |
108 |
|
111 |
|
109 |
$self->{ metadata_prefix } = $metadata_prefix; |
112 |
$self->{ metadata_prefix } = $metadata_prefix; |
Lines 308-314
sub new {
Link Here
|
308 |
my $prefix = $repository->{koha_identifier} . ':'; |
311 |
my $prefix = $repository->{koha_identifier} . ':'; |
309 |
my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; |
312 |
my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/; |
310 |
$sth->execute( $biblionumber ); |
313 |
$sth->execute( $biblionumber ); |
311 |
my ($timestamp); |
314 |
my ($timestamp, $deleted); |
312 |
unless ( ($timestamp) = $sth->fetchrow ) { |
315 |
unless ( ($timestamp) = $sth->fetchrow ) { |
313 |
unless ( ($timestamp) = $dbh->selectrow_array(q/ |
316 |
unless ( ($timestamp) = $dbh->selectrow_array(q/ |
314 |
SELECT timestamp |
317 |
SELECT timestamp |
Lines 331-340
sub new {
Link Here
|
331 |
# We fetch it using this method, rather than the database directly, |
334 |
# We fetch it using this method, rather than the database directly, |
332 |
# so it'll include the item data |
335 |
# so it'll include the item data |
333 |
my $marcxml; |
336 |
my $marcxml; |
334 |
unless ($deleted) { |
337 |
$marcxml = $repository->get_biblio_marcxml->($biblionumber, $args{metadataPrefix}) |
335 |
my $record = GetMarcBiblio($biblionumber, 1); |
338 |
unless $deleted; |
336 |
$marcxml = $record->as_xml(); |
|
|
337 |
} |
338 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
339 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
339 |
my @setSpecs; |
340 |
my @setSpecs; |
340 |
foreach (@$oai_sets) { |
341 |
foreach (@$oai_sets) { |
Lines 345-351
sub new {
Link Here
|
345 |
$self->record( |
346 |
$self->record( |
346 |
$deleted |
347 |
$deleted |
347 |
? C4::OAI::DeletedRecord->new($timestamp, \@setSpecs, %args) |
348 |
? C4::OAI::DeletedRecord->new($timestamp, \@setSpecs, %args) |
348 |
: C4::OAI::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args); |
349 |
: C4::OAI::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args) |
349 |
); |
350 |
); |
350 |
return $self; |
351 |
return $self; |
351 |
} |
352 |
} |
Lines 552-558
sub new {
Link Here
|
552 |
} |
553 |
} |
553 |
my $max = $repository->{koha_max_count}; |
554 |
my $max = $repository->{koha_max_count}; |
554 |
my $sql = " |
555 |
my $sql = " |
555 |
SELECT biblioitems.biblionumber, biblioitems.timestamp |
556 |
(SELECT biblioitems.biblionumber, biblioitems.timestamp, marcxml |
556 |
FROM biblioitems |
557 |
FROM biblioitems |
557 |
"; |
558 |
"; |
558 |
$sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; |
559 |
$sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; |
Lines 590-597
sub new {
Link Here
|
590 |
); |
591 |
); |
591 |
last; |
592 |
last; |
592 |
} |
593 |
} |
593 |
my $record = GetMarcBiblio($biblionumber, 1, 1); |
594 |
my $marcxml = $repository->get_biblio_marcxml($biblionumber, $args{metadataPrefix}); |
594 |
my $marcxml = $record->as_xml(); |
|
|
595 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
595 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
596 |
my @setSpecs; |
596 |
my @setSpecs; |
597 |
foreach (@$oai_sets) { |
597 |
foreach (@$oai_sets) { |
Lines 710-715
sub new {
Link Here
|
710 |
} |
710 |
} |
711 |
|
711 |
|
712 |
|
712 |
|
|
|
713 |
sub get_biblio_marcxml { |
714 |
my ($self, $biblionumber, $format) = @_; |
715 |
my $with_items = 0; |
716 |
if ( my $conf = $self->{conf} ) { |
717 |
$with_items = $conf->{format}->{$format}->{include_items}; |
718 |
} |
719 |
my $record = GetMarcBiblio($biblionumber, $with_items, 1); |
720 |
$record ? $record->as_xml() : undef; |
721 |
} |
722 |
|
723 |
|
713 |
sub stylesheet { |
724 |
sub stylesheet { |
714 |
my ( $self, $format ) = @_; |
725 |
my ( $self, $format ) = @_; |
715 |
|
726 |
|
716 |
- |
|
|