From 8e0e9b662389015e32c8b5ef5a07461132b44f73 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 17 Dec 2019 14:23:16 +0100 Subject: [PATCH] Bug 24175: Take advantage of Koha::Item->holds MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonathan Druart Signed-off-by: Joonas Kylmälä Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- C4/SIP/ILS/Transaction/Hold.pm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/C4/SIP/ILS/Transaction/Hold.pm b/C4/SIP/ILS/Transaction/Hold.pm index 44c1beb1bd..e442787dc5 100644 --- a/C4/SIP/ILS/Transaction/Hold.pm +++ b/C4/SIP/ILS/Transaction/Hold.pm @@ -86,14 +86,10 @@ sub drop_hold { $self->ok(0); return $self; } + my $item = Koha::Items->find({ barcode => $self->{item}->id }); - my $holds = Koha::Holds->search( - { - biblionumber => $item->biblionumber, - itemnumber => $item->itemnumber, - borrowernumber => $patron->borrowernumber - } - ); + my $holds = $item->holds->search({ borrowernumber => $patron->borrowernumber }); + return $self unless $holds->count; $holds->next->cancel; -- 2.39.5