Bugzilla – Attachment 134818 Details for
Bug 30710
Background tasks can be called multiple times on batch item deletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30710: Build holds queue once per biblio when batch deleting items
Bug-30710-Build-holds-queue-once-per-biblio-when-b.patch (text/plain), 3.21 KB, created by
Tomás Cohen Arazi
on 2022-05-10 14:46:19 UTC
(
hide
)
Description:
Bug 30710: Build holds queue once per biblio when batch deleting items
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2022-05-10 14:46:19 UTC
Size:
3.21 KB
patch
obsolete
>From 4161cf821f79eecbefe5396a45156c913abd7b0e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 6 May 2022 14:45:13 +0000 >Subject: [PATCH] Bug 30710: Build holds queue once per biblio when batch > deleting items > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Biblio.pm | 2 +- > Koha/BackgroundJob/BatchDeleteItem.pm | 16 ++++++++++++++-- > Koha/Item.pm | 2 +- > 3 files changed, 16 insertions(+), 4 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index de4b48ab47..682edffb7f 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -538,7 +538,7 @@ sub DelBiblio { > { > biblio_ids => [ $biblionumber ] > } >- ); >+ ) unless $params->{skip_holds_queue}; > > return; > } >diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm >index 578a095791..63e88142f1 100644 >--- a/Koha/BackgroundJob/BatchDeleteItem.pm >+++ b/Koha/BackgroundJob/BatchDeleteItem.pm >@@ -108,7 +108,7 @@ sub process { > > my $item = Koha::Items->find($record_id) || next; > >- my $return = $item->safe_delete({ skip_record_index => 1 }); >+ my $return = $item->safe_delete({ skip_record_index => 1, skip_holds_queue => 1 }); > unless ( $return ) { > > # FIXME Do we need to rollback the whole transaction if a deletion failed? >@@ -141,7 +141,7 @@ sub process { > Koha::Biblios->find($biblionumber)->items->count; > if ( $delete_biblios && $items_count == 0 ) { > my $error = C4::Biblio::DelBiblio( $biblionumber, >- { skip_record_index => 1 } ); >+ { skip_record_index => 1, skip_holds_queue => 1 } ); > unless ($error) { > push @deleted_biblionumbers, $biblionumber; > } >@@ -156,6 +156,12 @@ sub process { > > $indexer->index_records( \@deleted_biblionumbers, > 'recordDelete', "biblioserver", undef ); >+ >+ Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( >+ { >+ biblio_ids => \@deleted_biblionumbers >+ } >+ ); > } > > if (@updated_biblionumbers) { >@@ -164,6 +170,12 @@ sub process { > > $indexer->index_records( \@updated_biblionumbers, > 'specialUpdate', "biblioserver", undef ); >+ >+ Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( >+ { >+ biblio_ids => \@updated_biblionumbers >+ } >+ ); > } > } > ); >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 312b2b4de6..a6e3c1fa84 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -248,7 +248,7 @@ sub delete { > { > biblio_ids => [ $self->biblionumber ] > } >- ); >+ ) unless $params->{skip_holds_queue}; > > return $result; > } >-- >2.34.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 30710
:
134742
|
134743
|
134817
| 134818 |
134819