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 );