LP1952931 Add process date and processed by fields
authorBill Erickson <berickxx@gmail.com>
Thu, 3 Feb 2022 16:06:29 +0000 (11:06 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 11 Mar 2022 17:04:29 +0000 (12:04 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-asn.sql

index d2e19ef..c642ef1 100644 (file)
@@ -9472,6 +9472,8 @@ SELECT  usr,
                        <field reporter:label="Shipper" name="shipper" reporter:datatype="link"/>
                        <field reporter:label="Receive Date" name="recv_date" reporter:datatype="timestamp" />
                        <field reporter:label="Receive Method" name="recv_method" reporter:datatype="link" />
+                       <field reporter:label="Process Date" name="process_date" reporter:datatype="timestamp" />
+                       <field reporter:label="Processed By" name="processed_by" reporter:datatype="link" />
                        <field reporter:label="Container Barcode" name="container_code" reporter:datatype="text" />
                        <field reporter:label="Lading Number" name="lading_number" reporter:datatype="text" />
                        <field reporter:label="Note" name="note" reporter:datatype="text" />
@@ -9479,6 +9481,7 @@ SELECT  usr,
                                reporter:datatype="link" oils_persist:virtual="true"/>
                </fields>
                <links>
+                       <link field="processed_by" reltype="has_a" key="id" map="" class="au"/>
                        <link field="receiver" reltype="has_a" key="id" map="" class="aou"/>
                        <link field="provider" reltype="has_a" key="id" map="" class="acqpro"/>
                        <link field="shipper" reltype="has_a" key="id" map="" class="acqpro"/>
index 7b92e1b..ad295b7 100644 (file)
@@ -9,6 +9,8 @@ CREATE TABLE acq.shipment_notification (
     shipper         INT         NOT NULL REFERENCES acq.provider (id),
     recv_date       TIMESTAMPTZ NOT NULL DEFAULT NOW(),
     recv_method     TEXT        NOT NULL REFERENCES acq.invoice_method (code) DEFAULT 'EDI',
+    process_date    TIMESTAMPTZ,
+    processed_by    INT         REFERENCES actor.usr(id) ON DELETE SET NULL,
     container_code  TEXT        NOT NULL, -- vendor-supplied super-barcode
     lading_number   TEXT,       -- informational
     note            TEXT,
@@ -19,9 +21,9 @@ CREATE INDEX acq_asn_container_code_idx ON acq.shipment_notification (container_
 
 CREATE TABLE acq.shipment_notification_entry (
     id                      SERIAL  PRIMARY KEY,
-    shipment_notification   INT NOT NULL REFERENCES acq.shipment_notification (id) 
+    shipment_notification   INT NOT NULL REFERENCES acq.shipment_notification (id)
                             ON DELETE CASCADE,
-    lineitem                INT REFERENCES acq.lineitem (id) 
+    lineitem                INT REFERENCES acq.lineitem (id)
                             ON UPDATE CASCADE ON DELETE SET NULL,
     item_count              INT NOT NULL -- How many items the provider shipped
 );
@@ -29,15 +31,15 @@ CREATE TABLE acq.shipment_notification_entry (
 /* TODO alter valid_message_type constraint */
 
 ALTER TABLE acq.edi_message DROP CONSTRAINT valid_message_type;
-ALTER TABLE acq.edi_message ADD CONSTRAINT valid_message_type 
+ALTER TABLE acq.edi_message ADD CONSTRAINT valid_message_type
 CHECK (
     message_type IN (
-        'ORDERS',                                                             
-        'ORDRSP',                                                             
-        'INVOIC',                                                             
-        'OSTENQ',                                                             
-        'OSTRPT',                                                             
-        'DESADV'                                                              
+        'ORDERS',
+        'ORDRSP',
+        'INVOIC',
+        'OSTENQ',
+        'OSTRPT',
+        'DESADV'
     )
 );
 
@@ -45,6 +47,23 @@ COMMIT;
 
 /* UNDO
 
+DELETE FROM acq.edi_message WHERE message_type = 'DESADV';
+
+DELETE FROM acq.shipment_notification_entry;
+DELETE FROM acq.shipment_notification;
+
+ALTER TABLE acq.edi_message DROP CONSTRAINT valid_message_type;
+ALTER TABLE acq.edi_message ADD CONSTRAINT valid_message_type
+CHECK (
+    message_type IN (
+        'ORDERS',
+        'ORDRSP',
+        'INVOIC',
+        'OSTENQ',
+        'OSTRPT'
+    )
+);
+
 DROP TABLE acq.shipment_notification_entry;
 DROP TABLE acq.shipment_notification;