From c17486214d161d40e772b91c9af657b6884d16d3 Mon Sep 17 00:00:00 2001
From: scottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Tue, 9 Feb 2010 17:35:29 +0000
Subject: [PATCH] Adding org unit settings for fund spending limits.

See ticket 4201.

M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0157.data.fund-spending-limits.sql
M    Open-ILS/src/sql/Pg/950.data.seed-values.sql


git-svn-id: svn://svn.open-ils.org/ILS/trunk@15483 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/sql/Pg/002.schema.config.sql           |  2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql        | 17 +++++++++++++++++
 .../Pg/upgrade/0157.data.fund-spending-limits.sql   | 21 +++++++++++++++++++++
 3 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0157.data.fund-spending-limits.sql

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index f3cf509f91..3572bfad09 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0156'); -- senator
+INSERT INTO config.upgrade_log (version) VALUES ('0157'); -- Scott McKellar
 
 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 d011000ea9..dd4a1e8af7 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -3828,3 +3828,20 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
         'bool'
     );
 
+-- Org unit settings for fund spending limits
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+VALUES (
+    'acq.fund.balance_limit.warn',
+    oils_i18n_gettext('acq.fund.balance_limit.warn', 'Fund Spending Limit for Warning', 'coust', 'label'),
+    oils_i18n_gettext('acq.fund.balance_limit.warn', 'When the amount remaining in the fund, including spent money and encumbrances, goes below this percentage, attempts to spend from the fund will result in a warning to the staff.', 'coust', 'descripton'),
+    'integer'
+);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+VALUES (
+    'acq.fund.balance_limit.block',
+    oils_i18n_gettext('acq.fnd.balance_limit.block', 'Fund Spending Limit for Block', 'coust', 'label'),
+    oils_i18n_gettext('acq.fund.balance_limit.block', 'When the amount remaining in the fund, including spent money and encumbrances, goes below this percentage, attempts to spend from the fund will be blocked.', 'coust', 'description'),
+    'integer'
+);
diff --git a/Open-ILS/src/sql/Pg/upgrade/0157.data.fund-spending-limits.sql b/Open-ILS/src/sql/Pg/upgrade/0157.data.fund-spending-limits.sql
new file mode 100644
index 0000000000..b5ada90cd4
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0157.data.fund-spending-limits.sql
@@ -0,0 +1,21 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0157'); -- Scott McKellar
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+VALUES (
+	'acq.fund.balance_limit.warn',
+	oils_i18n_gettext('acq.fund.balance_limit.warn', 'Fund Spending Limit for Warning', 'coust', 'label'),
+	oils_i18n_gettext('acq.fund.balance_limit.warn', 'When the amount remaining in the fund, including spent money and encumbrances, goes below this percentage, attempts to spend from the fund will result in a warning to the staff.', 'coust', 'descripton'),
+	'integer'
+);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+VALUES (
+	'acq.fund.balance_limit.block',
+	oils_i18n_gettext('acq.fnd.balance_limit.block', 'Fund Spending Limit for Block', 'coust', 'label'),
+	oils_i18n_gettext('acq.fund.balance_limit.block', 'When the amount remaining in the fund, including spent money and encumbrances, goes below this percentage, attempts to spend from the fund will be blocked.', 'coust', 'description'),
+	'integer'
+);
+
+COMMIT;
-- 
2.11.0