From f58b35a0b84f4aa1664d7191c1e98e1f1319df1d Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Wed, 21 Mar 2018 15:08:19 -0400 Subject: [PATCH] LP1757507: Patron Opt-in Restriction Tightening The setting to restrict patron opt-in at a depth should be take precedence over the overall opt-in boundary. This allows locations to be selectively "walled off" regardless of the depth of the regular opt-in boundary. Signed-off-by: Jason Boyer --- Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index e62982e79f..29b6b102a9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -3179,14 +3179,6 @@ sub user_opt_in_at_org { # user is automatically opted-in if they are from the local org return 1 if $user->home_ou eq $ws_org; - # get the boundary setting - my $opt_boundary = $U->ou_ancestor_setting_value($e->requestor->ws_ou,'org.patron_opt_boundary'); - - # auto opt in if user falls within the opt boundary - my $opt_orgs = $U->get_org_descendants($ws_org, $opt_boundary); - - return 1 if grep $_ eq $user->home_ou, @$opt_orgs; - # check whether opt-in is restricted at the user's home library my $opt_restrict_depth = $U->ou_ancestor_setting_value($user->home_ou, 'org.restrict_opt_to_depth'); if ($opt_restrict_depth) { @@ -3198,6 +3190,14 @@ sub user_opt_in_at_org { return 2 unless grep $_ eq $e->requestor->ws_ou, @$unrestricted_orgs; } + # get the boundary setting + my $opt_boundary = $U->ou_ancestor_setting_value($e->requestor->ws_ou,'org.patron_opt_boundary'); + + # auto opt in if user falls within the opt boundary + my $opt_orgs = $U->get_org_descendants($ws_org, $opt_boundary); + + return 1 if grep $_ eq $user->home_ou, @$opt_orgs; + my $vals = $e->search_actor_usr_org_unit_opt_in( {org_unit=>$opt_orgs, usr=>$user_id},{idlist=>1}); -- 2.11.0