Add acq.po_item table.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Apr 2010 16:23:19 +0000 (16:23 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Apr 2010 16:23:19 +0000 (16:23 +0000)
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/0241.schema.acq-po-item.sql
M    Open-ILS/examples/fm_IDL.xml

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16319 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/0241.schema.acq-po-item.sql [new file with mode: 0644]

index 5d771aa..d8e1c23 100644 (file)
@@ -5426,6 +5426,28 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
+       <class id="acqpoi" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::po_item" oils_persist:tablename="acq.po_item" reporter:label="Purchase Order Item">
+               <fields oils_persist:primary="id" oils_persist:sequence="acq.po_item_id_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Purchase Order" name="purchase_order" reporter:datatype="link"/>
+                       <field reporter:label="Fund Debit" name="fund_debit" reporter:datatype="link"/>
+                       <field reporter:label="Invoice Item Type" name="inv_item_type" reporter:datatype="link"/>
+                       <field reporter:label="Title" name="title" reporter:datatype="text"/>
+                       <field reporter:label="Author" name="author" reporter:datatype="text"/>
+                       <field reporter:label="Note" name="note" reporter:datatype="text"/>
+                       <field reporter:label="Estimated Cost" name="estimated_cost" reporter:datatype="money"/>
+                       <field reporter:label="Fund" name="fund" reporter:datatype="link"/>
+               </fields>
+               <links>
+                       <link field="purchase_order" reltype="has_a" key="id" map="" class="acqpo"/>
+                       <link field="fund_debit" reltype="has_a" key="id" map="" class="acqfdeb"/>
+                       <link field="inv_item_type" reltype="has_a" key="code" map="" class="aiit"/>
+                       <link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+               </permacrud>
+       </class>
+
        <class id="jub" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::lineitem" oils_persist:tablename="acq.lineitem" reporter:label="Line Item">
                <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_id_seq">
                        <field reporter:label="Lineitem ID" name="id" reporter:datatype="id" />
index d06bb6d..6e448d8 100644 (file)
@@ -60,7 +60,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0240'); -- senator
+INSERT INTO config.upgrade_log (version) VALUES ('0241'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 8fba151..fe1f651 100644 (file)
@@ -843,6 +843,24 @@ CREATE TABLE acq.invoice_item ( -- for invoice-only debits: taxes/fees/non-bib i
        amount_paid     NUMERIC (8,2)
 );
 
+CREATE TABLE acq.po_item (
+       id              SERIAL      PRIMARY KEY,
+       purchase_order  INT         REFERENCES acq.purchase_order (id)
+                                   ON UPDATE CASCADE ON DELETE SET NULL
+                                   DEFERRABLE INITIALLY DEFERRED,
+       fund_debit      INT         REFERENCES acq.fund_debit (id)
+                                   DEFERRABLE INITIALLY DEFERRED,
+       inv_item_type   TEXT        NOT NULL
+                                   REFERENCES acq.invoice_item_type (code)
+                                   DEFERRABLE INITIALLY DEFERRED,
+       title           TEXT,
+       author          TEXT,
+       note            TEXT,
+       estimated_cost  NUMERIC(8,2),
+       fund            INT         REFERENCES acq.fund (id)
+                                   DEFERRABLE INITIALLY DEFERRED
+);
+
 -- Patron requests
 CREATE TABLE acq.user_request_type (
     id      SERIAL  PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0241.schema.acq-po-item.sql b/Open-ILS/src/sql/Pg/upgrade/0241.schema.acq-po-item.sql
new file mode 100644 (file)
index 0000000..23f6c75
--- /dev/null
@@ -0,0 +1,23 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0241'); -- Scott McKellar
+
+CREATE TABLE acq.po_item (
+       id              SERIAL      PRIMARY KEY,
+       purchase_order  INT         REFERENCES acq.purchase_order (id)
+                                   ON UPDATE CASCADE ON DELETE SET NULL
+                                   DEFERRABLE INITIALLY DEFERRED,
+       fund_debit      INT         REFERENCES acq.fund_debit (id)
+                                   DEFERRABLE INITIALLY DEFERRED,
+       inv_item_type   TEXT        NOT NULL
+                                   REFERENCES acq.invoice_item_type (code)
+                                   DEFERRABLE INITIALLY DEFERRED,
+       title           TEXT,
+       author          TEXT,
+       note            TEXT,
+       estimated_cost  NUMERIC(8,2),
+       fund            INT         REFERENCES acq.fund (id)
+                                   DEFERRABLE INITIALLY DEFERRED
+);
+
+COMMIT;