From e886c3a7e05d27d98dabe6cb3dc53ff54cd435a5 Mon Sep 17 00:00:00 2001 From: Olivia Reynolds Date: Fri, 21 Aug 2026 17:08:47 +0100 Subject: [PATCH] Bug 39337: (follow-up) Default to not suppressing OAI records In the case when a biblio is deleted, we should not suppress its orphaned records. Therefore, invert the conditions in the WHERE clause to not suppress the record if no biblio could be found. Test plan: 1. Enable the system preferences "OAI-PMH" and "OpacSuppression". Ensure "OpacSuppressionByIPRange" is blank. 2. Navigate to /cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=oai_dc 3. Select a displayed record, and delete its corresponding biblio. 4. Refresh the OAI page, verify the record has vanished. 5. Apply patch. 6. Refresh the OAI page, verify the record now appears and is marked as deleted. It may have moved to the top of the list. Sponsored-by: Open Fifth Signed-off-by: David Nind Signed-off-by: Pedro Amorim --- Koha/OAI/Server/GetRecord.pm | 2 +- Koha/OAI/Server/ListBase.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/OAI/Server/GetRecord.pm b/Koha/OAI/Server/GetRecord.pm index 73aacd3d5d..f95c0b12cf 100644 --- a/Koha/OAI/Server/GetRecord.pm +++ b/Koha/OAI/Server/GetRecord.pm @@ -40,7 +40,7 @@ sub new { # Primary table in select aliased to `main` so we can reuse this WHERE clause my $where = 'main.biblionumber = ?'; $where .= - ' AND EXISTS (SELECT 1 FROM biblio WHERE biblio.biblionumber = main.biblionumber AND NOT biblio.opac_suppressed)' + ' AND NOT EXISTS (SELECT 1 FROM biblio WHERE biblio.biblionumber = main.biblionumber AND biblio.opac_suppressed)' if C4::Context->is_opac_suppressed; if ($items_included) { diff --git a/Koha/OAI/Server/ListBase.pm b/Koha/OAI/Server/ListBase.pm index a627f088f4..b8544f51e8 100644 --- a/Koha/OAI/Server/ListBase.pm +++ b/Koha/OAI/Server/ListBase.pm @@ -85,7 +85,7 @@ STAGELOOP: } $where .= - " AND EXISTS (SELECT 1 FROM biblio WHERE biblio.biblionumber = main.biblionumber AND NOT biblio.opac_suppressed)" + " AND NOT EXISTS (SELECT 1 FROM biblio WHERE biblio.biblionumber = main.biblionumber AND biblio.opac_suppressed)" if C4::Context->is_opac_suppressed; my @bind_params = @part_bind_params;