From 0e0026ad7a81812b1831433aedf12c6884a50c64 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 1 Jun 2011 17:01:36 -0400 Subject: [PATCH] Collections exemption user setting Adds a new user setting "circ.collections.exempt" which, when set to true for a user, means the user will not be considered for collections. It does this by ignoring the user when calculating the list of users of interest in the "open-ils.collections.users_of_interest.retrieve" API call. Signed-off-by: Bill Erickson --- .../lib/OpenILS/Application/Storage/Publisher/money.pm | 6 ++++++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 9 ++++++++- .../sql/Pg/upgrade/0544.data.patron_no_collections.sql | 15 +++++++++++++++ Open-ILS/web/js/ui/default/actor/user/register.js | 2 +- 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0544.data.patron_no_collections.sql diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm index 22ab1f308d..a8336ea78d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm @@ -139,11 +139,13 @@ select from action.circulation x left join money.collections_tracker c ON (c.usr = x.usr AND c.location = ?) join money.billing b on (b.xact = x.id) + LEFT JOIN actor.usr_setting set ON (set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true') where x.xact_finish is null and c.id is null and x.circ_lib in (XX) and b.billing_ts < current_timestamp - ? * '1 day'::interval and not b.voided + and set.id IS NULL group by 1,2 union all @@ -156,11 +158,13 @@ select from money.grocery x left join money.collections_tracker c ON (c.usr = x.usr AND c.location = ?) join money.billing b on (b.xact = x.id) + LEFT JOIN actor.usr_setting set ON (set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true') where x.xact_finish is null and c.id is null and x.billing_location in (XX) and b.billing_ts < current_timestamp - ? * '1 day'::interval and not b.voided + and set.id IS NULL group by 1,2 union all @@ -173,11 +177,13 @@ select from booking.reservation x left join money.collections_tracker c ON (c.usr = x.usr AND c.location = ?) join money.billing b on (b.xact = x.id) + LEFT JOIN actor.usr_setting set ON (set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true') where x.xact_finish is null and c.id is null and x.pickup_lib in (XX) and b.billing_ts < current_timestamp - ? * '1 day'::interval and not b.voided + and set.id IS NULL group by 1,2 ) full_list left join money.payment p on (full_list.id = p.xact) diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 56af82f64a..8f107d1ba2 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0543', :eg_version); -- dbwells +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0544', :eg_version); -- berick CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, 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 5a4b40b404..cce7ad0603 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -8693,4 +8693,11 @@ INSERT INTO config.org_unit_setting_type 'bool' ); - +INSERT INTO config.usr_setting_type +( name, opac_visible, label, description, datatype) VALUES +( 'circ.collections.exempt', + FALSE, + oils_i18n_gettext('circ.collections.exempt', 'Collections: Exempt', 'cust', 'description'), + oils_i18n_gettext('circ.collections.exempt', 'User is exempt from collections tracking/processing', 'cust', 'description'), + 'bool' +); diff --git a/Open-ILS/src/sql/Pg/upgrade/0544.data.patron_no_collections.sql b/Open-ILS/src/sql/Pg/upgrade/0544.data.patron_no_collections.sql new file mode 100644 index 0000000000..620c2a4a31 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0544.data.patron_no_collections.sql @@ -0,0 +1,15 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('XXX'); + +INSERT INTO config.usr_setting_type +( name, opac_visible, label, description, datatype) VALUES +( 'circ.collections.exempt', + FALSE, + oils_i18n_gettext('circ.collections.exempt', 'Collections: Exempt', 'cust', 'description'), + oils_i18n_gettext('circ.collections.exempt', 'User is exempt from collections tracking/processing', 'cust', 'description'), + 'bool' +); + +COMMIT; + 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 6915f53cb3..9369e7e84f 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -523,7 +523,7 @@ function uEditFetchUserSettings(userId) { /* fetch any user setting types we need + any that offer opt-in */ userSettingTypes = pcrud.search('cust', { '-or' : [ - {name:['circ.holds_behind_desk']}, + {name:['circ.holds_behind_desk', 'circ.collections.exempt']}, {name : { 'in': { select : {atevdef : ['opt_in_setting']}, -- 2.11.0