[open-ils-commits] r8289 - in branches/acq-experiment/Open-ILS:
examples src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Dec 28 13:45:37 EST 2007
Author: miker
Date: 2007-12-28 13:22:43 -0500 (Fri, 28 Dec 2007)
New Revision: 8289
Modified:
branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
adding acq budget tracking tables and IDL info
Modified: branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2007-12-28 18:21:48 UTC (rev 8288)
+++ branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2007-12-28 18:22:43 UTC (rev 8289)
@@ -2426,6 +2426,41 @@
</links>
</class>
+ <class id="acqb" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::budget" oils_persist:tablename="acq.budget">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.budget_id_seq">
+ <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
+ <field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
+ <field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+ <field reporter:label="Budget ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+ <field reporter:label="Org Unit" name="org" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="org_unit" />
+ <field reporter:label="Name" name="name" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" />
+ <field reporter:label="Year" name="year" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="int" />
+ </fields>
+ <links>
+ <link field="org" reltype="has_a" key="id" map="" class="aou"/>
+ </links>
+ </class>
+
+ <class id="acqba" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::budget_allocation" oils_persist:tablename="acq.budget_allocation">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.budget_allocation_id_seq">
+ <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
+ <field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
+ <field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+ <field reporter:label="Allocation ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+ <field reporter:label="Budget" name="budget" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Fund" name="fund" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Amount" name="amount" oils_obj:array_position="6" oils_persist:virtual="false" oils_persist:primitive="number" reporter:datatype="money" />
+ <field reporter:label="Percent" name="percent" oils_obj:array_position="7" oils_persist:virtual="false" oils_persist:primitive="number" reporter:datatype="float" />
+ <field reporter:label="Allocating User" name="allocator" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Note" name="note" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="text" />
+ </fields>
+ <links>
+ <link field="allocator" reltype="has_a" key="id" map="" class="au"/>
+ <link field="budget" reltype="has_a" key="id" map="" class="acqb"/>
+ <link field="fund" reltype="has_a" key="id" map="" class="acqfund"/>
+ </links>
+ </class>
+
<class id="rof" controller="open-ils.reporter-store" oils_obj:fieldmapper="reporter::output_folder" oils_persist:tablename="reporter.output_folder">
<fields oils_persist:primary="id" oils_persist:sequence="reporter.output_folder_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2007-12-28 18:21:48 UTC (rev 8288)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2007-12-28 18:22:43 UTC (rev 8289)
@@ -10,7 +10,7 @@
);
INSERT INTO acq.currency_type (code, label) VALUES ('USD','US Dollars');
-INSERT INTO acq.currency_type (code, label) VALUES ('CAN','Canadian Dollars');
+INSERT INTO acq.currency_type (code, label) VALUES ('CAD','Canadian Dollars');
INSERT INTO acq.currency_type (code, label) VALUES ('EUR','Euros');
CREATE TABLE acq.exchange_rate (
@@ -68,4 +68,27 @@
encumberance BOOL NOT NULL DEFAULT TRUE
);
+CREATE TABLE acq.budget (
+ id SERIAL PRIMARY KEY,
+ org INT NOT NULL REFERENCES actor.org_unit (id) ON UPDATE CASCADE ON DELETE CASCADE,
+ name TEXT NOT NULL,
+ year INT NOT NULL DEFAULT EXTRACT( YEAR FROM NOW() ),
+ CONSTRAINT name_once_per_org_year UNIQUE (org,name,year)
+);
+
+CREATE TABLE acq.budget_allocation (
+ id SERIAL PRIMARY KEY,
+ fund INT NOT NULL REFERENCES acq.fund (id) ON UPDATE CASCADE ON DELETE CASCADE,
+ budget INT NOT NULL REFERENCES acq.budget (id) ON UPDATE CASCADE ON DELETE CASCADE,
+ amount NUMERIC,
+ percent NUMERIC CHECK (percent IS NULL OR percent BETWEEN 0.0 AND 100.0),
+ allocator INT NOT NULL REFERENCES actor.usr (id),
+ note TEXT,
+ CONSTRAINT allocation_amount_or_percent CHECK ((percent IS NULL AND amount IS NOT NULL) OR (percent IS NOT NULL AND amount IS NULL))
+);
+
COMMIT;
+
+
+
+
More information about the open-ils-commits
mailing list