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

(-)a/Koha/Account/Line.pm (-4 / +5 lines)
Lines 153-166 sub credits { Link Here
153
    my ( $self, $cond, $attr ) = @_;
153
    my ( $self, $cond, $attr ) = @_;
154
154
155
    unless ( $self->is_debit ) {
155
    unless ( $self->is_debit ) {
156
        Koha::Exceptions::Account::IsNotCredit->throw(
156
        Koha::Exceptions::Account::IsNotDebit->throw(
157
            error => 'Account line ' . $self->id . ' is not a debit'
157
            error => 'Account line ' . $self->id . ' is not a debit'
158
        );
158
        );
159
    }
159
    }
160
160
161
    my $cond_m = { map { "credit.".$_ => $cond->{$_} } keys %{$cond}};
161
    my $rs =
162
    my $rs =
162
      $self->_result->search_related('account_offsets_debits')
163
      $self->_result->search_related('account_offsets_debits')
163
      ->search_related( 'credit', $cond, $attr );
164
      ->search_related( 'credit', $cond_m, $attr );
164
    return unless $rs;
165
    return unless $rs;
165
    return Koha::Account::Lines->_new_from_dbic($rs);
166
    return Koha::Account::Lines->_new_from_dbic($rs);
166
}
167
}
Lines 185-193 sub debits { Link Here
185
        );
186
        );
186
    }
187
    }
187
188
189
    my $cond_m = { map { "debit.".$_ => $cond->{$_} } keys %{$cond}};
188
    my $rs =
190
    my $rs =
189
      $self->_result->search_related('account_offsets_credits')
191
      $self->_result->search_related('account_offsets_credits')
190
      ->search_related( 'debit', $cond, $attr );
192
      ->search_related( 'debit', $cond_m, $attr );
191
    return unless $rs;
193
    return unless $rs;
192
    return Koha::Account::Lines->_new_from_dbic($rs);
194
    return Koha::Account::Lines->_new_from_dbic($rs);
193
}
195
}
194
- 

Return to bug 23091