From b68ebd45180f1defb175760e120c335c88cf4577 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sun, 14 Sep 2014 13:30:59 -0400 Subject: [PATCH] UserId does not repeat if present in a message. Alter NCIP::ILS->find_user_barcode() to not make an array ref out of UserId inputs. It is not supposed to repeat. Signed-off-by: Jason Stephenson --- lib/NCIP/ILS.pm | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/lib/NCIP/ILS.pm b/lib/NCIP/ILS.pm index 49c9c3a..3173ed0 100644 --- a/lib/NCIP/ILS.pm +++ b/lib/NCIP/ILS.pm @@ -324,26 +324,12 @@ sub find_user_barcode { my $field; my $message = $self->parse_request_type($request); - # Check for UserId first because it is more common and still valid - # in LookupUser. + # Check for UserId first because it is more common and valid + # in most messages. my $authinput = $request->{$message}->{UserId}; if ($authinput) { $field = 'UserIdentifierValue'; - if (ref $authinput ne 'ARRAY') { - $authinput = [$authinput]; - } - foreach my $input (@$authinput) { - # UserIdentifierType is optional, so we check if it is - # there. If it is, we skip this entry unless the - # identifier type contains the string barcode - if ($input->{UserIdentifierType}) { - next unless ($input->{UserIdentifierType} =~ /barcode/i); - } - # We take the first field we find, unless the - # identifier type says it is not a barcode. - $barcode = $input->{$field}; - last; - } + $barcode = $authinput->{$field}; } elsif ($message eq 'LookupUser') { $field = 'AuthenticationInputData'; $authinput = $request->{$message}->{AuthenticationInput}; -- 2.43.2