From af1f8d34db42a94232fa445f99ae9b437a12a72f Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 10 May 2022 14:18:55 -0300 Subject: [PATCH] Bug 30728: Only trigger real-time holds queue update if enabled This patch makes the places in which Koha enqueues holds queue for real time updates verify the feature is enabled. To test: 1. Apply this patches up to the unit tests 2. Run: $ updatedatabase $ kshell k$ git diff origin/master --name-only | grep -e '\.t$' | xargs prove => FAIL: tests fail, the code doesn't care about the syspref 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Be happy! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- C4/Biblio.pm | 6 +++--- C4/Circulation.pm | 4 ++-- C4/Reserves.pm | 6 +++--- Koha/BackgroundJob/BatchDeleteBiblio.pm | 2 +- Koha/BackgroundJob/BatchDeleteItem.pm | 4 ++-- Koha/Hold.pm | 8 ++++---- Koha/Item.pm | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 7e65a63d9f..459a94510a 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -347,7 +347,7 @@ us to not relink records when the authority linker is saving modifications. =item C Unless C is passed, ModBiblio will trigger the BatchUpdateBiblioHoldsQueue -task to rebuild the holds queue for the biblio. +task to rebuild the holds queue for the biblio if I is enabled. =back @@ -440,7 +440,7 @@ sub ModBiblio { { biblio_ids => [ $biblionumber ] } - ) unless $options->{skip_holds_queue}; + ) unless $options->{skip_holds_queue} or !C4::Context->preference('RealTimeHoldsQueue'); return 1; } @@ -547,7 +547,7 @@ sub DelBiblio { { biblio_ids => [ $biblionumber ] } - ) unless $params->{skip_holds_queue}; + ) unless $params->{skip_holds_queue} or !C4::Context->preference('RealTimeHoldsQueue'); return; } diff --git a/C4/Circulation.pm b/C4/Circulation.pm index d312961478..117c4dd066 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1779,7 +1779,7 @@ sub AddIssue { { biblio_ids => [ $item_object->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); } } return $issue; @@ -2445,7 +2445,7 @@ sub AddReturn { { biblio_ids => [ $item->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); } return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 81fecaebe0..5193a5454c 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -319,7 +319,7 @@ sub AddReserve { { biblio_ids => [ $biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); return $reserve_id; } @@ -1446,7 +1446,7 @@ sub AlterPriority { { biblio_ids => [ $hold->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); # FIXME Should return the new priority } @@ -2099,7 +2099,7 @@ sub RevertWaitingStatus { { biblio_ids => [ $hold->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); return $hold; diff --git a/Koha/BackgroundJob/BatchDeleteBiblio.pm b/Koha/BackgroundJob/BatchDeleteBiblio.pm index d834f29b7c..b5984ce44f 100644 --- a/Koha/BackgroundJob/BatchDeleteBiblio.pm +++ b/Koha/BackgroundJob/BatchDeleteBiblio.pm @@ -164,7 +164,7 @@ sub process { { biblio_ids => \@deleted_biblionumbers } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); } my $job_data = decode_json $self->data; diff --git a/Koha/BackgroundJob/BatchDeleteItem.pm b/Koha/BackgroundJob/BatchDeleteItem.pm index 63e88142f1..57371289a9 100644 --- a/Koha/BackgroundJob/BatchDeleteItem.pm +++ b/Koha/BackgroundJob/BatchDeleteItem.pm @@ -161,7 +161,7 @@ sub process { { biblio_ids => \@deleted_biblionumbers } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); } if (@updated_biblionumbers) { @@ -175,7 +175,7 @@ sub process { { biblio_ids => \@updated_biblionumbers } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); } } ); diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 97c6b4c37a..be5970cbd4 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -130,7 +130,7 @@ sub suspend_hold { { biblio_ids => [ $self->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); return $self; } @@ -164,7 +164,7 @@ sub resume { { biblio_ids => [ $self->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); return $self; } @@ -627,7 +627,7 @@ sub cancel { { biblio_ids => [ $old_me->biblionumber ] } - ) unless $params->{skip_holds_queue}; + ) unless $params->{skip_holds_queue} or !C4::Context->preference('RealTimeHoldsQueue'); } ); return $self; @@ -697,7 +697,7 @@ sub fill { { biblio_ids => [ $old_me->biblionumber ] } - ); + ) if C4::Context->preference('RealTimeHoldsQueue'); } ); return $self; diff --git a/Koha/Item.pm b/Koha/Item.pm index a6e3c1fa84..2cefac59be 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -217,7 +217,7 @@ sub store { { biblio_ids => [ $self->biblionumber ] } - ) unless $params->{skip_holds_queue}; + ) unless $params->{skip_holds_queue} or !C4::Context->preference('RealTimeHoldsQueue'); return $result; } @@ -248,7 +248,7 @@ sub delete { { biblio_ids => [ $self->biblionumber ] } - ) unless $params->{skip_holds_queue}; + ) unless $params->{skip_holds_queue} or !C4::Context->preference('RealTimeHoldsQueue'); return $result; } -- 2.39.5