Consistent response type from TPAC pref lib lookup collab/berick/tpac-mylist-callnumber
authorBill Erickson <berick@esilibrary.com>
Mon, 28 Jan 2013 18:40:12 +0000 (13:40 -0500)
committerBill Erickson <berick@esilibrary.com>
Mon, 28 Jan 2013 18:42:36 +0000 (13:42 -0500)
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>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm

index 15d67be..1b21646 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}) {