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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 3208-3214 sub GetSoonestRenewDate { Link Here
3208
        return $soonestrenewal if $now < $soonestrenewal;
3208
        return $soonestrenewal if $now < $soonestrenewal;
3209
    } elsif ( $itemissue->auto_renew && $patron->autorenew_checkouts ) {
3209
    } elsif ( $itemissue->auto_renew && $patron->autorenew_checkouts ) {
3210
        # Checkouts with auto-renewing fall back to due date
3210
        # Checkouts with auto-renewing fall back to due date
3211
        my $soonestrenewal = return dt_from_string( $itemissue->date_due );
3211
        my $soonestrenewal = dt_from_string( $itemissue->date_due );
3212
        if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date'
3212
        if ( C4::Context->preference('NoRenewalBeforePrecision') eq 'date'
3213
            and $issuing_rule->{lengthunit} eq 'days' )
3213
            and $issuing_rule->{lengthunit} eq 'days' )
3214
        {
3214
        {
(-)a/t/db_dependent/Circulation.t (-2 / +8 lines)
Lines 4957-4963 subtest "SendCirculationAlert" => sub { Link Here
4957
};
4957
};
4958
4958
4959
subtest "GetSoonestRenewDate tests" => sub {
4959
subtest "GetSoonestRenewDate tests" => sub {
4960
    plan tests => 4;
4960
    plan tests => 5;
4961
    Koha::CirculationRules->set_rule(
4961
    Koha::CirculationRules->set_rule(
4962
        {
4962
        {
4963
            categorycode => undef,
4963
            categorycode => undef,
Lines 5007-5013 subtest "GetSoonestRenewDate tests" => sub { Link Here
5007
        'Checkouts without auto-renewal can be renewed immediately if no norenewalbefore'
5007
        'Checkouts without auto-renewal can be renewed immediately if no norenewalbefore'
5008
    );
5008
    );
5009
5009
5010
    t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'date' );
5010
    $issue->auto_renew(1)->store;
5011
    $issue->auto_renew(1)->store;
5012
    is(
5013
        GetSoonestRenewDate( $patron->id, $item->itemnumber ),
5014
        $datedue->clone->truncate( to => 'day' ),
5015
        'Checkouts with auto-renewal can be renewed earliest on due date if no renewalbefore'
5016
    );
5017
    t::lib::Mocks::mock_preference( 'NoRenewalBeforePrecision', 'exact' );
5011
    is(
5018
    is(
5012
        GetSoonestRenewDate( $patron->id, $item->itemnumber ),
5019
        GetSoonestRenewDate( $patron->id, $item->itemnumber ),
5013
        $datedue,
5020
        $datedue,
5014
- 

Return to bug 29476