From 13da6b8cf47ec16284e3fe680a1fd0fbf8105b5c Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Thu, 20 Nov 2014 17:41:44 -0500 Subject: [PATCH] LP#1394989: Make users_of_interest test for defined actor.usr.card values If the open-ils.collections.users_of_interest API encounters a patron that has a null "card" value in actor.usr the API will crash with an error like: Received Exception: Name: osrfMethodException Status: *** Call to [open-ils.collections.users_of_interest.retrieve] failed for session [1416515351.333446.1416515351406], thread trace [1]: Can't call method "barcode" on an undefined value at /usr/local/share/perl/5.14.2/OpenILS/Application/Collections.pm line 299. This patches users_of_interest to provide "undef" in the event that there is not a proper barcode associated with the user when retrieving results for the API call. Signed-off-by: Michael Peters Signed-off-by: Ben Shum --- Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm index e3fb51156f..a377029b66 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm @@ -295,7 +295,7 @@ sub process_users_of_interest_results { id => $u->id, dob => $u->dob, profile => $u->profile->name, - barcode => $u->card->barcode, + barcode => $u->card ? $u->card->barcode : undef , groups => [ map { $_->name } @{$u->groups} ], }; -- 2.43.2