Consistent response type from TPAC pref lib lookup
authorBill Erickson <berick@esilibrary.com>
Mon, 28 Jan 2013 18:40:12 +0000 (13:40 -0500)
committerBen Shum <bshum@biblio.org>
Mon, 11 Mar 2013 21:42:51 +0000 (17:42 -0400)
In some contexts, the $user->home_ou field is fleshed with a real org
unit object.  Ensure that the response value from _get_pref_lib in the
TPAC takes this into consideration when finding the ID of the user's
home org unit.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm

index 39f986f..93cc3e1 100644 (file)
@@ -392,7 +392,8 @@ sub _get_pref_lib {
         return OpenSRF::Utils::JSON->JSON2perl($lset->value) if $lset;
 
         # Otherwise return the user's home library
-        return $ctx->{user}->home_ou;
+        my $ou = $ctx->{user}->home_ou;
+        return ref($ou) ? $ou->id : $ou;
     }
 
     if ($ctx->{physical_loc}) {