Bugzilla – Attachment 81359 Details for
Bug 21696
Use Koha::Account->lines from Koha::Account
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21696: Use Koha::Account->lines from Koha::Account
Bug-21696-Use-KohaAccount-lines-from-KohaAccount.patch (text/plain), 3.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-10-27 11:50:22 UTC
(
hide
)
Description:
Bug 21696: Use Koha::Account->lines from Koha::Account
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-10-27 11:50:22 UTC
Size:
3.48 KB
patch
obsolete
>From 63cefaa79673bc6bb08b19b3c48a2e499189a7c8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 26 Oct 2018 15:50:59 -0300 >Subject: [PATCH] Bug 21696: Use Koha::Account->lines from Koha::Account > >There is now Koha::Account->lines, we should use it instead of >Koha::Account::Lines->search > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Account.pm | 32 ++++++++++---------------------- > 1 file changed, 10 insertions(+), 22 deletions(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index a5b424ec35..4356411a1a 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -85,14 +85,9 @@ sub pay { > my $patron = Koha::Patrons->find( $self->{patron_id} ); > > # We should remove accountno, it is no longer needed >- my $last = Koha::Account::Lines->search( >- { >- borrowernumber => $self->{patron_id} >- }, >- { >- order_by => 'accountno' >- } >- )->next(); >+ my $last = $self->lines->search( >+ {}, >+ { order_by => 'accountno' } )->next(); > my $accountno = $last ? $last->accountno + 1 : 1; > > my $manager_id = $userenv ? $userenv->{number} : 0; >@@ -156,9 +151,8 @@ sub pay { > # than the what was owed on the given line. In that case pay down other > # lines with remaining balance. > my @outstanding_fines; >- @outstanding_fines = Koha::Account::Lines->search( >+ @outstanding_fines = $self->lines->search( > { >- borrowernumber => $self->{patron_id}, > amountoutstanding => { '>' => 0 }, > } > ) if $balance_remaining > 0; >@@ -350,7 +344,8 @@ sub add_credit { > $schema->txn_do( > sub { > # We should remove accountno, it is no longer needed >- my $last = Koha::Account::Lines->search( { borrowernumber => $self->{patron_id} }, >+ my $last = $self->lines->search( >+ {}, > { order_by => 'accountno' } )->next(); > my $accountno = $last ? $last->accountno + 1 : 1; > >@@ -421,11 +416,7 @@ Return the balance (sum of amountoutstanding columns) > > sub balance { > my ($self) = @_; >- return Koha::Account::Lines->search( >- { >- borrowernumber => $self->{patron_id}, >- } >- )->total_outstanding; >+ return $self->lines->total_outstanding; > } > > =head3 outstanding_debits >@@ -437,9 +428,8 @@ my $lines = Koha::Account->new({ patron_id => $patron_id })->outstanding_debits; > sub outstanding_debits { > my ($self) = @_; > >- my $lines = Koha::Account::Lines->search( >+ my $lines = $self->lines->search( > { >- borrowernumber => $self->{patron_id}, > amountoutstanding => { '>' => 0 } > } > ); >@@ -456,9 +446,8 @@ my $lines = Koha::Account->new({ patron_id => $patron_id })->outstanding_credits > sub outstanding_credits { > my ($self) = @_; > >- my $lines = Koha::Account::Lines->search( >+ my $lines = $self->lines->search( > { >- borrowernumber => $self->{patron_id}, > amountoutstanding => { '<' => 0 } > } > ); >@@ -501,9 +490,8 @@ sub non_issues_charges { > } > @not_fines = map { substr( $_, 0, $ACCOUNT_TYPE_LENGTH ) } uniq(@not_fines); > >- return Koha::Account::Lines->search( >+ return $self->lines->search( > { >- borrowernumber => $self->{patron_id}, > accounttype => { -not_in => \@not_fines } > }, > )->total_outstanding; >-- >2.19.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21696
:
81332
|
81333
| 81359