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 <dscott@laurentian.ca>
Signed-off-by: James Fournie <jfournie@sitka.bclibraries.ca>
Signed-off-by: Ben Shum <bshum@biblio.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;