View | Details | Raw Unified | Return to bug 23091
Collapse All | Expand All

(-)a/Koha/Account/Line.pm (-4 / +5 lines)
Lines 166-179 sub credits { Link Here
166
    my ( $self, $cond, $attr ) = @_;
166
    my ( $self, $cond, $attr ) = @_;
167
167
168
    unless ( $self->is_debit ) {
168
    unless ( $self->is_debit ) {
169
        Koha::Exceptions::Account::IsNotCredit->throw(
169
        Koha::Exceptions::Account::IsNotDebit->throw(
170
            error => 'Account line ' . $self->id . ' is not a debit'
170
            error => 'Account line ' . $self->id . ' is not a debit'
171
        );
171
        );
172
    }
172
    }
173
173
174
    my $cond_m = { map { "credit.".$_ => $cond->{$_} } keys %{$cond}};
174
    my $rs =
175
    my $rs =
175
      $self->_result->search_related('account_offsets_debits')
176
      $self->_result->search_related('account_offsets_debits')
176
      ->search_related( 'credit', $cond, $attr );
177
      ->search_related( 'credit', $cond_m, $attr );
177
    return unless $rs;
178
    return unless $rs;
178
    return Koha::Account::Lines->_new_from_dbic($rs);
179
    return Koha::Account::Lines->_new_from_dbic($rs);
179
}
180
}
Lines 198-206 sub debits { Link Here
198
        );
199
        );
199
    }
200
    }
200
201
202
    my $cond_m = { map { "debit.".$_ => $cond->{$_} } keys %{$cond}};
201
    my $rs =
203
    my $rs =
202
      $self->_result->search_related('account_offsets_credits')
204
      $self->_result->search_related('account_offsets_credits')
203
      ->search_related( 'debit', $cond, $attr );
205
      ->search_related( 'debit', $cond_m, $attr );
204
    return unless $rs;
206
    return unless $rs;
205
    return Koha::Account::Lines->_new_from_dbic($rs);
207
    return Koha::Account::Lines->_new_from_dbic($rs);
206
}
208
}
207
- 

Return to bug 23091