Bug 30275: Add renewals relation to Koha::Old::Checkout

Add the new 'renewals' relation to Koha::Old::Checkout to return a
list of Koha::Checkouts::Renewal objects.

We also add the same relation to the OldIssue schema inline.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-04-26 15:56:45 +01:00 committed by Tomas Cohen Arazi
parent 557dfa9eae
commit cefbaca591
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 30 additions and 0 deletions

View File

@ -90,6 +90,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 anonymize
$checkout->anonymize();

View File

@ -343,6 +343,21 @@ __PACKAGE__->belongs_to(
},
);
=head2 renewals
Type: has_many
Related object: L<Koha::Schema::Result::CheckoutRenewal>
=cut
__PACKAGE__->has_many(
"renewals",
"Koha::Schema::Result::CheckoutRenewal",
{ "foreign.issue_id" => "self.issue_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 return_claim
Type: might_have