LP1952931 ASN shipment notifiation SQL / IDL
authorBill Erickson <berickxx@gmail.com>
Wed, 1 Dec 2021 21:01:11 +0000 (16:01 -0500)
committerBill Erickson <berickxx@gmail.com>
Tue, 7 Dec 2021 21:29:58 +0000 (16:29 -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 cf1f3f7..993004d 100644 (file)
@@ -9461,6 +9461,68 @@ SELECT  usr,
         </permacrud>
        </class>
 
+       <class id="acqsn" 
+               controller="open-ils.cstore open-ils.pcrud" 
+               oils_obj:fieldmapper="acq::shipment_notification" 
+               oils_persist:tablename="acq.shipment_notification" reporter:label="Shipment Notification">
+               <fields oils_persist:primary="id" oils_persist:sequence="acq.shipment_notification_id_seq">
+                       <field reporter:label="Shipment Notification ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Receiver" name="receiver" reporter:datatype="org_unit" />
+                       <field reporter:label="Provider" name="provider" reporter:datatype="link"/>
+                       <field reporter:label="Shipper" name="shipper" reporter:datatype="link"/>
+                       <field reporter:label="Receive Date" name="recv_date" reporter:datatype="timestamp" />
+                       <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" />
+                       <field reporter:label="Shipment Notification Entries" name="entries" 
+                               reporter:datatype="link" oils_persist:virtual="true"/>
+               </fields>
+               <links>
+                       <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"/>
+                       <link field="entries" reltype="has_many" key="shipment_notification" map="" class="acqsne"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <retrieve permission="MANAGE_SHIPMENT_NOTIFICATION VIEW_SHIPMENT_NOTIFICATION" context_field="receiver"/>
+                               <update   permission="MANAGE_SHIPMENT_NOTIFICATION" context_field="receiver"/>
+                               <delete   permission="MANAGE_SHIPMENT_NOTIFICATION" context_field="receiver"/>
+                       </actions>
+               </permacrud>
+       </class>
+
+       <class id="acqsne" 
+               controller="open-ils.cstore open-ils.pcrud" 
+               oils_obj:fieldmapper="acq::shipment_notification_entry" 
+               oils_persist:tablename="acq.shipment_notification_entry" 
+               reporter:label="Shipment Notification Entry">
+               <fields oils_persist:primary="id" 
+                       oils_persist:sequence="acq.shipment_notification_entry_id_seq">
+                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Shipment Notification" name="shipment_notification" reporter:datatype="link" />
+                       <field reporter:label="Line Item" name="lineitem" reporter:datatype="link"/>
+                       <field reporter:label="Item Count" name="inv_item_count" reporter:datatype="int" />
+               </fields>
+               <links>
+                       <link field="shipment_notification" reltype="has_a" key="id" map="" class="acqinv"/>
+                       <link field="lineitem" reltype="has_a" key="id" map="" class="jub"/>
+               </links>
+                       <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                               <actions>
+                                       <retrieve permission="MANAGE_SHIPMENT_NOTIFICATION VIEW_SHIPMENT_NOTIFICATION">
+                                               <context link="shipment_notification" field="receiver"/>
+                                       </retrieve>
+                                       <update permission="MANAGE_SHIPMENT_NOTIFICATION">
+                                               <context link="shipment_notification" field="receiver"/>
+                                       </update>
+                                       <delete permission="MANAGE_SHIPMENT_NOTIFICATION">
+                                               <context link="shipment_notification" field="receiver"/>
+                                       </delete>
+                               </actions>
+                       </permacrud>
+       </class>
+
        <class id="acqpa" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::provider_address" oils_persist:tablename="acq.provider_address" reporter:label="Provider Address">
                <fields oils_persist:primary="id" oils_persist:sequence="acq.provider_address_id_seq">
                        <field reporter:label="Address Type" name="address_type"  reporter:datatype="text"/>
index 2456757..c445890 100644 (file)
@@ -8,8 +8,7 @@ CREATE TABLE acq.shipment_notification (
     provider        INT         NOT NULL REFERENCES acq.provider (id),
     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',
-    container_code  TEX         NOT NULL, -- vendor-supplied super-barcode
+    container_code  TEXT        NOT NULL, -- vendor-supplied super-barcode
     lading_number   TEXT,       -- informational
     note            TEXT,
     CONSTRAINT      container_code_once_per_provider UNIQUE(provider, container_code)
@@ -26,3 +25,9 @@ CREATE TABLE acq.shipment_notification_entry (
 
 COMMIT;
 
+/* UNDO
+
+DROP TABLE acq.shipment_notification_entry;
+DROP TABLE acq.shipment_notification;
+
+*/