Bug 24359: Remove hold from holds queue when captured

This patch removes a hold from holds queue when captured by check in.

To test:

1. check out an item from a book with multiple items for patron_1
2. place a biblio level hold for patron_2
3. perl misc/cronjobs/holds/build_holds_queue.pl
CHECK => holds queue shows the placed hold
4. check in the item from step 1 and confirm hold for patron_2
SUCCESS => hold for patron_2 is no longer in holds queue
5. prove t/db_dependent/HoldsQueue.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Agustin Moyano 2020-10-28 10:48:18 -03:00 committed by Jonathan Druart
parent cdc668764c
commit 445ca21ff0
1 changed files with 15 additions and 0 deletions

View File

@ -1160,6 +1160,8 @@ if $transferToDo is not set, then the status is set to "Waiting" as well.
otherwise, a transfer is on the way, and the end of the transfer will
take care of the waiting status
This function also removes any entry of the hold in holds queue table.
=cut
sub ModReserveAffect {
@ -1210,6 +1212,19 @@ sub ModReserveAffect {
CartToShelf( $itemnumber );
}
my $std = $dbh->prepare(q{
DELETE q, t
FROM tmp_holdsqueue q
INNER JOIN hold_fill_targets t
ON q.borrowernumber = t.borrowernumber
AND q.biblionumber = t.biblionumber
AND q.itemnumber = t.itemnumber
AND q.item_level_request = t.item_level_request
AND q.holdingbranch = t.source_branchcode
WHERE t.reserve_id = ?
});
$std->execute($hold->reserve_id);
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
if C4::Context->preference('HoldsLog');