Revert "Bug 39336: Public Biblio endpoint should honour OpacSuppression syspref"

This reverts commit 15adc62abb.

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Paul Derscheid 2025-11-25 19:16:30 +01:00
parent 2fb7dab4a4
commit a670b74d92
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 1 additions and 34 deletions

View File

@ -161,11 +161,6 @@ sub get_public {
my $schema = $biblio->metadata->schema // C4::Context->preference("marcflavour");
my $patron = $c->stash('koha.user');
# Check if the bibliographic record is suppressed in OPAC
if ( C4::Context->preference('OpacSuppression') && $biblio->opac_suppressed ) {
return $c->render_resource_not_found("Bibliographic record");
}
# Check if the bibliographic record should be hidden for unprivileged access
# unless there's a logged in user, and there's an exception for it's category
my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems');

View File

@ -292,7 +292,7 @@ subtest 'delete() tests' => sub {
subtest 'get_public() tests' => sub {
plan tests => 26;
plan tests => 25;
$schema->storage->txn_begin;
@ -425,34 +425,6 @@ subtest 'get_public() tests' => sub {
t::lib::Mocks::mock_preference('OpacHiddenItems');
};
subtest 'OpacSuppression tests' => sub {
plan tests => 8;
# Test with OpacSuppression enabled and biblio suppressed
t::lib::Mocks::mock_preference( 'OpacSuppression', 1 );
$biblio->set( { opac_suppressed => 1 } )->store;
$t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } )
->status_is( 404, 'OpacSuppression enabled + opac_suppressed => hidden' );
# Test with OpacSuppression enabled but biblio not suppressed
$biblio->set( { opac_suppressed => 0 } )->store;
$t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } )
->status_is( 200, 'OpacSuppression enabled + not suppressed => displayed' );
# Test with OpacSuppression disabled but biblio suppressed
t::lib::Mocks::mock_preference( 'OpacSuppression', 0 );
$biblio->set( { opac_suppressed => 1 } )->store;
$t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } )
->status_is( 200, 'OpacSuppression disabled + opac_suppressed => displayed' );
# Test with both disabled
$biblio->set( { opac_suppressed => 0 } )->store;
$t->get_ok( "/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'text/plain' } )
->status_is( 200, 'OpacSuppression disabled + not suppressed => displayed' );
};
$biblio->delete;
$t->get_ok(
"//$userid:$password@/api/v1/public/biblios/" . $biblio->biblionumber => { Accept => 'application/marc' } )