Bugzilla – Attachment 95875 Details for
Bug 24114
Remove warn statements from Koha::Patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24114: (follow-up) Resolve warning on non-numeric subtraction
Bug-24114-follow-up-Resolve-warning-on-non-numeric.patch (text/plain), 2.47 KB, created by
Marcel de Rooy
on 2019-11-29 10:15:09 UTC
(
hide
)
Description:
Bug 24114: (follow-up) Resolve warning on non-numeric subtraction
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-11-29 10:15:09 UTC
Size:
2.47 KB
patch
obsolete
>From c0cdd9a1ba98877b2d77a8685ad3288232883d73 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 29 Nov 2019 09:17:19 +0000 >Subject: [PATCH] Bug 24114: (follow-up) Resolve warning on non-numeric > subtraction >Content-Type: text/plain; charset=utf-8 > >Argument "" isn't numeric in subtraction (-) at /usr/share/koha/Koha/Patrons.pm line 290. > >Coming from an empty or undefined FailedLoginAttempts. > >Test plan: >Verify that Koha/Patrons.t still passes. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Patrons.pm | 2 +- > t/db_dependent/Koha/Patrons.t | 11 ++++++++++- > 2 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index e67bb9f165..9aae569774 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -286,7 +286,7 @@ sub search_anonymize_candidates { > $cond->{dateexpiry} = { '<=' => $str }; > $cond->{anonymized} = 0; # not yet done > if( $params->{locked} ) { >- my $fails = C4::Context->preference('FailedLoginAttempts'); >+ my $fails = C4::Context->preference('FailedLoginAttempts') || 0; > $cond->{login_attempts} = [ -and => { '!=' => undef }, { -not_in => [0, 1..$fails-1 ] } ]; # -not_in does not like undef > } > return $class->search( $cond ); >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 4d7063c497..16ed0d3abb 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1837,7 +1837,7 @@ subtest 'search_unsubscribed' => sub { > }; > > subtest 'search_anonymize_candidates' => sub { >- plan tests => 5; >+ plan tests => 7; > my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); > my $patron2 = $builder->build_object({ class => 'Koha::Patrons' }); > $patron1->anonymized(0); >@@ -1879,6 +1879,15 @@ subtest 'search_anonymize_candidates' => sub { > $patron1->login_attempts(3)->store; > is( Koha::Patrons->search_anonymize_candidates({locked => 1})->count, > $cnt+1, 'Locked flag' ); >+ >+ t::lib::Mocks::mock_preference( 'FailedLoginAttempts', q{} ); >+ # Patron 1 still on 3 == locked >+ is( Koha::Patrons->search_anonymize_candidates({locked => 1})->count, >+ $cnt+1, 'Still expect same number for FailedLoginAttempts empty' ); >+ $patron1->login_attempts(0)->store; >+ # Patron 1 unlocked >+ is( Koha::Patrons->search_anonymize_candidates({locked => 1})->count, >+ $cnt, 'Patron 1 unlocked' ); > }; > > subtest 'search_anonymized' => sub { >-- >2.11.0
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 24114
:
95814
|
95874
|
95875
|
95876
|
99446
|
99447
|
99448
|
99449
|
99450
|
99499
|
99500
|
99501