From 5fcc732d6733e5a4933f74ba4c84f5212cbdfaf3 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 22 Sep 2021 16:49:33 -0300 Subject: [PATCH] Bug 29086: Simplify querying active article requests This patch makes a trivial replacement of a query for a higher level method that does the same query. To test: 1. Enable the ArticleRequests feature 2. Place some article requests on known biblios 3. Have some article requests be active on others finished (either completed or cancelled) 4. Go to the detail page for those records => SUCCESS: The active article requests count is correct! 5. Sign off :-D --- Koha/Template/Plugin/Biblio.pm | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Koha/Template/Plugin/Biblio.pm b/Koha/Template/Plugin/Biblio.pm index 5ec3542294..ecb8de8261 100644 --- a/Koha/Template/Plugin/Biblio.pm +++ b/Koha/Template/Plugin/Biblio.pm @@ -26,7 +26,6 @@ use Koha::Holds; use Koha::Biblios; use Koha::Patrons; use Koha::ArticleRequests; -use Koha::ArticleRequest::Status; sub HoldsCount { my ( $self, $biblionumber ) = @_; @@ -41,16 +40,9 @@ sub ArticleRequestsActiveCount { my $ar = Koha::ArticleRequests->search( { - biblionumber => $biblionumber, - status => [ - -or => [ - status => Koha::ArticleRequest::Status::Requested, - status => Koha::ArticleRequest::Status::Pending, - status => Koha::ArticleRequest::Status::Processing - ] - ] + biblionumber => $biblionumber } - ); + )->filter_by_current; return $ar->count(); } -- 2.30.2