From 589b83bdc500fc8946702207c362ac966e291d43 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Fri, 16 Aug 2013 09:31:16 -0400 Subject: [PATCH] Adjust Kyle Tomita's patron dupe check fix to use the depth concept Addressing these comments: https://bugs.launchpad.net/evergreen/+bug/1185524/comments/3 And also renaming the OU setting to better peer with similar settings affecting staff client (not OPAC) patron registration. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Chris Sharp --- .../perlmods/lib/OpenILS/Application/Actor.pm | 13 +++++-- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 12 +++---- ...s_search_ou_for_duplicate_patron_check.sql | 34 +++++++++---------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 1ea0f32c5f..37ad23b4da 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -1329,9 +1329,18 @@ sub patron_adv_search { 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); - #Only set search_ou if it is undef. Set search_ou to Consortium (1) or the workstation org unit depending on Library Setting - $search_ou = ($U->ou_ancestor_setting_value($e->requestor->ws_ou, 'opac.duplicate_patron_check_use_consortium') == 1) ? 1 : $e->requestor->ws_ou if $search_ou == undef; + if (not defined $search_ou) { + my $depth = $U->ou_ancestor_setting_value( + $e->requestor->ws_ou, + 'circ.patron_edit.duplicate_patron_check_depth' + ); + if (defined $depth) { + $search_ou = $U->org_unit_ancestor_at_depth( + $e->requestor->ws_ou, $depth + ); + } + } 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); diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 47765d5526..82d83dde80 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -4880,18 +4880,18 @@ INSERT into config.org_unit_setting_type ), 'string', null) -,( 'opac.duplicate_patron_check_use_consortium', 'opac', +,( 'circ.patron_edit.duplicate_patron_check_depth', 'circ', oils_i18n_gettext( - 'opac.duplicate_patron_check_use_consortium', - 'Use consortium as the search ou for the duplicate patron check.', + 'circ.patron_edit.duplicate_patron_check_depth', + 'Specify search depth for the duplicate patron check in the patron editor', 'coust', 'label'), oils_i18n_gettext( - 'opac.duplicate_patron_check_use_consortium', - 'When using the patron registration page, the duplicate patron check will use the consortium as the search_ou.', + 'circ.patron_edit.duplicate_patron_check_depth', + 'When using the patron registration page, the duplicate patron check will use the configured depth to scope the search for duplicate patrons.', 'coust', 'description'), - 'bool', null) + 'integer', null) ; UPDATE config.org_unit_setting_type diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.add_setting_for_selecting_consortium_as_search_ou_for_duplicate_patron_check.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.add_setting_for_selecting_consortium_as_search_ou_for_duplicate_patron_check.sql index 957d27881f..caa6c4e054 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.add_setting_for_selecting_consortium_as_search_ou_for_duplicate_patron_check.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.add_setting_for_selecting_consortium_as_search_ou_for_duplicate_patron_check.sql @@ -1,24 +1,22 @@ BEGIN; - SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +INSERT INTO config.org_unit_setting_type ( name, grp, label, description, datatype ) VALUES ( + 'circ.patron_edit.duplicate_patron_check_depth', 'circ', + oils_i18n_gettext( + 'circ.patron_edit.duplicate_patron_check_depth', + 'Specify search depth for the duplicate patron check in the patron editor', + 'coust', + 'label'), + oils_i18n_gettext( + 'circ.patron_edit.duplicate_patron_check_depth', + 'When using the patron registration page, the duplicate patron check will use the configured depth to scope the search for duplicate patrons.', + 'coust', + 'description'), + 'integer') +; - INSERT INTO config.org_unit_setting_type ( name, grp, label, description, datatype ) VALUES ( - 'opac.duplicate_patron_check_use_consortium', 'opac', - oils_i18n_gettext( - 'opac.duplicate_patron_check_use_consortium', - 'Use consortium as the search ou for the duplicate patron check.', - 'coust', - 'label'), - oils_i18n_gettext( - 'opac.duplicate_patron_check_use_consortium', - 'When using the patron registration page, the duplicate patron check will use the consortium as the search_ou.', - 'coust', - 'description'), - 'bool' - ); - INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES ( - 1, 'opac.duplicate_patron_check_use_consortium', 'true' - ); COMMIT; -- 2.43.2