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 <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2020-01-17 11:18:41 -03:00 committed by Martin Renvoize
parent 81c93cac46
commit 575d5418ed
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 14 additions and 0 deletions

View File

@ -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