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

(-)a/Koha/Recalls.pm (-2 / +8 lines)
Lines 142-149 sub add_recall { Link Here
142
        });
142
        });
143
        my $due_interval = defined $recall_due_date_interval ? $recall_due_date_interval->rule_value : 5;
143
        my $due_interval = defined $recall_due_date_interval ? $recall_due_date_interval->rule_value : 5;
144
        my $timestamp = dt_from_string( $recall->timestamp );
144
        my $timestamp = dt_from_string( $recall->timestamp );
145
        my $due_date = $timestamp->add( days => $due_interval );
145
        my $checkout_timestamp = dt_from_string( $checkout->date_due );
146
        $checkout->update({ date_due => $due_date });
146
        my $due_date = $timestamp->set(
147
            {
148
                hour   => $checkout_timestamp->hour, minute => $checkout_timestamp->minute,
149
                second => $checkout_timestamp->second
150
            }
151
        )->add( days => $due_interval );
152
        $checkout->update( { date_due => $due_date } );
147
153
148
        # get itemnumber of most relevant checkout if a biblio-level recall
154
        # get itemnumber of most relevant checkout if a biblio-level recall
149
        unless ( $recall->item_level ) { $itemnumber = $checkout->itemnumber; }
155
        unless ( $recall->item_level ) { $itemnumber = $checkout->itemnumber; }
(-)a/t/db_dependent/Koha/Recalls.t (-3 / +8 lines)
Lines 136-143 is( $due_interval, 3, "Recall due date interval is based on circulation rules" ) Link Here
136
});
136
});
137
is( $recall->item_level, 0, "No item provided so recall not flagged as item-level" );
137
is( $recall->item_level, 0, "No item provided so recall not flagged as item-level" );
138
138
139
my $expected_due_date = dt_from_string->add( days => 3 );
139
my $checkout_timestamp = dt_from_string( $recall->checkout->date_due );
140
is( t::lib::Dates::compare( $recall->checkout->date_due, $expected_due_date ), 0, "Checkout due date has correctly been extended by recall_due_date_interval days" );
140
my $expected_due_date  = dt_from_string->set(
141
    { hour => $checkout_timestamp->hour, minute => $checkout_timestamp->minute, second => $checkout_timestamp->second }
142
)->add( days => 3 );
143
is(
144
    t::lib::Dates::compare( $recall->checkout->date_due, $expected_due_date ), 0,
145
    "Checkout due date has correctly been extended by recall_due_date_interval days"
146
);
141
is( t::lib::Dates::compare( $due_date, $expected_due_date ), 0, "Due date correctly returned" );
147
is( t::lib::Dates::compare( $due_date, $expected_due_date ), 0, "Due date correctly returned" );
142
148
143
my $messages_count = Koha::Notice::Messages->search({ borrowernumber => $patron3->borrowernumber, letter_code => 'RETURN_RECALLED_ITEM' })->count;
149
my $messages_count = Koha::Notice::Messages->search({ borrowernumber => $patron3->borrowernumber, letter_code => 'RETURN_RECALLED_ITEM' })->count;
144
- 

Return to bug 31147