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 <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-01-12 14:34:18 +01:00 committed by Katrin Fischer
parent f108f73445
commit ea80d2f140
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 2 additions and 15 deletions

View File

@ -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 ) = @_;

View File

@ -86,7 +86,7 @@
[%- ELSE -%]
<li>
[%- END -%]
<a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% IF ( object ) %][% object | uri %][% ELSE %][% biblionumber | uri %][% END %]">Article requests ([% Biblio.ArticleRequestsActiveCount( biblio_object_id ) | html %])</a>
<a href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% IF ( object ) %][% object | uri %][% ELSE %][% biblionumber | uri %][% END %]">Article requests ([% biblio.article_requests.filter_by_current.count | html %])</a>
</li>
[%- END -%]

View File

@ -192,7 +192,7 @@
</span>
[% END %]
[% IF ( article_requests_count = Biblio.ArticleRequestsActiveCount( biblionumber ) ) %]
[% IF ( article_requests_count = biblio.article_requests.filter_by_current.count ) %]
<span class="results_summary">
<span class="label">Article requests:</span>
<span class="number_box">