|
Lines 129-135
sub void {
Link Here
|
| 129 |
=head3 apply |
129 |
=head3 apply |
| 130 |
|
130 |
|
| 131 |
my $debits = $account->outstanding_debits; |
131 |
my $debits = $account->outstanding_debits; |
| 132 |
my $outstanding_amount = $credit->apply({ debits => $debits, [ offset_type => $offset_type ] }); |
132 |
my $outstanding_amount = $credit->apply( { debits => $debits, [ offset_type => $offset_type ] } ); |
|
|
133 |
|
| 134 |
Applies the credit to a given debits set. |
| 135 |
|
| 136 |
=head4 arguments hashref |
| 137 |
|
| 138 |
=over 4 |
| 139 |
|
| 140 |
=item debits - Koha::Account::Lines object set of debits |
| 141 |
|
| 142 |
=item offset_type (optional) - a string indicating the offset type (valid values are those from |
| 143 |
the 'account_offset_types' table) |
| 144 |
|
| 145 |
=back |
| 133 |
|
146 |
|
| 134 |
=cut |
147 |
=cut |
| 135 |
|
148 |
|
|
Lines 137-143
sub apply {
Link Here
|
| 137 |
my ( $self, $params ) = @_; |
150 |
my ( $self, $params ) = @_; |
| 138 |
|
151 |
|
| 139 |
my $debits = $params->{debits}; |
152 |
my $debits = $params->{debits}; |
| 140 |
my $offset_type = $params->{offset_type} // 'credit_applied'; |
153 |
my $offset_type = $params->{offset_type} // 'Credit Applied'; |
| 141 |
|
154 |
|
| 142 |
unless ( $self->is_credit ) { |
155 |
unless ( $self->is_credit ) { |
| 143 |
Koha::Exceptions::Account::IsNotCredit->throw( |
156 |
Koha::Exceptions::Account::IsNotCredit->throw( |