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

(-)a/Koha/REST/V1/Biblios.pm (-20 / +5 lines)
Lines 22-28 use Mojo::Base 'Mojolicious::Controller'; Link Here
22
use Koha::Biblios;
22
use Koha::Biblios;
23
use Koha::DateUtils;
23
use Koha::DateUtils;
24
use Koha::Ratings;
24
use Koha::Ratings;
25
use Koha::RecordProcessor;
26
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio );
25
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio );
27
use C4::Search qw( FindDuplicate );
26
use C4::Search qw( FindDuplicate );
28
27
Lines 162-193 sub get_public { Link Here
162
161
163
    return try {
162
    return try {
164
163
165
        my $metadata = $biblio->metadata;
164
        my $schema = $biblio->metadata->schema // C4::Context->preference("marcflavour");
166
        my $record   = $metadata->record;
167
168
        my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems');
169
        my $patron = $c->stash('koha.user');
165
        my $patron = $c->stash('koha.user');
170
166
171
        # Check if the biblio should be hidden for unprivileged access
167
        # Check if the bibliographic record should be hidden for unprivileged access
172
        # unless there's a logged in user, and there's an exception for it's
168
        # unless there's a logged in user, and there's an exception for it's category
173
        # category
169
        my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems');
174
        unless ( $patron and $patron->category->override_hidden_items ) {
170
        unless ( $patron and $patron->category->override_hidden_items ) {
175
            if ( $biblio->hidden_in_opac( { rules => $opachiddenitems_rules } ) ) {
171
            if ( $biblio->hidden_in_opac( { rules => $opachiddenitems_rules } ) ) {
176
                return $c->render_resource_not_found("Bibliographic record");
172
                return $c->render_resource_not_found("Bibliographic record");
177
            }
173
            }
178
        }
174
        }
179
175
180
        my $schema = $metadata->schema // C4::Context->preference("marcflavour");
176
        my $record = $biblio->metadata_record( { interface => 'opac', patron => $patron } );
181
182
        my $record_processor = Koha::RecordProcessor->new({
183
            filters => 'ViewPolicy',
184
            options => {
185
                interface => 'opac',
186
                frameworkcode => $biblio->frameworkcode
187
            }
188
        });
189
        # Apply framework's filtering to MARC::Record object
190
        $record_processor->process($record);
191
177
192
        $c->respond_to(
178
        $c->respond_to(
193
            marcxml => {
179
            marcxml => {
194
- 

Return to bug 31224