|
Lines 132-139
Return the credit_offsets linked to this account line if some exist
Link Here
|
| 132 |
=cut |
132 |
=cut |
| 133 |
|
133 |
|
| 134 |
sub credit_offsets { |
134 |
sub credit_offsets { |
| 135 |
my ( $self ) = @_; |
135 |
my ( $self, $cond, $attr ) = @_; |
| 136 |
my $rs = $self->_result->account_offsets_credits; |
136 |
|
|
|
137 |
unless ( $self->is_credit ) { |
| 138 |
Koha::Exceptions::Account::IsNotCredit->throw( |
| 139 |
error => 'Account line ' . $self->id . ' is not a credit' |
| 140 |
); |
| 141 |
} |
| 142 |
|
| 143 |
my $rs = $self->_result->search_related( 'account_offsets_credits', $cond, $attr); |
| 137 |
return unless $rs; |
144 |
return unless $rs; |
| 138 |
return Koha::Account::Offsets->_new_from_dbic($rs); |
145 |
return Koha::Account::Offsets->_new_from_dbic($rs); |
| 139 |
} |
146 |
} |
|
Lines 145-157
Return the debit_offsets linked to this account line if some exist
Link Here
|
| 145 |
=cut |
152 |
=cut |
| 146 |
|
153 |
|
| 147 |
sub debit_offsets { |
154 |
sub debit_offsets { |
| 148 |
my ( $self ) = @_; |
155 |
my ( $self, $cond, $attr ) = @_; |
| 149 |
my $rs = $self->_result->account_offsets_debits; |
156 |
|
|
|
157 |
unless ( $self->is_debit ) { |
| 158 |
Koha::Exceptions::Account::IsNotDebit->throw( |
| 159 |
error => 'Account line ' . $self->id . ' is not a debit' |
| 160 |
); |
| 161 |
} |
| 162 |
|
| 163 |
my $rs = $self->_result->search_related( 'account_offsets_debits', $cond, $attr); |
| 150 |
return unless $rs; |
164 |
return unless $rs; |
| 151 |
return Koha::Account::Offsets->_new_from_dbic($rs); |
165 |
return Koha::Account::Offsets->_new_from_dbic($rs); |
| 152 |
} |
166 |
} |
| 153 |
|
167 |
|
| 154 |
|
|
|
| 155 |
=head3 credits |
168 |
=head3 credits |
| 156 |
|
169 |
|
| 157 |
my $credits = $accountline->credits; |
170 |
my $credits = $accountline->credits; |
| 158 |
- |
|
|