From 433d7cbd712b04f2dd9500c5aa8af62a5c2c4b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Nyl=C3=A9n?= Date: Tue, 20 Oct 2020 14:11:16 +0200 Subject: [PATCH] Bug 26750: Deleted items not indexed After deleting an item it is still searchable in the index. Similar to bug 26507 where record is reindexed before the database is changed. To test: 1. Delete an item 2. Search the barcode in the main search box. You'll find the original record but wiht hte deleted item missing. 3. Apply patch. 4. Repeat steps 1-2 (with another item). No record should be found. --- Koha/Item.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index 5114a87db3..bedf4d1856 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -214,6 +214,8 @@ sub delete { # FIXME check the item has no current issues # i.e. raise the appropriate exception + my $result = $self->SUPER::delete; + my $indexer = Koha::SearchEngine::Indexer->new({ index => $Koha::SearchEngine::BIBLIOS_INDEX }); $indexer->index_records( $self->biblionumber, "specialUpdate", "biblioserver" ) unless $params->{skip_record_index}; @@ -223,7 +225,7 @@ sub delete { logaction( "CATALOGUING", "DELETE", $self->itemnumber, "item" ) if C4::Context->preference("CataloguingLog"); - return $self->SUPER::delete; + return $result; } =head3 safe_delete -- 2.25.1