Bug 29495: Update relationship methods

This patch updates the relationship methods found in
Koha::Checkouts::ReturnClaim so that they are prefetchable and embeddable on
the API.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit faf8601bfd)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Martin Renvoize 2021-11-18 07:43:44 +00:00 committed by Victor Grousset/tuxayo
parent 3757953b5b
commit e2db9ab01e
2 changed files with 18 additions and 7 deletions

View File

@ -72,10 +72,21 @@ sub store {
sub checkout {
my ($self) = @_;
my $checkout = Koha::Checkouts->find( $self->issue_id )
|| Koha::Old::Checkouts->find( $self->issue_id );
my $checkout_rs = $self->_result->checkout;
return unless $checkout_rs;
return Koha::Checkout->_new_from_dbic($checkout_rs);
}
return $checkout;
=head3 old_checkout
=cut
sub old_checkout {
my ($self) = @_;
my $old_checkout_rs = $self->_result->old_checkout;
return unless $old_checkout_rs;
return Koha::Old::Checkout->_new_from_dbic($old_checkout_rs);
}
=head3 patron

View File

@ -256,7 +256,7 @@ __PACKAGE__->belongs_to(
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-02-23 19:37:50
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3V5bUmu5W3+XS0fa8uR04w
=head2 issue
=head2 checkout
Type: belongs_to
@ -265,7 +265,7 @@ Related object: L<Koha::Schema::Result::Issue>
=cut
__PACKAGE__->belongs_to(
"issue",
"checkout",
"Koha::Schema::Result::Issue",
{ issue_id => "issue_id" },
{
@ -274,7 +274,7 @@ __PACKAGE__->belongs_to(
},
);
=head2 old_issue
=head2 old_checkout
Type: belongs_to
@ -283,7 +283,7 @@ Related object: L<Koha::Schema::Result::OldIssue>
=cut
__PACKAGE__->belongs_to(
"old_issue",
"old_checkout",
"Koha::Schema::Result::OldIssue",
{ issue_id => "issue_id" },
{