From 4de4cc92637bc9ee1b67187662c3a7b887c6e291 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 11 Mar 2022 15:39:43 +0000 Subject: [PATCH] Bug 30275: Add renewals relation to Koha::Checkout Add the new 'renewals' relation to Koha::Checkout to return a list of Koha::Checkouts::Renewal objects. Signed-off-by: Owen Leonard Signed-off-by: Tomas Cohen Arazi --- Koha/Checkout.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm index 34f0098d06..82cdfe4095 100644 --- a/Koha/Checkout.pm +++ b/Koha/Checkout.pm @@ -24,6 +24,7 @@ use DateTime; use Try::Tiny qw( catch try ); use C4::Circulation qw( LostItem MarkIssueReturned ); +use Koha::Checkouts::Renewals; use Koha::Checkouts::ReturnClaims; use Koha::Database; use Koha::DateUtils qw( dt_from_string ); @@ -121,6 +122,21 @@ sub issuer { return Koha::Patron->_new_from_dbic( $issuer_rs ); } +=head3 renewals + + my $renewals = $checkout->renewals; + +Return a Koha::Checkouts::Renewals set attached to this checkout + +=cut + +sub renewals { + my ( $self ) = @_; + my $renewals_rs = $self->_result->renewals; + return unless $renewals_rs; + return Koha::Checkouts::Renewals->_new_from_dbic( $renewals_rs ); +} + =head3 to_api_mapping This method returns the mapping for representing a Koha::Checkout object -- 2.39.5