Lines 415-421
sub outstanding_debits {
Link Here
|
415 |
} |
415 |
} |
416 |
); |
416 |
); |
417 |
|
417 |
|
418 |
# sum returns undef it list is empty |
418 |
# sum returns undef if list is empty |
419 |
my $total = sum( $lines->get_column('amountoutstanding') ) + 0; |
419 |
my $total = sum( $lines->get_column('amountoutstanding') ) + 0; |
420 |
|
420 |
|
421 |
return ( $total, $lines ); |
421 |
return ( $total, $lines ); |
Lines 430-448
my ( $total, $lines ) = Koha::Account->new({ patron_id => $patron_id })->outstan
Link Here
|
430 |
sub outstanding_credits { |
430 |
sub outstanding_credits { |
431 |
my ($self) = @_; |
431 |
my ($self) = @_; |
432 |
|
432 |
|
433 |
my $outstanding_credits = Koha::Account::Lines->search( |
|
|
434 |
{ borrowernumber => $self->{patron_id}, |
435 |
amountoutstanding => { '<' => 0 } |
436 |
}, |
437 |
{ select => [ { sum => 'amountoutstanding' } ], |
438 |
as => ['outstanding_credits_total'], |
439 |
} |
440 |
); |
441 |
my $total |
442 |
= ( $outstanding_credits->count ) |
443 |
? $outstanding_credits->next->get_column('outstanding_credits_total') + 0 |
444 |
: 0; |
445 |
|
446 |
my $lines = Koha::Account::Lines->search( |
433 |
my $lines = Koha::Account::Lines->search( |
447 |
{ |
434 |
{ |
448 |
borrowernumber => $self->{patron_id}, |
435 |
borrowernumber => $self->{patron_id}, |
Lines 450-455
sub outstanding_credits {
Link Here
|
450 |
} |
437 |
} |
451 |
); |
438 |
); |
452 |
|
439 |
|
|
|
440 |
# sum returns undef if list is empty |
441 |
my $total = sum( $lines->get_column('amountoutstanding') ) + 0; |
442 |
|
453 |
return ( $total, $lines ); |
443 |
return ( $total, $lines ); |
454 |
} |
444 |
} |
455 |
|
445 |
|