From 73dedb8d39871eb3461ac39e77d613518a8050db Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Wed, 8 Aug 2018 17:23:20 +0000
Subject: [PATCH] Bug 21181: Make cancel_expired_reserves.pl Cancel all holds
 not waiting if ExpireReservesMaxPickupDelay not set

To test:
0 - Make sure ExpireReservesMaxPickupDelay is set to 'Don't allow'
1 - Place a hold for a patron
2 - Check in at another library to set it in transit
3 - Update expirationdate of hold to be in the past
    UPDATE reserves SET expirationdate='1999-12-31'
4 - Run cancel_expired_holds.pl
5 - Hold is not canceled
6 - Apply patch
7 - Run again
8 - Hold is cancelled

Followed test plan and patch works as described, also passes QA test
tool
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
---
 C4/Reserves.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 91966bd..fe39bcf 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -808,7 +808,7 @@ sub CancelExpiredReserves {
 
     my $dtf = Koha::Database->new->schema->storage->datetime_parser;
     my $params = { expirationdate => { '<', $dtf->format_date($today) } };
-    $params->{found} = undef unless $expireWaiting;
+    $params->{found} = { '!=' , 'W' }  unless $expireWaiting;
 
     # FIXME To move to Koha::Holds->search_expired (?)
     my $holds = Koha::Holds->search( $params );
-- 
2.1.4