From 6c58590f58df6825d39c8c973e56f237722fcfa2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 12 Apr 2021 16:12:50 +0200 Subject: [PATCH] Bug 21549: Rename filter_by_dateexpiry with filter_by_expiration_date Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- 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 d42f035e4c..616fefacba 100644 --- a/Koha/Patrons.pm +++ b/Koha/Patrons.pm @@ -233,15 +233,15 @@ sub delete { return $patrons_deleted; } -=head3 filter_by_dateexpiry +=head3 filter_by_expiration_date - Koha::Patrons->filter_by_dateexpiry{{ days => $x }); + Koha::Patrons->filter_by_expiration_date{{ days => $x }); Returns set of Koha patron objects expired $x days. =cut -sub filter_by_dateexpiry { +sub filter_by_expiration_date { my ( $class, $params ) = @_; return $class->filter_by_last_update( diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index c4a86d1855..4f56e9b4d3 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -405,7 +405,7 @@ if($allDebarments) { # Lock expired patrons? if( defined $lock_days && $lock_days ne q{} ) { say "Start locking expired patrons" if $verbose; - my $expired_patrons = Koha::Patrons->filter_by_dateexpiry({ days => $lock_days })->search({ login_attempts => { '!=' => -1 } }); + my $expired_patrons = Koha::Patrons->filter_by_expiration_date({ days => $lock_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 6f03a9c9d3..e2bc736665 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 'filter_by_dateexpiry' => sub { +subtest 'filter_by_expiration_date' => sub { plan tests => 3; - my $count1 = Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count; + my $count1 = Koha::Patrons->filter_by_expiration_date({ days => 28 })->count; my $patron1 = $builder->build_object({ class => 'Koha::Patrons' }); $patron1->dateexpiry( dt_from_string->subtract(days => 27) )->store; - is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1, 'No more expired' ); + is( Koha::Patrons->filter_by_expiration_date({ days => 28 })->count, $count1, 'No more expired' ); $patron1->dateexpiry( dt_from_string->subtract(days => 28) )->store; - is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1 + 1, 'One more expired' ); + is( Koha::Patrons->filter_by_expiration_date({ days => 28 })->count, $count1 + 1, 'One more expired' ); $patron1->dateexpiry( dt_from_string->subtract(days => 29) )->store; - is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1 + 1, 'Same number again' ); + is( Koha::Patrons->filter_by_expiration_date({ days => 28 })->count, $count1 + 1, 'Same number again' ); }; subtest 'search_unsubscribed' => sub { -- 2.39.5