From 5975729c2712611a536d71a7580ff94d49e6bea4 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 1 Aug 2019 18:13:54 +0000 Subject: [PATCH] Bug 23414: Prefetch reserves and use them for determining waiting This dependss on bug 23413 Same tests as before, you shouldn't see a hit with this change --- C4/XSLT.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 0a35eb349e..53c670f6e4 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -295,7 +295,7 @@ sub buildKohaItemsNamespace { my $search_params; $search_params->{'me.biblionumber'} = $biblionumber; $search_params->{'me.itemnumber'} = { not_in => $hidden_items } if $hidden_items; - my @items = Koha::Items->search($search_params,{prefetch=>'branchtransfers'}); + my @items = Koha::Items->search($search_params,{prefetch=>['branchtransfers','reserves']}); my $shelflocations = { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => "", kohafield => 'items.location' } ) }; @@ -311,8 +311,6 @@ sub buildKohaItemsNamespace { for my $item (@items) { my $status; - my $reservestatus = C4::Reserves::GetReserveStatus( $item->itemnumber ); - if ( $item->notforloan < 0) { $status = "On order"; } @@ -334,7 +332,7 @@ sub buildKohaItemsNamespace { elsif ($item->get_transfer) { $status = 'In transit'; } - elsif (defined $reservestatus && $reservestatus eq "Waiting") { + elsif ( $item->holds({found =>'W'}) ) { $status = 'Waiting'; } elsif ($item->has_pending_hold) { -- 2.11.0