From: Jason Boyer Date: Sun, 7 Aug 2016 23:14:45 +0000 (-0400) Subject: Explicitly Support Placing "In-Network" Holds X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fjboyer%2Frequestitem_localhold;p=working%2FNCIPServer.git Explicitly Support Placing "In-Network" Holds In a consortial setting, SHAREit can be told the makeup of your local "network" of systems, and if an item can be found in-network, a local hold can be placed instead of an ILL request. Without this change, the item must be held by the user's home library specifically. Signed-off-by: Jason Boyer --- diff --git a/lib/NCIP/ILS/Evergreen.pm b/lib/NCIP/ILS/Evergreen.pm index 85aa440..16b1f8a 100644 --- a/lib/NCIP/ILS/Evergreen.pm +++ b/lib/NCIP/ILS/Evergreen.pm @@ -2341,8 +2341,12 @@ sub place_hold { } elsif (ref($item) eq 'Fieldmapper::biblio::record_entry') { $params->{hold_type} = 'T'; if ($org_unit && ref($org_unit) eq 'Fieldmapper::actor::org_unit') { - $params->{selection_ou} = $org_unit->id(); - $params->{depth} = $org_unit->ou_type->depth() if (ref($org_unit->ou_type())); + # If the user home ou is in the same system as our service account assume it's an institutional account and + # limit the selection ou and depth, otherwise assume a "regular" hold. + if ( $U->org_unit_ancestor_at_depth($user->home_ou->id(), 1) == $U->org_unit_ancestor_at_depth($self->{session}->{work_ou}->id(), 1) ) { + $params->{selection_ou} = $org_unit->id(); + $params->{depth} = $org_unit->ou_type->depth() if (ref($org_unit->ou_type())); + } } }