LP 1889628: Use Workstation in SIP Username Lookup
authorJason Stephenson <jason@sigio.com>
Tue, 18 Aug 2020 12:45:07 +0000 (08:45 -0400)
committerJason Stephenson <jason@sigio.com>
Fri, 28 Aug 2020 12:05:43 +0000 (08:05 -0400)
Following a suggestion from Bill Erickson, the SIP->get_ou_settings()
function now uses the workstation org. unit of the logged in SIP2
account if it is set.  The home_ou is used as a fallback.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
docs/RELEASE_NOTES_NEXT/SIP/allow_usrname_in_patron_id.adoc

index 5393765..c1c7a76 100644 (file)
@@ -245,7 +245,11 @@ sub get_ou_setting {
     my $self = shift;
     my $setting = shift;
     my $sess = $self->fetch_session;
-    return $U->ou_ancestor_setting_value($sess->home_ou, $setting);
+    my $ou = (ref($sess->home_ou)) ? $sess->home_ou->id : $sess->home_ou;
+    if ($sess->ws_ou) {
+        $ou = (ref($sess->ws_ou)) ? $sess->ws_ou->id : $sess->ws_ou;
+    }
+    return $U->ou_ancestor_setting_value($ou, $setting);
 }
 
 sub get_barcode_regex {
index c8d1e1d..671bf9d 100644 (file)
@@ -8,6 +8,6 @@ username over their barcode.
 
 The new feature determines if the value in the Patron ID field is a
 barcode or username by comparing the field value against the
-`opac.barcode_regex` setting for the home organizational unit of the
-logged in SIP2 account as configured in the oils_sip.xml file.  This
-is similar to what the OPAC does when a patron logs in.
+`opac.barcode_regex` setting for the organizational unit of the logged
+in SIP2 account as configured in the oils_sip.xml file.  This is
+similar to what the OPAC does when a patron logs in.