New columns to acq.fund: balance_wqarning_percent and balance_stop_percent.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Feb 2010 21:23:56 +0000 (21:23 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Feb 2010 21:23:56 +0000 (21:23 +0000)
When the balance of a fund falls below these percentages, the system should
issue a warning or stop further charges.

M    Open-ILS/src/sql/Pg/200.schema.acq.sql
M    Open-ILS/src/sql/Pg/002.schema.config.sql
A    Open-ILS/src/sql/Pg/upgrade/0153.schema.acq.fund-spending-limits.sql
M    Open-ILS/examples/fm_IDL.xml

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15466 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/0153.schema.acq.fund-spending-limits.sql [new file with mode: 0644]

index 4252dd7..e21c101 100644 (file)
@@ -4630,6 +4630,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Rollover" name="rollover" reporter:datatype="bool" />
                        <field reporter:label="Propagate" name="propagate" reporter:datatype="bool" />
                        <field reporter:label="Active" name="active" reporter:datatype="bool" />
+                       <field reporter:label="Balance Warning Percent" name="balance_warning_percent" reporter:datatype="int" />
+                       <field reporter:label="Balance Stop Percent" name="balance_stop_percent" reporter:datatype="int" />
                        <field reporter:label="Summary" name="summary" oils_persist:virtual="true"/>
                        <field reporter:label="Allocations" name="allocations" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Debits" name="debits" oils_persist:virtual="true" reporter:datatype="link"/>
index 80319ad..6086bcc 100644 (file)
@@ -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 ('0152'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0153'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 8529540..c31e5a0 100644 (file)
@@ -172,6 +172,10 @@ CREATE TABLE acq.fund (
        rollover        BOOL    NOT NULL DEFAULT FALSE,
        propagate       BOOL    NOT NULL DEFAULT TRUE,
        active          BOOL    NOT NULL DEFAULT TRUE,
+       balance_warning_percent INT CONSTRAINT balance_warning_percent_limit
+                                   CHECK( balance_warning_percent <= 100 ),
+       balance_stop_percent    INT CONSTRAINT balance_stop_percent_limit
+                                   CHECK( balance_stop_percent <= 100 ),
     CONSTRAINT name_once_per_org_year UNIQUE (org,name,year),
     CONSTRAINT code_once_per_org_year UNIQUE (org, code, year),
        CONSTRAINT acq_fund_rollover_implies_propagate CHECK ( propagate OR NOT rollover )
diff --git a/Open-ILS/src/sql/Pg/upgrade/0153.schema.acq.fund-spending-limits.sql b/Open-ILS/src/sql/Pg/upgrade/0153.schema.acq.fund-spending-limits.sql
new file mode 100644 (file)
index 0000000..b029098
--- /dev/null
@@ -0,0 +1,15 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0153'); -- Scott McKellar
+
+ALTER TABLE acq.fund
+    ADD COLUMN balance_warning_percent INT
+    CONSTRAINT balance_warning_percent_limit
+        CHECK( balance_warning_percent <= 100 );
+
+ALTER TABLE acq.fund
+    ADD COLUMN balance_stop_percent INT
+    CONSTRAINT balance_stop_percent_limit
+        CHECK( balance_stop_percent <= 100 );
+
+COMMIT;