Bugzilla – Attachment 105620 Details for
Bug 25683
update_patron_categories.pl should recognize no fine history = 0 outstanding fines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25683: (bug 17168 follow-up) Don't consider negative balance
Bug-25683-bug-17168-follow-up-Dont-consider-negati.patch (text/plain), 3.24 KB, created by
Jonathan Druart
on 2020-06-08 08:13:49 UTC
(
hide
)
Description:
Bug 25683: (bug 17168 follow-up) Don't consider negative balance
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-06-08 08:13:49 UTC
Size:
3.24 KB
patch
obsolete
>From 244e842a35a27e0378c4417ab0b370c453f75fab Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 8 Jun 2020 10:12:07 +0200 >Subject: [PATCH] Bug 25683: (bug 17168 follow-up) Don't consider negative > balance > >Test plan: >- Have a patron with nothing in accountlines >- run update_patron_categories to find patrons with fines under $5 (-fu=5) >- Your patron is not found >- Give your patron a manual charge of $1 >- rerun the cron, your patron is found >- pay off your patron's fine, putting their balance at $0 >- rerun the cron, your patron is not found >--- > Koha/Patrons.pm | 6 ++++-- > t/db_dependent/Patrons.t | 4 +++- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 6943018e88..d41dd39bb8 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -399,8 +399,10 @@ sub search_patrons_to_update_category { > $query{join} = ["accountlines"]; > $query{select} = ["borrowernumber", "accountlines.amountoutstanding" ]; > $query{group_by} = ["borrowernumber"]; >- $query{having} = \['sum(accountlines.amountoutstanding) <= ?',$params->{fine_max}] if defined $params->{fine_max}; >- $query{having} = \['sum(accountlines.amountoutstanding) >= ?',$params->{fine_min}] if defined $params->{fine_min}; >+ $query{having} = >+ defined $params->{fine_max} >+ ? \['sum(accountlines.amountoutstanding) BETWEEN ? AND ?', $params->{fine_min} || 0.01, $params->{fine_max}] >+ : \['sum(accountlines.amountoutstanding) >= ?', $params->{fine_min}]; > } > return $self->search($search_params,\%query); > } >diff --git a/t/db_dependent/Patrons.t b/t/db_dependent/Patrons.t >index b11a9d34f5..c75e52fffe 100755 >--- a/t/db_dependent/Patrons.t >+++ b/t/db_dependent/Patrons.t >@@ -106,7 +106,7 @@ foreach my $b ( $patrons->as_list() ) { > } > > subtest "Update patron categories" => sub { >- plan tests => 19; >+ plan tests => 20; > t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' ); > my $c_categorycode = $builder->build({ source => 'Category', value => { > category_type=>'C', >@@ -182,6 +182,8 @@ subtest "Update patron categories" => sub { > is( Koha::Patrons->search_patrons_to_update_category({from=>$a_categorycode,fine_min=>5})->next->borrowernumber,$adult2->borrowernumber,'One patron with fines over $5 is expected one'); > is( Koha::Patrons->search_patrons_to_update_category({from=>$a_categorycode,fine_max=>5})->count,1,'One patron with fines under $5'); > is( Koha::Patrons->search_patrons_to_update_category({from=>$a_categorycode,fine_max=>5})->next->borrowernumber,$adult1->borrowernumber,'One patron with fines under $5 is expected one'); >+ $adult1->account->add_credit({ amount => 4.99, interface => 'test' }); >+ is( Koha::Patrons->search_patrons_to_update_category({from=>$a_categorycode,fine_max=>5})->count,0,'No patron with fines under $5'); > > is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,3,'Guarantor has 3 guarantees'); > is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode})->update_category_to({category=>$c_categorycode_2}),3,'Three child patrons updated to another child category with no params passed'); >-- >2.20.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 25683
:
105620
|
105660
|
105662
|
105690
|
105704
|
105705
|
107792
|
107850
|
107851
|
107852