From 721e215c0ef45ac3341c80d267f9d8f1488033a8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 26 Oct 2018 16:23:07 +0100 Subject: [PATCH] Bug 21681: (follow-up) Don't use Koha::Account::Line directly --- C4/ILSDI/Services.pm | 5 +---- Koha/Account.pm | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 08e9e1d420..53465caa9d 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -426,10 +426,7 @@ sub GetPatronInfo { # Fines management if ( $cgi->param('show_fines') && $cgi->param('show_fines') eq "1" ) { - my $account_lines = Koha::Account::Lines->search({ - borrowernumber => $patron->borrowernumber, - }); - + my $account_lines = $patron->account->lines; while (my $line = $account_lines->next ) { push @{ $borrower->{fines}{fine} }, $line->unblessed; } diff --git a/Koha/Account.pm b/Koha/Account.pm index e6863979fd..ca7a8072d1 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -524,6 +524,26 @@ sub non_issues_charges { : 0; } +=head3 lines + +my $lines = $self->lines; + +Return all credits and debits for the user, outstanding or otherwise + +=cut + +sub lines { + my ($self) = @_; + + my $lines = Koha::Account::Lines->search( + { + borrowernumber => $self->{patron_id}, + } + ); + + return $lines; +} + 1; =head2 Name mappings -- 2.19.1