}
unless ( $can_place_hold_if_available_at_pickup ) {
- $canreserve = 0 if Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch })->count;
+ 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 ) {
+ $canreserve = 0
+ }
}
my $itemtype = $query->param('itemtype') || undef;
$numCopiesAvailable++;
unless ( $can_place_hold_if_available_at_pickup ) {
- push @not_available_at, $itemInfo->{holdingbranch};
+ my $items_in_this_library = Koha::Items->search({ biblionumber => $itemInfo->{biblionumber}, holdingbranch => $itemInfo->{holdingbranch} });
+ 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 ) {
+ push @not_available_at, $itemInfo->{holdingbranch};
+ }
}
}