From 395bb760394e6947303de7e342882148944e9026 Mon Sep 17 00:00:00 2001 From: =?utf8?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. Note to test you have to have the indexer running, not the cron job, and it needs to be running fast so that the index is updated before the delete takes place Signed-off-by: Chris Cormack Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- 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.39.5