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

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

Return to bug 23091