Bug 30362: Fix GetSoonestRenewDate to really return soonest renew date
This change fixes GetSoonestRenewDate so that it returns the soonest renew date as calculated using "No Renewal Before" and "NoRenewalBeforePrecision". In the past, it would only return the soonest renew date if "$now" was lesser than it, which would typically only happen when using an "exact" precision rather than a "date" precision. Test plan: 0. Apply the patch 1. prove t/db_dependent/Circulation.t Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
95aa1c3da5
commit
f8c474019d
2 changed files with 3 additions and 2 deletions
|
@ -3457,7 +3457,7 @@ sub GetSoonestRenewDate {
|
|||
{
|
||||
$soonestrenewal->truncate( to => 'day' );
|
||||
}
|
||||
return $soonestrenewal if $now < $soonestrenewal;
|
||||
return $soonestrenewal;
|
||||
} elsif ( $issue->auto_renew && $patron->autorenew_checkouts ) {
|
||||
# Checkouts with auto-renewing fall back to due date
|
||||
my $soonestrenewal = dt_from_string( $issue->date_due );
|
||||
|
|
|
@ -5869,12 +5869,13 @@ subtest "GetSoonestRenewDate tests" => sub {
|
|||
rule_value => 1,
|
||||
}
|
||||
);
|
||||
$issue->date_due( dt_from_string )->store;
|
||||
$issue->date_due(dt_from_string)->store;
|
||||
is(
|
||||
GetSoonestRenewDate( $patron, $issue ),
|
||||
dt_from_string->subtract( days => 1 )->truncate( to => 'day' ),
|
||||
'Checkouts with auto-renewal can be renewed 1 day before due date if no renewalbefore = 1 and precision = "date"'
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
subtest "CanBookBeIssued + needsconfirmation message" => sub {
|
||||
|
|
Loading…
Reference in a new issue