@@ -, +, @@ related to this Koha::Account::Line. to this Koha::Account::Line. --- Koha/Account/Line.pm | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) --- a/Koha/Account/Line.pm +++ a/Koha/Account/Line.pm @@ -110,6 +110,53 @@ sub debit_type { return Koha::Account::DebitType->_new_from_dbic( $rs ); } +=head3 credit_offsets + + my $credit_offsets = $accountline->credit_offsets; + my $credit_offsets = $accountline->credit_offsets( $cond, $attr); + +Return the credit_offsets linked to this account line if some exist. +Search conditions and attributes may be passed if you wish to filter +the resultant resultant resultset. + +=cut + +sub credit_offsets { + my ( $self, $cond, $attr ) = @_; + my $rs; + if ( defined($cond) || defined($attr) ) { + $rs = + $self->_result->search_related( 'account_offsets_credits', $cond, + $attr ); + } + else { + $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, $cond, $attr ) = @_; + my $rs; + if ( defined($cond) || defined($attr) ) { + $rs = + $self->_result->search_related( 'account_offsets_debits', $cond, + $attr ); + } + else { + $rs = $self->_result->account_offsets_debits; + } + return unless $rs; + return Koha::Account::Offsets->_new_from_dbic($rs); +} + =head3 void $payment_accountline->void(); --