Bugzilla – Attachment 134675 Details for
Bug 30467
BatchDeleteItem task does not deal with indexation correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30467: (QA follow-up) Restore indexing for item only deletion
Bug-30467-QA-follow-up-Restore-indexing-for-item-o.patch (text/plain), 3.27 KB, created by
Jonathan Druart
on 2022-05-06 07:26:38 UTC
(
hide
)
Description:
Bug 30467: (QA follow-up) Restore indexing for item only deletion
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-05-06 07:26:38 UTC
Size:
3.27 KB
patch
obsolete
>From df26e7abd08931fb203053377e7e51dfe574f8d7 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 6 May 2022 08:10:04 +0100 >Subject: [PATCH] Bug 30467: (QA follow-up) Restore indexing for item only > deletion > >This patch restores indexing for item only bulk deletions. > >JD amended patch: >* remove trailing whitespaces >* Move if inside first condition > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/BackgroundJob/BatchDeleteItem.pm | 41 ++++++++++++++++----------- > 1 file changed, 25 insertions(+), 16 deletions(-) > >diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm >index 49ec850a338..ce458a22201 100644 >--- a/Koha/BackgroundJob/BatchDeleteItem.pm >+++ b/Koha/BackgroundJob/BatchDeleteItem.pm >@@ -135,26 +135,35 @@ sub process { > } > > # If there are no items left, delete the biblio >- if ( $delete_biblios && @biblionumbers ) { >- for my $biblionumber ( uniq @biblionumbers ) { >- my $items_count = >- Koha::Biblios->find($biblionumber)->items->count; >- if ( $items_count == 0 ) { >- my $error = C4::Biblio::DelBiblio( $biblionumber, >- { skip_record_index => 1 } ); >- unless ($error) { >- push @deleted_biblionumbers, $biblionumber; >- } >+ my @updated_biblionumbers; >+ for my $biblionumber ( uniq @biblionumbers ) { >+ my $items_count = >+ Koha::Biblios->find($biblionumber)->items->count; >+ if ( $delete_biblios && $items_count == 0 ) { >+ my $error = C4::Biblio::DelBiblio( $biblionumber, >+ { skip_record_index => 1 } ); >+ unless ($error) { >+ push @deleted_biblionumbers, $biblionumber; > } >+ } else { >+ push @updated_biblionumbers, $biblionumber; > } >+ } > >- if (@deleted_biblionumbers) { >- my $indexer = Koha::SearchEngine::Indexer->new( >- { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ if (@deleted_biblionumbers) { >+ my $indexer = Koha::SearchEngine::Indexer->new( >+ { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > >- $indexer->index_records( \@deleted_biblionumbers, >- 'recordDelete', "biblioserver", undef ); >- } >+ $indexer->index_records( \@deleted_biblionumbers, >+ 'recordDelete', "biblioserver", undef ); >+ } >+ >+ if (@updated_biblionumbers) { >+ my $indexer = Koha::SearchEngine::Indexer->new( >+ { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >+ >+ $indexer->index_records( \@deleted_biblionumbers, >+ 'specialUpdate', "biblioserver", undef ); > } > } > ); >-- >2.25.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 30467
:
132992
|
134398
|
134640
|
134672
| 134675 |
134741
|
134744