From bb64b2891ee295dcdb92cbea61ca319d164c8699 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sat, 23 Aug 2014 12:03:42 -0400 Subject: [PATCH] Add lookup for UserId in NCIP::ILS->find_barcode. Signed-off-by: Jason Stephenson --- lib/NCIP/ILS.pm | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/NCIP/ILS.pm b/lib/NCIP/ILS.pm index 2bceb16..00e1124 100644 --- a/lib/NCIP/ILS.pm +++ b/lib/NCIP/ILS.pm @@ -318,15 +318,28 @@ sub find_barcode { return unless($message); if ($message eq 'LookupUser') { my $authinput = $request->{$message}->{AuthenticationInput}; - return unless ($authinput); - # Convert to array ref if it isn't already. - if (ref $authinput ne 'ARRAY') { - $authinput = [$authinput]; - } - foreach my $input (@$authinput) { - if ($input->{AuthenticationInputType} =~ /barcode/i) { - $barcode = $input->{AuthenticationInputData}; - last; + if ($authinput) { + # Convert to array ref if it isn't already. + if (ref $authinput ne 'ARRAY') { + $authinput = [$authinput]; + } + foreach my $input (@$authinput) { + if ($input->{AuthenticationInputType} =~ /barcode/i) { + $barcode = $input->{AuthenticationInputData}; + last; + } + } + } else { + $authinput = $request->{$message}->{UserId}; + return unless($authinput); + if (ref $authinput ne 'ARRAY') { + $authinput = [$authinput]; + } + foreach my $input (@$authinput) { + if ($input->{UserIdentifierType} =~ /barcode/i) { + $barcode = $input->{UserIdentifierValue}; + last; + } } } } -- 2.11.0