@@ -, +, @@ ones and deleted wrongly --- C4/Reserves.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -799,16 +799,18 @@ sub CancelExpiredReserves { my $today = dt_from_string(); my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); + my $expireWaiting = C4::Context->preference('ExpireReservesMaxPickUpDelay'); my $dbh = C4::Context->dbh; my $dtf = Koha::Database->new->schema->storage->datetime_parser; + + my $params = { expirationdate => { '<', $dtf->format_date($today) } }; + + $params->{found} = undef unless $expireWaiting; + # FIXME To move to Koha::Holds->search_expired (?) - my $holds = Koha::Holds->search( - { - expirationdate => { '<', $dtf->format_date($today) } - } - ); + my $holds = Koha::Holds->search( $params ); while ( my $hold = $holds->next ) { my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); --