From: Dan Scott Date: Fri, 17 Aug 2012 20:07:19 +0000 (-0400) Subject: Deal with opt-in boundaries defensively X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5a47a857c5994f1251341391fd4123148f22c441;p=evergreen%2Fmasslnc.git Deal with opt-in boundaries defensively If a site had not set an 'org.patron_opt_default' OU setting, then it seemed that a DEFAULT value was getting dumped into the "create opt-in" INSERT statement for the org_unit argument, and that (as there is a non-NULL constraint on the column and no default value for the column) resulted in the patron not getting opted in. One way for sites to deal with this is to set an opt-in boundary at the consortial level, along the lines of: INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (1, 'org.patron_opt_default', 2); Alternatively, in the absense of any such setting, opt-in should continue to work as it had before the new feature was added; this change keeps the old behaviour active in that case. Signed-off-by: Dan Scott Signed-off-by: James Fournie Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 1e79cb52c0..5f6073fa4b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -3123,8 +3123,11 @@ sub create_user_opt_in_at_org { # get the org unit at that depth my $org = $e->json_query({ from => [ 'actor.org_unit_ancestor_at_depth', $wsou, $opt_depth ]})->[0]; - - $org_id = $org->{id}; + $org_id = $org->{id}; + } + if (!$org_id) { + # fall back to the workstation OU, the pre-opt-in-boundary way + $org_id = $e->requestor->ws_ou; } my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;