From: Dan Scott Date: Wed, 14 Sep 2011 20:02:14 +0000 (-0400) Subject: Add and use a patron search that overrides opt-in invisibility X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=02661f68202dd4bcd011920ce2c39b9c3f346f7d;p=contrib%2FConifer.git Add and use a patron search that overrides opt-in invisibility Something like this is required for API calls that need to operate against a number of libraries in a given instance that are using opt-in; otherwise, attempts to search for users will fail and you may end up creating near-duplicates etc. The implementation adds an open-ils.actor.search.patron.advanced.opt_in_override method to open-ils.actor, which, if invoked, checks to see if the caller has the OPT_IN_OVERRIDE permission. If so, then the crazy_search ignores the normal opt-in limits and searches all pertinent users in the database. As a global permission, OPT_IN_OVERRIDE is a blunt instrument. Others might want to put together a more refined version that uses OU depths to define boundaries. Signed-off-by: Dan Scott Conflicts: Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm Conflicts: Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 090b9b56f9..34911403e6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -1338,6 +1338,11 @@ __PACKAGE__->register_method( } ); +__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, $flesh_fields, $offset) = @_; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm index 62014f85c1..1164765858 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm @@ -774,6 +774,7 @@ sub patron_search { } my $penalty_join = ''; + if ($penalty_sort) { $distinct_list = 'COUNT(penalties.id), ' . $distinct_list; $order_by = 'COUNT(penalties.id) DESC, ' . $order_by;