Bug 20573: Make NotifyBorrowerDeparture's date math consistent with MembershipExpiryDaysNotice
To test:
1. Set both system preferences NotifyBorrowerDeparture and
MembershipExpiryDaysNotice to 10 days
2. Create or edit a patron account with the following settings:
- expiry date is exactly 10 days in the future
- add an email address on the patron account
- set messaging preferences to receive email notices for Patron
account expiry
3. Run the membership expiry cron job to generate a notice:
ktd --shell
perl misc/cronjobs/membership_expiry.pl -c
4. Check notices tab on patron account
--> A membership expiry notice has been queued for the patron
5. Click back to the patron details
--> Note that there is no alert that the patron account will be expiring
soon
6. Apply patch and restart_all
7. Refresh the patron details page
--> You should now see an alert that the account will be expiring soon
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
fdf37a2630
commit
9cad4c5c8d
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue