From f8c8048ddad0a9d4a34ee3d0a9153c06cc79a655 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 | 2 -- circ/returns.pl | 8 ++++++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index cc36501f7f4..b6eef2534f1 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2824,8 +2824,6 @@ sub AddReturn { } ); - Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } ) - if C4::Context->preference('RealTimeHoldsQueue'); } return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ) ); diff --git a/circ/returns.pl b/circ/returns.pl index 29b2d2f7bf7..1009cee5774 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -257,6 +257,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 fec7616ac69..c4f5637ba96 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -749,7 +749,20 @@ - +
+ + + [% INCLUDE 'csrf-token.inc' %] + [% FOREACH inputloo IN inputloop %] + + + + + [% END %] + +
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] -- 2.39.5