Bug 35997: Cancelling a hold should remove the hold from the queue

Test plan:
1) Place a hold for a record for a patron
2) Build the holds queue
3) Note the holds queue contains a match for that patron and record
4) Cancel the holds queue
5) Reload the holds queue page, note the match for  that patron and
   record is gone!

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 4d2df6f985)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Kyle Hall 2024-02-05 14:44:46 -05:00 committed by Fridolin Somers
parent 9f10949c6b
commit 5a281485c6

View file

@ -706,6 +706,21 @@ sub cancel {
$self->cancellation_reason( $params->{cancellation_reason} ); $self->cancellation_reason( $params->{cancellation_reason} );
$self->store(); $self->store();
my $dbh = $self->_result->result_source->schema->storage->dbh;
$dbh->do(
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 = ?
}, undef, $self->id
);
if ( $params->{cancellation_reason} ) { if ( $params->{cancellation_reason} ) {
my $letter = C4::Letters::GetPreparedLetter( my $letter = C4::Letters::GetPreparedLetter(
module => 'reserves', module => 'reserves',