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 544-550
sub new {
Link Here
|
544 |
} |
545 |
} |
545 |
my $max = $repository->{koha_max_count}; |
546 |
my $max = $repository->{koha_max_count}; |
546 |
my $sql = " |
547 |
my $sql = " |
547 |
SELECT biblioitems.biblionumber, biblioitems.timestamp |
548 |
(SELECT biblioitems.biblionumber, biblioitems.timestamp, marcxml |
548 |
FROM biblioitems |
549 |
FROM biblioitems |
549 |
"; |
550 |
"; |
550 |
$sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; |
551 |
$sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set; |
Lines 582-589
sub new {
Link Here
|
582 |
); |
583 |
); |
583 |
last; |
584 |
last; |
584 |
} |
585 |
} |
585 |
my $record = GetMarcBiblio($biblionumber, 1, 1); |
586 |
my $marcxml = $repository->get_biblio_marcxml($biblionumber, $args{metadataPrefix}); |
586 |
my $marcxml = $record->as_xml(); |
|
|
587 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
587 |
my $oai_sets = GetOAISetsBiblio($biblionumber); |
588 |
my @setSpecs; |
588 |
my @setSpecs; |
589 |
foreach (@$oai_sets) { |
589 |
foreach (@$oai_sets) { |
Lines 694-699
sub new {
Link Here
|
694 |
} |
694 |
} |
695 |
|
695 |
|
696 |
|
696 |
|
|
|
697 |
sub get_biblio_marcxml { |
698 |
my ($self, $biblionumber, $format) = @_; |
699 |
my $with_items = 0; |
700 |
if ( my $conf = $self->{conf} ) { |
701 |
$with_items = $conf->{format}->{$format}->{include_items}; |
702 |
} |
703 |
my $record = GetMarcBiblio($biblionumber, $with_items, 1); |
704 |
$record ? $record->as_xml() : undef; |
705 |
} |
706 |
|
707 |
|
697 |
sub stylesheet { |
708 |
sub stylesheet { |
698 |
my ( $self, $format ) = @_; |
709 |
my ( $self, $format ) = @_; |
699 |
|
710 |
|
700 |
- |
|
|