From da76626d7e257d1d52bc2c5f2683f72467504b8b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 17 Oct 2023 12:36:44 +0100 Subject: [PATCH] Bug 35074: Add patron relationship alias This patch adds the 'patron' relationship alias to the Acountline DBIx::Class schema. Signed-off-by: Lucas Gass --- Koha/Account/Line.pm | 2 +- Koha/Schema/Result/Accountline.pm | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 4cd914d9b76..7496f17677b 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -52,7 +52,7 @@ Return the patron linked to this account line sub patron { my ( $self ) = @_; - my $rs = $self->_result->borrowernumber; + my $rs = $self->_result->patron; return unless $rs; return Koha::Patron->_new_from_dbic( $rs ); } diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index 5ee3aaff3a7..55a7632a833 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -399,6 +399,26 @@ __PACKAGE__->belongs_to( # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-28 20:21:02 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PjQR7oUkefiDt+eV69jZ3A +=head2 patron + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "patron", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 library Type: belongs_to -- 2.30.2