Return Item Barcode in RequestItemResponse
authorJason Boyer <jboyer@library.in.gov>
Sun, 7 Aug 2016 21:52:16 +0000 (17:52 -0400)
committerJason Stephenson <jason@sigio.com>
Wed, 5 Apr 2017 13:32:57 +0000 (09:32 -0400)
When a target is successfully targeted handling a RequestItem message,
return the barcode of the targeted item.

Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Jason Stephenson <jason@sigio.com>
lib/NCIP/ILS/Evergreen.pm

index 85aa440..7d3b676 100644 (file)
@@ -1053,6 +1053,17 @@ sub requestitem {
         # Add a hold note with the RequestIdentifierValue for later
         # lookup in CancelRequestItem.  We do not care if it fails.
         $self->create_hold_note($hold, 'NCIP Remote Request ID', $request->{$message}->{RequestId}->{RequestIdentifierValue});
+        my ($itemIdType, $itemIdValue) = ('SYSNUMBER', 'BibId-' . $bre->id());
+        if ($hold->current_copy) {
+            my $copy = $U->simplereq(
+                'open-ils.pcrud',
+                'open-ils.pcrud.retrieve.acp',
+                $self->{session}->{authtoken},
+                $hold->current_copy
+            );
+            $itemIdType = 'Barcode Id';
+            $itemIdValue = $copy->barcode();
+        }
         my $data = {
             RequestId => NCIP::RequestId->new(
                 $request->{$message}->{RequestId}
@@ -1060,8 +1071,8 @@ sub requestitem {
             ItemId => NCIP::Item::Id->new(
                 {
                     AgencyId => $selection_ou->shortname(),
-                    ItemIdentifierValue => $bre->id(),
-                    ItemIdentifierType => 'SYSNUMBER'
+                    ItemIdentifierValue => $itemIdValue,
+                    ItemIdentifierType => $itemIdType
                 }
             ),
             UserId => NCIP::User::Id->new(