From: Bill Erickson Date: Wed, 11 Jan 2012 14:32:58 +0000 (-0500) Subject: Use org_depth for INVALID penalties X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d734dc7e5e3b0abb32df1f482ea782befdfcd095;p=evergreen%2Fmasslnc.git Use org_depth for INVALID penalties * Honor the org_depth setting on the penalties when applied * Default to org_depth 0 (i.e. global) penalty application for invalid penalties * Use the patrons' home_ou as the penalty org unit for patron reg invalidate actions. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/BadContact.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/BadContact.pm index f1784c1c20..28ee239d62 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/BadContact.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/BadContact.pm @@ -64,7 +64,15 @@ sub mark_users_contact_invalid { name => $penalty_name }); - if (not $penalty_ou) { + return $editor->die_event unless $penalty and @$penalty; + $penalty = $penalty->[0]; + + if ($penalty_ou) { + $penalty_ou = $U->org_unit_ancestor_at_depth( + $penalty_ou, $penalty->org_depth) + if defined $penalty->org_depth; + + } else { # Fallback to using top of org tree if no penalty_ou provided. This # possibly makes sense in most cases anyway. @@ -77,9 +85,6 @@ sub mark_users_contact_invalid { $penalty_ou = $results->[0]->{"id"}; } - return $editor->die_event unless $penalty and @$penalty; - $penalty = $penalty->[0]; - my $last_xact_id_map = {}; my $clear_meth = "clear_$contact_type"; diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 62f1e2f6c2..86f211aa0b 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -145,7 +145,7 @@ INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUE INSERT INTO config.standing_penalty (id,name,label,block_list,staff_alert) VALUES (28,'STAFF_R','Alerting block on Renew','RENEW', TRUE); INSERT INTO config.standing_penalty (id,name,label) VALUES (29,'INVALID_PATRON_ADDRESS','Patron has an invalid address'); INSERT INTO config.standing_penalty (id,name,label) VALUES (30,'PATRON_IN_COLLECTIONS','Patron has been referred to a collections agency'); -INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES +INSERT INTO config.standing_penalty (id, name, label, staff_alert, org_depth) VALUES ( 31, 'INVALID_PATRON_EMAIL_ADDRESS', @@ -155,7 +155,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ), ( 32, @@ -166,7 +167,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ), ( 33, @@ -177,7 +179,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ), ( 34, @@ -188,7 +191,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.mark-email-and-phone-invalid.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.mark-email-and-phone-invalid.sql index 0e3fb65f16..2c76bc723e 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.mark-email-and-phone-invalid.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.mark-email-and-phone-invalid.sql @@ -9,7 +9,7 @@ BEGIN; SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); -INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES +INSERT INTO config.standing_penalty (id, name, label, staff_alert, org_depth) VALUES ( 31, 'INVALID_PATRON_EMAIL_ADDRESS', @@ -19,7 +19,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ), ( 32, @@ -30,7 +31,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ), ( 33, @@ -41,7 +43,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ), ( 34, @@ -52,7 +55,8 @@ INSERT INTO config.standing_penalty (id, name, label, staff_alert) VALUES 'csp', 'label' ), - TRUE + TRUE, + 0 ); diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 19106c9291..eb84ec44e3 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -1700,7 +1700,7 @@ function uGenerateInvalidatorWidget(container_node, field) { fieldmapper.standardRequest( ["open-ils.actor", "open-ils.actor.invalidate." + field], { "async": true, - "params": [openils.User.authtoken, patron.id()], + "params": [openils.User.authtoken, patron.id(), null, patron.home_ou()], "oncomplete": function(r) { progressDialog.hide(); // alerts on non-success event