View | Details | Raw Unified | Return to bug 21549
Collapse All | Expand All

(-)a/Koha/Patrons.pm (-3 / +3 lines)
Lines 233-247 sub delete { Link Here
233
    return $patrons_deleted;
233
    return $patrons_deleted;
234
}
234
}
235
235
236
=head3 filter_by_dateexpiry
236
=head3 filter_by_expiration_date
237
237
238
    Koha::Patrons->filter_by_dateexpiry{{ days => $x });
238
    Koha::Patrons->filter_by_expiration_date{{ days => $x });
239
239
240
    Returns set of Koha patron objects expired $x days.
240
    Returns set of Koha patron objects expired $x days.
241
241
242
=cut
242
=cut
243
243
244
sub filter_by_dateexpiry {
244
sub filter_by_expiration_date {
245
    my ( $class, $params ) = @_;
245
    my ( $class, $params ) = @_;
246
246
247
    return $class->filter_by_last_update(
247
    return $class->filter_by_last_update(
(-)a/misc/cronjobs/cleanup_database.pl (-1 / +1 lines)
Lines 405-411 if($allDebarments) { Link Here
405
# Lock expired patrons?
405
# Lock expired patrons?
406
if( defined $lock_days && $lock_days ne q{} ) {
406
if( defined $lock_days && $lock_days ne q{} ) {
407
    say "Start locking expired patrons" if $verbose;
407
    say "Start locking expired patrons" if $verbose;
408
    my $expired_patrons = Koha::Patrons->filter_by_dateexpiry({ days => $lock_days })->search({ login_attempts => { '!=' => -1 } });
408
    my $expired_patrons = Koha::Patrons->filter_by_expiration_date({ days => $lock_days })->search({ login_attempts => { '!=' => -1 } });
409
    my $count = $expired_patrons->count;
409
    my $count = $expired_patrons->count;
410
    $expired_patrons->lock({ remove => 1 }) if $confirm;
410
    $expired_patrons->lock({ remove => 1 }) if $confirm;
411
    if( $verbose ) {
411
    if( $verbose ) {
(-)a/t/db_dependent/Koha/Patrons.t (-6 / +5 lines)
Lines 1798-1813 subtest '->set_password' => sub { Link Here
1798
};
1798
};
1799
1799
1800
$schema->storage->txn_begin;
1800
$schema->storage->txn_begin;
1801
subtest 'filter_by_dateexpiry' => sub {
1801
subtest 'filter_by_expiration_date' => sub {
1802
    plan tests => 3;
1802
    plan tests => 3;
1803
    my $count1 = Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count;
1803
    my $count1 = Koha::Patrons->filter_by_expiration_date({ days => 28 })->count;
1804
    my $patron1 = $builder->build_object({ class => 'Koha::Patrons' });
1804
    my $patron1 = $builder->build_object({ class => 'Koha::Patrons' });
1805
    $patron1->dateexpiry( dt_from_string->subtract(days => 27) )->store;
1805
    $patron1->dateexpiry( dt_from_string->subtract(days => 27) )->store;
1806
    is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1, 'No more expired' );
1806
    is( Koha::Patrons->filter_by_expiration_date({ days => 28 })->count, $count1, 'No more expired' );
1807
    $patron1->dateexpiry( dt_from_string->subtract(days => 28) )->store;
1807
    $patron1->dateexpiry( dt_from_string->subtract(days => 28) )->store;
1808
    is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1 + 1, 'One more expired' );
1808
    is( Koha::Patrons->filter_by_expiration_date({ days => 28 })->count, $count1 + 1, 'One more expired' );
1809
    $patron1->dateexpiry( dt_from_string->subtract(days => 29) )->store;
1809
    $patron1->dateexpiry( dt_from_string->subtract(days => 29) )->store;
1810
    is( Koha::Patrons->filter_by_dateexpiry({ days => 28 })->count, $count1 + 1, 'Same number again' );
1810
    is( Koha::Patrons->filter_by_expiration_date({ days => 28 })->count, $count1 + 1, 'Same number again' );
1811
};
1811
};
1812
1812
1813
subtest 'search_unsubscribed' => sub {
1813
subtest 'search_unsubscribed' => sub {
1814
- 

Return to bug 21549