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

(-)a/Koha/OAI/Server/GetRecord.pm (-4 / +6 lines)
Lines 98-111 sub new { Link Here
98
        push @setSpecs, $_->{spec};
98
        push @setSpecs, $_->{spec};
99
    }
99
    }
100
100
101
    if ($deleted) {
101
    #NOTE: Show a deleted record if there is no metadata
102
    # We fetch it using this method, rather than the database directly,
103
    # so it'll include the item data
104
    my ( $marcxml, $marcxml_error ) =
105
        $deleted ? undef : $repository->get_biblio_marcxml( $biblionumber, $args{metadataPrefix} );
106
    if ( !$marcxml ) {
102
        $self->record(
107
        $self->record(
103
            Koha::OAI::Server::DeletedRecord->new($timestamp, \@setSpecs, %args)
108
            Koha::OAI::Server::DeletedRecord->new($timestamp, \@setSpecs, %args)
104
        );
109
        );
105
    } else {
110
    } else {
106
        # We fetch it using this method, rather than the database directly,
107
        # so it'll include the item data
108
        my ( $marcxml, $marcxml_error ) = $repository->get_biblio_marcxml( $biblionumber, $args{metadataPrefix} );
109
        $args{about} = [$marcxml_error] if $marcxml_error;
111
        $args{about} = [$marcxml_error] if $marcxml_error;
110
        $self->record(
112
        $self->record(
111
            Koha::OAI::Server::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args)
113
            Koha::OAI::Server::Record->new($repository, $marcxml, $timestamp, \@setSpecs, %args)
(-)a/Koha/OAI/Server/ListBase.pm (-1 / +9 lines)
Lines 187-198 sub GetRecords { Link Here
187
                    );
187
                    );
188
                }
188
                }
189
            } else {
189
            } else {
190
                #NOTE: Show a deleted record if there is no metadata
191
                my $deleted_status = ($deleted) ? 'deleted' : undef;
192
                if ( !$deleted_status ) {
193
                    my ( $marcxml, $marcxml_error ) = $repository->get_biblio_marcxml( $biblionumber, $format );
194
                    if ( !$marcxml ) {
195
                        $deleted_status = 'deleted';
196
                    }
197
                }
190
                $timestamp =~ s/ /T/;
198
                $timestamp =~ s/ /T/;
191
                $timestamp .= 'Z';
199
                $timestamp .= 'Z';
192
                $self->identifier( HTTP::OAI::Header->new(
200
                $self->identifier( HTTP::OAI::Header->new(
193
                    identifier => $repository->{ koha_identifier} . ':' . $biblionumber,
201
                    identifier => $repository->{ koha_identifier} . ':' . $biblionumber,
194
                    datestamp  => $timestamp,
202
                    datestamp  => $timestamp,
195
                    status     => $deleted ? 'deleted' : undef,
203
                    status     => $deleted_status,
196
                ) );
204
                ) );
197
            }
205
            }
198
        }
206
        }
(-)a/Koha/OAI/Server/Repository.pm (-1 / +13 lines)
Lines 193-198 sub get_biblio_marcxml { Link Here
193
        $decoding_error = "INVALID_METADATA";
193
        $decoding_error = "INVALID_METADATA";
194
        $record         = $biblio->metadata->record_strip_nonxml( { embed_items => $with_items, opac => 1 } );
194
        $record         = $biblio->metadata->record_strip_nonxml( { embed_items => $with_items, opac => 1 } );
195
    }
195
    }
196
    if ($record) {
197
198
        #FIXME: Syspref this?
199
        my $hide_record = 1;
200
        if ($hide_record) {
201
            my $rules = C4::Context->yaml_preference('OpacHiddenItems') // {};
202
            if ( $biblio->hidden_in_opac( { rules => $rules } ) ) {
203
                return;
204
            }
205
206
            #TODO: Also hide record if OpacSuppression is in use
207
        }
208
    }
196
    if ( $record && $expanded_avs ) {
209
    if ( $record && $expanded_avs ) {
197
        my $frameworkcode = GetFrameworkCode($biblionumber) || '';
210
        my $frameworkcode = GetFrameworkCode($biblionumber) || '';
198
        my $record_processor = Koha::RecordProcessor->new(
211
        my $record_processor = Koha::RecordProcessor->new(
199
- 

Return to bug 31161