From 9d7c56a0e3e189a1c21a970c2824f01ecf366735 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 19 Nov 2024 19:57:54 +0000 Subject: [PATCH] Bug 34596: Do not build holds queue when checkin reserve found but do if hold ignored This patch does two things: 1: It prevents rebulding the real time holds queue during a checkin if a reserve was found. The reserve will either: a - be set to waiting if at correct location and no confirmation - this is fine because we will rebuild the queue when filling the hold b - trigger a popup whihc will rebuild the queue when confirming the transfer, or be ignored 2: It adds a form to ignoring a hold so that we can rebuild the holds queue if we decided not to use the current item to fill the found hold To test: 0 - Enable RealTimeHoldsQueue 1 - Place several holds for different libraries on a title 2 - Checkout a copy to a patron at current library (ignore current holds) 3 - Clean up DB so we can see outcomes from next steps: delete from branchtransfers; delete from background_jobs; update reserves SET found=NULL where found='T'; 4 - Check in item, confirm hold 5 - Check background jobs, note two rebuilds of the holds queue 6 - Check item out to previous patron, repeat 3 7 - Check in item, ignore the hold 8 - Check background jobs, note only one rebuild 9 - Apply patch, restart all 10 - Checkout item, repeat 3 11 - Checkin item, confirm hold 12 - Check background jobs, onlt one rebuild of holds queue 13 - Checkout item, repeat 3 14 - Checkin item, ignore hold 15 - Check background jobs, only one rebuild of holds queue Signed-off-by: Brendan Lawlor --- C4/Circulation.pm | 9 ++++----- circ/returns.pl | 8 ++++++++ .../prog/en/modules/circ/returns.tt | 17 ++++++++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index b9b66974be..2b0d259f33 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2588,11 +2588,10 @@ sub AddReturn { } }); - Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( - { - biblio_ids => [ $item->biblionumber ] - } - ) if C4::Context->preference('RealTimeHoldsQueue'); + Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } ) + if C4::Context->preference('RealTimeHoldsQueue') + && !defined $messages->{ResFound} + && C4::Context->interface eq 'intranet'; } return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} )); diff --git a/circ/returns.pl b/circ/returns.pl index 9f2e52dab1..5f87980d0c 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -265,6 +265,14 @@ if ( $op eq 'cud-dotransfer'){ $transfer->transit; } +if ( $op eq 'cud-ignore_reserve' ) { + my $ignored_item = $query->param('ignoreitem'); + my $item = Koha::Items->find($ignored_item); + Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } ) + if C4::Context->preference('RealTimeHoldsQueue'); + +} + if ($transit && $op eq 'cud-transfer') { my $transfer = Koha::Item::Transfers->find($transit); if ( $canceltransfer ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index 98a1ea119b..be20caed52 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -927,9 +927,20 @@ [% END %] - +
+ + + [% INCLUDE 'csrf-token.inc' %] + [% FOREACH inputloo IN inputloop %] + + + + + [% END %] + +
-- 2.39.5