Add ItemId to RequestItem output in NCIP::ILS::Evergreen.
authorJason Stephenson <jason@sigio.com>
Thu, 11 Dec 2014 02:39:36 +0000 (21:39 -0500)
committerJason Stephenson <jason@sigio.com>
Thu, 11 Dec 2014 02:47:10 +0000 (21:47 -0500)
Signed-off-by: Jason Stephenson <jason@sigio.com>
lib/NCIP/ILS/Evergreen.pm

index 0d89fe8..37ea5b0 100644 (file)
@@ -1020,6 +1020,19 @@ sub requestitem {
             RequestType => $request->{$message}->{RequestType},
             RequestScopeType => ($hold->hold_type() eq 'V') ? "item" : "bibliographic item"
         };
+        # Fill in the ItemId based on what we have.
+        if ($item_barcode && ref($item_barcode) ne 'NCIP::Problem') {
+            $data->{ItemId} = NCIP::Item::Id->new({
+                ItemIdentifierValue => $item_barcode,
+                ItemIdentifierType => 'Barcode'
+            });
+        } else {
+            $data->{ItemId} = NCIP::Item::Id->new({
+                ItemIdentifierValue => $item->id(),
+                ItemIdentifierType => 'SYSNUMBER'
+            })
+        }
+
         # Look for UserElements requested and add it to the response:
         my $elements = $request->{$message}->{UserElementType};
         if ($elements) {