Bug 19619: Add support for SIP2 field CM ( Hold Pickup Date ) to Koha
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 8 Jan 2019 15:40:21 +0000 (10:40 -0500)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 18 Apr 2019 11:57:18 +0000 (11:57 +0000)
The CM field was all set up for implementation, but never completed.
We should fully implement the CM ( Hold Pickup Date ), which according
to the SIP2 protocol specification is "The date that the hold expires".

Test Plan:
1) Set up a waiting hold for an item
2) Using the sip cli emulator, send an item information request for that item
3) Note the CM field does not show up
4) Apply this patch
5) Restart all the things!
6) Repeat the item information request
7) Note the CM field is now transmitted!

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/SIP/ILS/Item.pm

index 7e246bc..7a88570 100644 (file)
@@ -28,6 +28,7 @@ use Koha::Checkouts;
 use Koha::DateUtils;
 use Koha::Patrons;
 use Koha::Items;
+use Koha::Holds;
 
 =encoding UTF-8
 
@@ -325,7 +326,13 @@ sub recall_date {
 }
 sub hold_pickup_date {
     my $self = shift;
-    return $self->{hold_pickup_date} || 0;
+
+    my $hold = Koha::Holds->find({ itemnumber => $self->{itemnumber}, found => 'W' });
+    if ( $hold ) {
+        return $hold->expirationdate || 0;
+    }
+
+    return 0;
 }
 
 # This is a partial check of "availability".  It is not supposed to check everything here.