Bugzilla – Attachment 118519 Details for
Bug 21549
Lock expired patron accounts after x days
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21549: (follow-up) Switch to filter_by
Bug-21549-follow-up-Switch-to-filterby.patch (text/plain), 3.37 KB, created by
Nick Clemens (kidclamp)
on 2021-03-19 12:04:43 UTC
(
hide
)
Description:
Bug 21549: (follow-up) Switch to filter_by
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-03-19 12:04:43 UTC
Size:
3.37 KB
patch
obsolete
>From d2b821583f4b111f3cd365ba24337650def5fb6a Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 19 Mar 2021 08:11:27 +0000 >Subject: [PATCH] Bug 21549: (follow-up) Switch to filter_by > >See QA remarks. > >Test plan: >Run t/db_dependent/Koha/Patrons.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Patrons.pm | 6 +++--- > misc/cronjobs/cleanup_database.pl | 2 +- > t/db_dependent/Koha/Patrons.t | 10 +++++----- > 3 files changed, 9 insertions(+), 9 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 9a3977704f..97fac5e60d 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -233,15 +233,15 @@ sub delete { > return $patrons_deleted; > } > >-=head3 search_expired >+=head3 filter_by_dateexpiry > >- Koha::Patrons->search_expired{{ days => $x }); >+ Koha::Patrons->filter_by_dateexpiry{{ days => $x }); > > Returns set of Koha patron objects expired $x days. > > =cut > >-sub search_expired { >+sub filter_by_dateexpiry { > my ( $class, $params ) = @_; > my $days = $params->{days} || 0; > my $parser = Koha::Database->new->schema->storage->datetime_parser; >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index 07bd2622f9..10ff3e6985 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -404,7 +404,7 @@ if($allDebarments) { > my $days = C4::Context->preference('LockExpiredDelay'); > if( defined $days && $days ne q{} ) { > say "Start locking expired patrons" if $verbose; >- my $expired_patrons = Koha::Patrons->search_expired({ days => $days })->search({ login_attempts => { '!=' => -1 } }); >+ my $expired_patrons = Koha::Patrons->filter_by_dateexpiry({ days => $days })->search({ login_attempts => { '!=' => -1 } }); > my $count = $expired_patrons->count; > $expired_patrons->lock({ remove => 1 }) if $confirm; > if( $verbose ) { >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 26e3366855..eabcf26dab 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1798,16 +1798,16 @@ subtest '->set_password' => sub { > }; > > $schema->storage->txn_begin; >-subtest 'search_expired' => sub { >+subtest 'filter_by_dateexpiry' => sub { > plan tests => 3; >- my $count1 = Koha::Patrons->search_expired({ days => 28 })->count; >+ my $count1 = Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count; > my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); > $patron1->dateexpiry( dt_from_string->subtract(days => 27) )->store; >- is( Koha::Patrons->search_expired({ days => 28 })->count, $count1, 'No more expired' ); >+ is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1, 'No more expired' ); > $patron1->dateexpiry( dt_from_string->subtract(days => 28) )->store; >- is( Koha::Patrons->search_expired({ days => 28 })->count, $count1 + 1, 'One more expired' ); >+ is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1 + 1, 'One more expired' ); > $patron1->dateexpiry( dt_from_string->subtract(days => 29) )->store; >- is( Koha::Patrons->search_expired({ days => 28 })->count, $count1 + 1, 'Same number again' ); >+ is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1 + 1, 'Same number again' ); > }; > > subtest 'search_unsubscribed' => 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 21549
:
108000
|
108001
|
111480
|
111481
|
113914
|
113915
|
118493
|
118494
|
118495
|
118496
|
118517
|
118518
|
118519
|
118520
|
118521
|
119457
|
119458
|
119459
|
119460
|
119461
|
119462
|
119463
|
119464
|
119525
|
119526
|
119527