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 <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2024-11-19 19:57:54 +00:00 committed by Lucas Gass
parent fef3b93bbf
commit f9d096df27
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
3 changed files with 20 additions and 3 deletions

View File

@ -2836,8 +2836,6 @@ sub AddReturn {
}
);
Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue->new->enqueue( { biblio_ids => [ $item->biblionumber ] } )
if C4::Context->preference('RealTimeHoldsQueue');
}
return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ) );

View File

@ -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) {

View File

@ -750,7 +750,18 @@
<input type="hidden" name="print_slip" value="0" />
<button type="button" class="btn btn-default print" accesskey="P"> <i class="fa fa-print"></i> Print slip and confirm (P) </button>
<button data-bs-dismiss="modal" type="submit" class="btn btn-default ignore" accesskey="I"> <i class="fa fa-times"></i> Ignore (I) </button>
<form method="post" action="returns.pl" class="confirm">
<input type="hidden" name="op" value="cud-ignore_reserve" />
<input type="hidden" name="ignoreitem" value="[% itemnumber | html %]" />
[% INCLUDE 'csrf-token.inc' %]
[% FOREACH inputloo IN inputloop %]
<input type="hidden" name="ri-[% inputloo.counter | html %]" value="[% inputloo.barcode | html %]" />
<input type="hidden" name="dd-[% inputloo.counter | html %]" value="[% inputloo.duedate | html %]" />
<input type="hidden" name="bn-[% inputloo.counter | html %]" value="[% inputloo.borrowernumber | html %]" />
<input type="hidden" name="nr-[% inputloo.counter | html %]" value="[% inputloo.not_returned | html %]" />
[% END %]
<button type="submit" data-bs-dismiss="modal" class="btn btn-default deny" accesskey="i"> <i class="fa fa-times"></i> Ignore (I) </button>
</form>
<fieldset class="action">
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]