From c98b5a8b5491ca7c926d64acd19381c7cc2a0737 Mon Sep 17 00:00:00 2001 From: berick Date: Mon, 9 May 2011 15:14:31 -0400 Subject: [PATCH] rough draft if sql support for allowing staff to excempt patrons from collections --- .../lib/OpenILS/Application/Storage/Publisher/money.pm | 9 +++++++++ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 8 ++++++++ .../sql/Pg/upgrade/XXXX.data.patron_no_collections.sql | 15 +++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.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..050ded14f5 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 @@ -144,6 +144,9 @@ select and x.circ_lib in (XX) and b.billing_ts < current_timestamp - ? * '1 day'::interval and not b.voided + and not exists ( + select set.id from actor.usr_setting set where set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true' + ) group by 1,2 union all @@ -161,6 +164,9 @@ select and x.billing_location in (XX) and b.billing_ts < current_timestamp - ? * '1 day'::interval and not b.voided + and not exists ( + select set.id from actor.usr_setting set where set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true' + ) group by 1,2 union all @@ -178,6 +184,9 @@ select and x.pickup_lib in (XX) and b.billing_ts < current_timestamp - ? * '1 day'::interval and not b.voided + and not exists ( + select set.id from actor.usr_setting set where set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true' + ) 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/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 1a2259c505..6f43d29459 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -8021,3 +8021,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/XXXX.data.patron_no_collections.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.patron_no_collections.sql new file mode 100644 index 0000000000..620c2a4a31 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.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; + -- 2.11.0