Browse Source

Bug 29476: (follow-up) Fix return, add precision test

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
master
Nick Clemens 1 month ago
committed by Fridolin Somers
parent
commit
cdf19f8ed6
  1. 2
      C4/Circulation.pm
  2. 9
      t/db_dependent/Circulation.t

2
C4/Circulation.pm

@ -3199,7 +3199,7 @@ sub GetSoonestRenewDate {
return $soonestrenewal if $now < $soonestrenewal;
} elsif ( $itemissue->auto_renew && $patron->autorenew_checkouts ) {
# Checkouts with auto-renewing fall back to due date
my $soonestrenewal = return dt_from_string( $itemissue->date_due );
my $soonestrenewal = dt_from_string( $itemissue->date_due );
if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date'
and $issuing_rule->{lengthunit} eq 'days' )
{

9
t/db_dependent/Circulation.t

@ -4957,7 +4957,7 @@ subtest "SendCirculationAlert" => sub {
};
subtest "GetSoonestRenewDate tests" => sub {
plan tests => 4;
plan tests => 5;
Koha::CirculationRules->set_rule(
{
categorycode => undef,
@ -5007,7 +5007,14 @@ subtest "GetSoonestRenewDate tests" => sub {
'Checkouts without auto-renewal can be renewed immediately if no norenewalbefore'
);
t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'date' );
$issue->auto_renew(1)->store;
is(
GetSoonestRenewDate( $patron->id, $item->itemnumber ),
$datedue->clone->truncate( to => 'day' ),
'Checkouts with auto-renewal can be renewed earliest on due date if no renewalbefore'
);
t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'exact' );
is(
GetSoonestRenewDate( $patron->id, $item->itemnumber ),
$datedue,

Loading…
Cancel
Save