method => "patron_adv_search",
api_name => "open-ils.actor.patron.search.advanced"
);
+__PACKAGE__->register_method(
+ method => "patron_adv_search",
+ api_name => "open-ils.actor.patron.search.advanced.opt_in_override"
+);
sub patron_adv_search {
my( $self, $client, $auth, $search_hash,
$search_limit, $search_sort, $include_inactive, $search_ou ) = @_;
+ my $ignore_opt_in = 0;
my $e = new_editor(authtoken=>$auth);
return $e->event unless $e->checkauth;
return $e->event unless $e->allowed('VIEW_USER');
+ # Override opt-in permissions
+ if ($self->api_name =~ /opt_in_override/) {
+ if ($e->allowed('OPT_IN_OVERRIDE')) {
+ $ignore_opt_in = 1;
+ }
+ }
+
# depth boundary outside of which patrons must opt-in, default to 0
my $opt_boundary = 0;
$opt_boundary = $U->ou_ancestor_setting_value($e->requestor->ws_ou,'org.patron_opt_boundary') if user_opt_in_enabled($self);
return $U->storagereq(
"open-ils.storage.actor.user.crazy_search", $search_hash,
- $search_limit, $search_sort, $include_inactive, $e->requestor->ws_ou, $search_ou, $opt_boundary);
+ $search_limit, $search_sort, $include_inactive, $e->requestor->ws_ou, $search_ou, $opt_boundary, $ignore_opt_in);
}
my $ws_ou = shift;
my $search_org = shift || $ws_ou;
my $opt_boundary = shift || 0;
+ my $opt_in_override = shift;
my $penalty_sort = 0;
my $descendants = "actor.org_unit_descendants($search_org)";
my $opt_in_where = '';
- if (lc($strict_opt_in) eq 'true') {
+ if (lc($strict_opt_in) eq 'true' && (!$opt_in_override)) {
$opt_in_where = "AND (";
$opt_in_where .= "EXISTS (select id FROM $opt_in_table ";
$opt_in_where .= " WHERE org_unit in (select (actor.org_unit_ancestors($ws_ou)).id)";