From 052d0d2e2e190d4ae4135e40fa28234dd2673572 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 13 Sep 2019 14:03:11 +0100 Subject: [PATCH] Bug 23355: Add relations to Koha::Account::Line This patch adds two new relationships to the Koha::Account::Line object. * credit_offsets - returns all credit type Koha::Account::Offsets related to this Koha::Account::Line. * debit_offsets - returns all debit type Koha::Account::Offsets related to this Koha::Account::Line. --- Koha/Account/Line.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index f4f9498ee1..824b050d05 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -82,6 +82,32 @@ sub checkout { return $self->{_checkout}; } +=head3 credit_offsets + +Return the credit_offsets linked to this account line if some exist + +=cut + +sub credit_offsets { + my ( $self ) = @_; + my $rs = $self->_result->account_offsets_credits; + return unless $rs; + return Koha::Account::Offsets->_new_from_dbic( $rs ); +} + +=head3 debit_offsets + +Return the debit_offsets linked to this account line if some exist + +=cut + +sub debit_offsets { + my ( $self ) = @_; + my $rs = $self->_result->account_offsets_debits; + return unless $rs; + return Koha::Account::Offsets->_new_from_dbic( $rs ); +} + =head3 void $payment_accountline->void(); -- 2.20.1