@param $auth The auth token
@param user_id The ID of the user to test
@return 1 if the user has opted in at the specified org,
+ 2 if opt-in is disallowed for the user's home org,
event on error, and 0 otherwise. /
);
sub user_opt_in_at_org {
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) {
+ my $restrict_ancestor = $U->org_unit_ancestor_at_depth($user->home_ou, $opt_restrict_depth);
+ my $unrestricted_orgs = $U->get_org_descendants($restrict_ancestor);
+
+ # opt-in is disallowed unless the workstation org is within the home
+ # library's opt-in scope
+ return 2 unless grep $_ eq $e->requestor->ws_ou, @$unrestricted_orgs;
+ }
+
my $vals = $e->search_actor_usr_org_unit_opt_in(
{org_unit=>$opt_orgs, usr=>$user_id},{idlist=>1});
'coust', 'description'),
'bool');
+INSERT INTO config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES
+ ('org.restrict_opt_to_depth',
+ 'sec',
+ oils_i18n_gettext('org.restrict_opt_to_depth',
+ 'Restrict patron opt-in to home library and related orgs at specified depth',
+ 'coust', 'label'),
+ oils_i18n_gettext('org.restrict_opt_to_depth',
+ 'Patrons at this library can only be opted-in at org units which are within the '||
+ 'library''s section of the org tree, at or below the depth specified by this setting. '||
+ 'They cannot be opted in at any other libraries.',
+ 'coust', 'description'),
+ 'integer');
+
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type
+ (name, grp, label, description, datatype)
+ VALUES
+ ('org.restrict_opt_to_depth',
+ 'sec',
+ oils_i18n_gettext('org.restrict_opt_to_depth',
+ 'Restrict patron opt-in to home library and related orgs at specified depth',
+ 'coust', 'label'),
+ oils_i18n_gettext('org.restrict_opt_to_depth',
+ 'Patrons at this library can only be opted-in at org units which are within the '||
+ 'library''s section of the org tree, at or below the depth specified by this setting. '||
+ 'They cannot be opted in at any other libraries.',
+ 'coust', 'description'),
+ 'integer');
+
+COMMIT;
+
<div class="alert alert-warning" ng-show="bcNotFound">
[% l('Barcode Not Found: [_1]', '{{bcNotFound}}') %]
</div>
-
+<div class="alert alert-warning" ng-show="optInRestricted">
+ [% l("This patron's record is not viewable at your library.") %]
+</div>
$scope.submitBarcode = function(args) {
$scope.bcNotFound = null;
+ $scope.optInRestricted = false;
if (!args.barcode) return;
// blur so next time it's set to true it will re-apply select()
alert(evt); // FIXME
return;
}
+
+ if (optInResp == 2) {
+ // opt-in disallowed at this location by patron's home library
+ $scope.optInRestricted = true;
+ $scope.selectMe = true;
+ return;
+ }
if (optInResp == 1) {
// opt-in handled or not needed
staff.patron.barcode_entry.no_barcode=No barcode entered.
staff.patron.barcode_entry.barcode_retrieval_problem=Problem retrieving %1$s. Please report this message: \n%2$s
staff.patron.barcode_entry.barcode_not_found=Barcode %1$s not found.
+staff.patron.barcode_entry.opt_in_restricted=This patron's record is not viewable at your library.
staff.patron.barcode_entry.consent_from_patron=Does patron %1$s, %2$s from %3$s (%4$s) consent to having their personal information shared with your library?
staff.patron.barcode_entry.patron_consent_title=Patron/Library Opt-In Confirmation
staff.patron.barcode_entry.patron_consent_accept=Accept
throw(r);
} else {
- if (r == 0) {
+ if (r == 2) {
+ // opt-in is disallowed at this location by patron's home library
+ sound.bad();
+ add_msg($("patronStrings").getFormattedString('staff.patron.barcode_entry.opt_in_restricted'));
+ return;
+ }
+
+ else if (r == 0) {
JSAN.use('patron.util');
var parts;