Bug 37713: Do not show record metadata if OPAC suppressed

This change checks the 942$n if OpacSuppression is enabled,
and does not return the record metadata if 942$n is true. See BZ 31161.

Test plan:
0. Apply the patch
1. koha-plack --restart kohadev
2. Enable syspref "OAI-PMH"
3. Set syspref "OpacSuppression" to "Hide"
4. Go to http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=oai_dc
5. Note KOHA-OAI-TEST:2 metadata visible
6. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2
7. Set 942$n to "Yes"
8. Go to http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=oai_dc
9. Note KOHA-OAI-TEST:2 metadata no longer visible and instead "Record Status: deleted" shows

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 70ff8dd1b4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
David Cook 2025-03-10 01:10:12 +00:00 committed by Jacob O'Mara
parent 8e4cdaf22b
commit af946b63d1
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -216,12 +216,16 @@ sub get_biblio_marcxml {
}
if ($record) {
# Check if the bibliographic record is suppressed in OPAC
if ( C4::Context->preference('OpacSuppression') && $biblio->opac_suppressed ) {
return;
}
my $rules = C4::Context->yaml_preference('OpacHiddenItems') // {};
if ( $biblio->hidden_in_opac( { rules => $rules } ) ) {
return;
}
#TODO: Also hide record if OpacSuppression is in use
}
return ( $record ? $record->as_xml_record( C4::Context->preference('marcflavour') ) : undef, $decoding_error );