From 2c0d1aa679681b7716458b3cc30f5d87bec348b1 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 17 Jan 2020 11:18:41 -0300 Subject: [PATCH] Bug 24448: Add Koha::Biblio->subscriptions_count This patch adds the handy subscriptions_count method to the Koha::Biblio class. It is intended to be used as a shortcut for $biblio->subscriptions->count in places like the API where we can embed the output of a method. To test: 1. Apply this patches 2. Run: $ kshell k$ prove t/db_dependent/Koha/Biblio.t \ t/db_dependent/Koha/Biblios.t => SUCCESS: Tests pass! i.e. Biblios.t still passes, and the tests for the new method in Biblio.t pass as well. 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens --- Koha/Biblio.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 7c6e47328c..28609dc51d 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -517,6 +517,20 @@ sub subscriptions { return $self->{_subscriptions}; } +=head3 subscriptions_count + +my $subscriptions_count = $self->subscriptions_count + +Returns the count of the the related Koha::Subscriptions object for this biblio + +=cut + +sub subscriptions_count { + my ($self) = @_; + + return $self->subscriptions->count; +} + =head3 has_items_waiting_or_intransit my $itemsWaitingOrInTransit = $biblio->has_items_waiting_or_intransit -- 2.11.0