Replace acq.lineitem.claim_interval and acq.provider.default_claim_interval
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 25 Mar 2010 16:03:48 +0000 (16:03 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 25 Mar 2010 16:03:48 +0000 (16:03 +0000)
with foreign keys pointing to the new acq.claim_policy table.

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/0211.schema.acq.replace-claim-interval.sql
M    Open-ILS/examples/fm_IDL.xml

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15977 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/0211.schema.acq.replace-claim-interval.sql [new file with mode: 0644]

index 9bb7529..8b08806 100644 (file)
@@ -4490,13 +4490,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Email" name="email" reporter:datatype="text" />
                        <field reporter:label="Phone" name="phone" reporter:datatype="text" />
                        <field reporter:label="Fax Phone" name="fax_phone" reporter:datatype="text" />
-                       <field reporter:label="Default Claim Interval" name="default_claim_interval" reporter:datatype="interval" />
+                       <field reporter:label="Default Claim Policy" name="default_claim_policy" reporter:datatype="link" />
                </fields>
                <links>
                        <link field="currency_type" reltype="has_a" key="code" map="" class="acqct"/>
                        <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
             <link field="addresses" reltype="has_many" map="" key="provider" class="acqpa"/>
             <link field="edi_default" reltype="has_a" map="" key="id" class="acqedi"/>
+            <link field="default_claim_policy" reltype="has_a" map="" key="id" class="acqclp"/>
                </links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -5254,7 +5255,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="State" name="state" reporter:datatype="text" />
                        <field reporter:label="Creator" name="creator" reporter:datatype="link" />
                        <field reporter:label="Editor" name="editor" reporter:datatype="link" />
-                       <field reporter:label="Claim Interval" name="claim_interval" reporter:datatype="interval" />
+                       <field reporter:label="Claim Policy" name="claim_policy" reporter:datatype="link" />
                        <field reporter:label="Cancel Reason" name="cancel_reason" reporter:datatype="link" />
                        <field reporter:label="Estimated Unit Price" name="estimated_unit_price" reporter:datatype="money" />
                        <field reporter:label="Item Count" name="item_count" oils_persist:virtual="true" reporter:datatype="int" />
@@ -5276,6 +5277,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="lineitem_notes" reltype="has_many" key="lineitem" map="" class="acqlin"/>
                        <link field="cancel_reason" reltype="has_a" key="id" map="" class="acqcr"/>
                        <link field="distribution_formulas" reltype="has_many" key="lineitem" map="" class="acqdfa"/>
+                       <link field="claim_policy" reltype="has_a" key="id" map="" class="acqclp"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <retrieve permission="CREATE_PURCHASE_ORDER VIEW_PURCHASE_ORDER CREATE_PICKLIST VIEW_PICKLIST">
index 50fea24..bb07d16 100644 (file)
@@ -59,7 +59,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0210'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0211'); -- Scott McKellar
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 13cc019..d6f386e 100644 (file)
@@ -44,7 +44,8 @@ CREATE TABLE acq.provider (
     email               TEXT,
     phone               TEXT,
     fax_phone           TEXT,
-       default_claim_interval INTERVAL,
+       default_claim_policy INT    REFERENCES acq.claim_policy
+                                   DEFERRABLE INITIALLY DEFERRED,
     CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner),
        CONSTRAINT code_once_per_owner UNIQUE (code, owner)
 );
@@ -453,10 +454,11 @@ CREATE TABLE acq.lineitem (
        eg_bib_id           INT                         REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED,
        source_label        TEXT,
        state               TEXT                        NOT NULL DEFAULT 'new',
-       claim_interval      INTERVAL,
        cancel_reason       INT                         REFERENCES acq.cancel_reason( id )
                                                     DEFERRABLE INITIALLY DEFERRED,
        estimated_unit_price NUMERIC,
+       claim_policy        INT                         REFERENCES acq.claim_policy
+                                                               DEFERRABLE INITIALLY DEFERRED,
     CONSTRAINT picklist_or_po CHECK (picklist IS NOT NULL OR purchase_order IS NOT NULL)
 );
 CREATE INDEX li_po_idx ON acq.lineitem (purchase_order);
diff --git a/Open-ILS/src/sql/Pg/upgrade/0211.schema.acq.replace-claim-interval.sql b/Open-ILS/src/sql/Pg/upgrade/0211.schema.acq.replace-claim-interval.sql
new file mode 100644 (file)
index 0000000..01bce6d
--- /dev/null
@@ -0,0 +1,21 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0211'); -- Scott McKellar
+
+ALTER TABLE acq.lineitem
+       DROP COLUMN claim_interval;
+
+ALTER TABLE acq.lineitem
+       ADD COLUMN claim_policy INT
+               REFERENCES acq.claim_policy
+               DEFERRABLE INITIALLY DEFERRED;
+
+ALTER TABLE acq.provider
+       DROP COLUMN default_claim_interval;
+
+ALTER TABLE acq.provider
+       ADD COLUMN default_claim_policy INT
+               REFERENCES acq.claim_policy
+               DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;