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 <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Olivia Reynolds 2026-08-21 17:08:47 +01:00 committed by Pedro Amorim
parent a03c119ccd
commit e886c3a7e0
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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;