diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 37d1e63b96..8b4a4c7e8f 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1038,7 +1038,7 @@ sub is_going_to_expire { return 0 unless $self->dateexpiry; return 0 if $self->dateexpiry =~ '^9999'; return 1 - if dt_from_string( $self->dateexpiry, undef, 'floating' )->subtract( days => $delay ) < + if dt_from_string( $self->dateexpiry, undef, 'floating' )->subtract( days => $delay ) <= dt_from_string( undef, undef, 'floating' )->truncate( to => 'day' ); return 0; } diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index db23712491..b9ec7fa500 100755 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -417,8 +417,8 @@ subtest 'is_going_to_expire' => sub { t::lib::Mocks::mock_preference( 'NotifyBorrowerDeparture', 10 ); $patron->dateexpiry( $today->clone->add( days => 10 ) )->store->discard_changes; is( - $patron->is_going_to_expire, 0, - 'Patron should not be considered going to expire if dateexpiry is 10 days ahead and pref is 10' + $patron->is_going_to_expire, 1, + 'Patron should be considered going to expire if dateexpiry is 10 days ahead and pref is 10' ); $patron->delete;