Bugzilla – Attachment 179091 Details for
Bug 37713
OAI-PMH - Honour OpacSuppression syspref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37713: Do not show record metadata if OPAC suppressed
Bug-37713-Do-not-show-record-metadata-if-OPAC-supp.patch (text/plain), 2.07 KB, created by
Martin Renvoize (ashimema)
on 2025-03-10 07:43:24 UTC
(
hide
)
Description:
Bug 37713: Do not show record metadata if OPAC suppressed
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-03-10 07:43:24 UTC
Size:
2.07 KB
patch
obsolete
>From b7c745663cbb57643c1776f56ea95999633e06af Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 10 Mar 2025 01:10:12 +0000 >Subject: [PATCH] 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: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/OAI/Server/Repository.pm | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > >diff --git a/Koha/OAI/Server/Repository.pm b/Koha/OAI/Server/Repository.pm >index ae320a9624e..198f081505f 100644 >--- a/Koha/OAI/Server/Repository.pm >+++ b/Koha/OAI/Server/Repository.pm >@@ -198,13 +198,20 @@ sub get_biblio_marcxml { > $record = $biblio->metadata->record_strip_nonxml( { embed_items => $with_items, opac => 1 } ); > } > if ($record) { >+ if ( C4::Context->preference('OpacSuppression') ) { >+ >+ #NOTE: See Koha::Biblio->metadata_extractor->get_opac_suppression() >+ my $suppressed = $record->subfield( '942', 'n' ) ? 1 : 0; >+ if ($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 ); >-- >2.48.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37713
:
179090
| 179091