From f4ae5845f3919c79ce46d21cc9dd2ac49d4683bd Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Wed, 2 Dec 2015 13:32:19 -0500 Subject: [PATCH] Use dummy call number in NCIP::ILS::Evergreen->acceptitem. We have received an AcceptItem message with a missing call number for the incoming copy. This prevents Evergreen from accepting the item because Evergreen needs a call number to link the new copy to the new bibliographic record. This commit will use either the FromAgencyId and RequestId concatenated or the copy barcode as the call number when no call number is provided. This may not be an issue with the use precats option. However, there are still issues with precats in Evergreen, so use of that option is strongly discouraged. Signed-off-by: Jason Stephenson --- lib/NCIP/ILS/Evergreen.pm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/NCIP/ILS/Evergreen.pm b/lib/NCIP/ILS/Evergreen.pm index f8bba19..63e83f5 100644 --- a/lib/NCIP/ILS/Evergreen.pm +++ b/lib/NCIP/ILS/Evergreen.pm @@ -273,11 +273,31 @@ sub acceptitem { electronic => $request->{$message}->{ItemOptionalFields}->{BibliographicDescription}->{ElectronicResource} }; + # Add a "dummy" call_number if call_number is not set to something usable. + if (!$item_info->{call_number} || (ref($item_info->{call_number}) eq 'HASH' && !%{$item_info->{call_number}})) { + # We'll concatenate the FromAgenyId and the RequestId, and + # if that doesn't work, use the barcode. + my $from_agy = $request->{$message}->{InitiationHeader}->{FromAgencyId}->{AgencyId}; + my $request_id = $request->{$message}->{RequestId}->{RequestIdentifierValue}; + # Being a little overcautious here. + if ($from_agy && !ref($from_agy)) { + $from_agy =~ s/^.*://; + } else { + undef($from_agy); + } + # And here. + if ($from_agy && $request_id && !ref($request_id)) { + $item_info->{call_number} = $from_agy . " " . $request_id; + } else { + $item_info->{call_number} = $item_info->{barcode}; + } + } + if ($self->{config}->{items}->{use_precats}) { # We only need to create a precat copy. $item = $self->create_precat_copy($item_info); } else { - # We have to create a "partial" bib record, a call number and a copy. + # We have to create a "partial" bib record, a call number, and a copy. $item = $self->create_fuller_copy($item_info); } -- 2.43.2