From b389e7c64a20d16912b01d36f0b0dba0b7a02fca Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Feb 2017 08:54:39 +0100 Subject: [PATCH] Bug 17453: Take into account items that are lost or damaged If all the items are either lost, damaged or checked out, then pickup should be allowed. Signed-off-by: Nick Clemens https://bugs.koha-community.org/show_bug.cgi?id=14753 --- opac/opac-reserve.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index f5e4130..d42cc15 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -289,7 +289,8 @@ if ( $query->param('place_reserve') ) { unless ( $can_place_hold_if_available_at_pickup ) { my $items_in_this_library = Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch }); my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count; - if ( $items_in_this_library->count > $nb_of_items_issued ) { + my $nb_of_items_unavailable = $items_in_this_library->search({ -or => { lost => { '!=' => 0 }, damaged => { '!=' => 0 }, } }); + if ( $items_in_this_library->count > $nb_of_items_issued + $nb_of_items_unavailable ) { $canreserve = 0 } } -- 2.1.4