From ea80d2f140fd79d56c1b439c3bce1671ea76d63e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 12 Jan 2024 14:34:18 +0100 Subject: [PATCH] Bug 35789: Remove Koha::Template::Plugin::Biblio::ArticleRequestsActiveCount Can be replaced with biblio.article_requests.filter_by_current.count Test plan: Turn on article requests (syspref + circ rule) Request an article (detail page of a bib record) On the left you see "Article requests" tab with the number of current article requests. It should show the correct number (same as before this patch). Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- Koha/Template/Plugin/Biblio.pm | 13 ------------- .../prog/en/includes/biblio-view-menu.inc | 2 +- .../prog/en/modules/catalogue/detail.tt | 2 +- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Koha/Template/Plugin/Biblio.pm b/Koha/Template/Plugin/Biblio.pm index b8f38a61f4..090fc071e0 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::Database; use Koha::Patrons; -use Koha::ArticleRequests; use Koha::Recalls; # Do not use HoldsCount, it is deprecated and will be removed in a future release. @@ -40,18 +39,6 @@ sub HoldsCount { return $holds->count(); } -sub ArticleRequestsActiveCount { - my ( $self, $biblionumber ) = @_; - - my $ar = Koha::ArticleRequests->search( - { - biblionumber => $biblionumber - } - )->filter_by_current; - - return $ar->count(); -} - sub CanArticleRequest { my ( $self, $biblionumber, $borrowernumber ) = @_; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc index bac3667c3d..74008ba117 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -86,7 +86,7 @@ [%- ELSE -%]
  • [%- END -%] - Article requests ([% Biblio.ArticleRequestsActiveCount( biblio_object_id ) | html %]) + Article requests ([% biblio.article_requests.filter_by_current.count | html %])
  • [%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 7ddeda4fe0..b5c75c19a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -192,7 +192,7 @@ [% END %] - [% IF ( article_requests_count = Biblio.ArticleRequestsActiveCount( biblionumber ) ) %] + [% IF ( article_requests_count = biblio.article_requests.filter_by_current.count ) %] Article requests: -- 2.39.5