View | Details | Raw Unified | Return to bug 12252
Collapse All | Expand All

(-)a/C4/Biblio.pm (-8 / +8 lines)
Lines 57-69 BEGIN { Link Here
57
57
58
    # to get something
58
    # to get something
59
    push @EXPORT, qw(
59
    push @EXPORT, qw(
60
      &GetBiblio
60
      GetBiblio
61
      &GetBiblioData
61
      GetBiblioData
62
      &GetBiblioItemData
62
      GetMarcBiblio
63
      &GetBiblioItemInfosOf
63
      GetBiblioItemData
64
      &GetBiblioItemByBiblioNumber
64
      GetBiblioItemInfosOf
65
      &GetBiblioFromItemNumber
65
      GetBiblioItemByBiblioNumber
66
      &GetBiblionumberFromItemnumber
66
      GetBiblioFromItemNumber
67
      GetBiblionumberFromItemnumber
67
68
68
      &GetRecordValue
69
      &GetRecordValue
69
      &GetFieldMapping
70
      &GetFieldMapping
Lines 77-83 BEGIN { Link Here
77
      &GetMarcISBN
78
      &GetMarcISBN
78
      &GetMarcISSN
79
      &GetMarcISSN
79
      &GetMarcSubjects
80
      &GetMarcSubjects
80
      &GetMarcBiblio
81
      &GetMarcAuthors
81
      &GetMarcAuthors
82
      &GetMarcSeries
82
      &GetMarcSeries
83
      &GetMarcHosts
83
      &GetMarcHosts
(-)a/opac/oai.pl (-26 / +36 lines)
Lines 288-294 package C4::OAI::GetRecord; Link Here
288
use strict;
288
use strict;
289
use warnings;
289
use warnings;
290
use HTTP::OAI;
290
use HTTP::OAI;
291
use C4::Biblio;
291
use C4::OAI::Sets;
292
use C4::OAI::Sets;
293
use MARC::File::XML;
292
294
293
use base ("HTTP::OAI::GetRecord");
295
use base ("HTTP::OAI::GetRecord");
294
296
Lines 299-329 sub new { Link Here
299
    my $self = HTTP::OAI::GetRecord->new(%args);
301
    my $self = HTTP::OAI::GetRecord->new(%args);
300
302
301
    my $dbh = C4::Context->dbh;
303
    my $dbh = C4::Context->dbh;
304
    my $sth = $dbh->prepare("
305
        SELECT timestamp
306
        FROM   biblioitems
307
        WHERE  biblionumber=? " );
302
    my $prefix = $repository->{koha_identifier} . ':';
308
    my $prefix = $repository->{koha_identifier} . ':';
303
    my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/;
309
    my ($biblionumber) = $args{identifier} =~ /^$prefix(.*)/;
304
    my ($marcxml, $timestamp);
310
    $sth->execute( $biblionumber );
305
    my $deleted = 0;
311
    my ($timestamp);
306
    unless ( ($marcxml, $timestamp) = $dbh->selectrow_array(q/
312
    unless ( ($timestamp) = $sth->fetchrow ) {
307
        SELECT marcxml, timestamp
313
        unless ( ($timestamp) = $dbh->selectrow_array(q/
308
        FROM   biblioitems
314
            SELECT timestamp
309
        WHERE  biblionumber=? /, undef, $biblionumber)) {
315
            FROM deletedbiblio
310
316
            WHERE biblionumber=? /, undef, $biblionumber ))
311
      unless ( ($marcxml, $timestamp) = $dbh->selectrow_array(q/
317
        {
312
          SELECT biblionumber, timestamp
318
            return HTTP::OAI::Response->new(
313
          FROM deletedbiblio
319
             requestURL  => $repository->self_url(),
314
          WHERE biblionumber=? /, undef, $biblionumber )) {
320
             errors      => [ new HTTP::OAI::Error(
315
316
317
        return HTTP::OAI::Response->new(
318
            requestURL  => $repository->self_url(),
319
            errors      => [ new HTTP::OAI::Error(
320
                code    => 'idDoesNotExist',
321
                code    => 'idDoesNotExist',
321
                message => "There is no biblio record with this identifier",
322
                message => "There is no biblio record with this identifier",
322
                ) ] ,
323
                ) ],
323
        );
324
            );
324
      } else {
325
        }
325
        $deleted = 1;
326
        else {
326
      }
327
            $deleted = 1;
328
        }
329
    }
330
331
    # We fetch it using this method, rather than the database directly,
332
    # so it'll include the item data
333
    my $marcxml;
334
    unless ($deleted) {
335
        my $record = GetMarcBiblio($biblionumber, 1);
336
        $marcxml = $record->as_xml();
327
    }
337
    }
328
    my $oai_sets = GetOAISetsBiblio($biblionumber);
338
    my $oai_sets = GetOAISetsBiblio($biblionumber);
329
    my @setSpecs;
339
    my @setSpecs;
Lines 332-341 sub new { Link Here
332
    }
342
    }
333
343
334
    #$self->header( HTTP::OAI::Header->new( identifier  => $args{identifier} ) );
344
    #$self->header( HTTP::OAI::Header->new( identifier  => $args{identifier} ) );
335
    ($deleted == 1) ? $self->record( C4::OAI::DeletedRecord->new(
345
    $self->record(
336
        $timestamp, \@setSpecs, %args ) )
346
        $deleted
337
        : $self->record( C4::OAI::Record->new(
347
        ? C4::OAI::DeletedRecord->new($timestamp, \@setSpecs, %args)
338
        $repository, $marcxml, $timestamp, \@setSpecs, %args ) );
348
        : C4::OAI::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args);
349
    );
339
    return $self;
350
    return $self;
340
}
351
}
341
352
342
- 

Return to bug 12252