[open-ils-commits] SPAM: r8864 - in
branches/acq-experiment/Open-ILS: examples src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 4 23:03:11 EST 2008
Author: miker
Date: 2008-03-04 22:30:53 -0500 (Tue, 04 Mar 2008)
New Revision: 8864
Modified:
branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql
Log:
reworking picklist_entry and po_lineitem records ... so long, and thanks for all the JUBs
Modified: branches/acq-experiment/Open-ILS/examples/fm_IDL.xml
===================================================================
--- branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2008-03-04 20:41:23 UTC (rev 8863)
+++ branches/acq-experiment/Open-ILS/examples/fm_IDL.xml 2008-03-05 03:30:53 UTC (rev 8864)
@@ -2388,8 +2388,8 @@
<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="allocations" reltype="has_many" key="funding_source" class="acqfa"/>
- <link field="credits" reltype="has_many" key="funding_source" class="acqfscred"/>
+ <link field="allocations" reltype="has_many" map="" key="funding_source" class="acqfa"/>
+ <link field="credits" reltype="has_many" key="funding_source" map="" class="acqfscred"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
@@ -2452,8 +2452,8 @@
<links>
<link field="org" reltype="has_a" key="id" map="" class="aou"/>
<link field="currency_type" reltype="has_a" key="code" map="" class="acqct"/>
- <link field="allocations" reltype="has_many" key="fund" class="acqfa"/>
- <link field="debits" reltype="has_many" key="fund" class="acqfdeb"/>
+ <link field="allocations" reltype="has_many" key="fund" map="" class="acqfa"/>
+ <link field="debits" reltype="has_many" key="fund" map="" class="acqfdeb"/>
</links>
</class>
@@ -2609,7 +2609,7 @@
</fields>
<links>
<link field="owner" reltype="has_a" key="id" map="" class="au"/>
- <link field="entries" reltype="has_many" key="picklist" map="" class="acqple"/>
+ <link field="entries" reltype="has_many" key="picklist" map="" class="jub"/>
</links>
</class>
@@ -2620,19 +2620,18 @@
<field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
<field reporter:label="Purchase Order ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
<field reporter:label="Owner" name="owner" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Default Fund" name="default_fund" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Creation Time" name="create_time" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="Provider" name="provider" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="State" name="state" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Line Items" name="lineitems" oils_obj:array_position="10" oils_persist:virtual="true" reporter:datatype="link" />
- <field reporter:label="Line Item Count" name="lineitem_count" oils_obj:array_position="11" oils_persist:virtual="true" reporter:datatype="link" />
+ <field reporter:label="Creation Time" name="create_time" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="timestamp" />
+ <field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp" />
+ <field reporter:label="Provider" name="provider" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="State" name="state" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="text" />
+ <field reporter:label="Line Items" name="lineitems" oils_obj:array_position="9" oils_persist:virtual="true" reporter:datatype="link" />
+ <field reporter:label="Line Item Count" name="lineitem_count" oils_obj:array_position="10" oils_persist:virtual="true" reporter:datatype="link" />
</fields>
<links>
<link field="owner" reltype="has_a" key="id" map="" class="au"/>
<link field="default_fund" reltype="has_a" key="id" map="" class="acqf"/>
<link field="provider" reltype="has_a" key="id" map="" class="acqpro"/>
- <link field="lineitems" reltype="has_many" key="purchase_order" map="" class="acqpoli"/>
+ <link field="lineitems" reltype="has_many" key="purchase_order" map="" class="jub"/>
</links>
</class>
@@ -2656,63 +2655,47 @@
</links>
</class>
- <class id="acqple" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_entry" oils_persist:tablename="acq.picklist_entry">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_entry_id_seq">
+ <class id="jub" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem" oils_persist:tablename="acq.lineitem">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_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="Picklist Entry ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
- <field reporter:label="Picklist" name="picklist" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Provider" name="provider" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Creation Time" name="create_time" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="MARC" name="marc" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Evergreen Bib ID" name="eg_bib_id" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Source Label" name="source_label" oils_obj:array_position="10" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Purchase Order Lineitem" name="po_lineitem" oils_obj:array_position="11" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Attributes" name="attributes" oils_obj:array_position="12" oils_persist:virtual="true" reporter:datatype="link" />
+ <field reporter:label="Lineitem ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+ <field reporter:label="Selecting Org Unit" name="selector" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Picklist" name="picklist" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Purchase Order" name="purchase_order" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Provider" name="provider" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Creation Time" name="create_time" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="timestamp" />
+ <field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="timestamp" />
+ <field reporter:label="MARC" name="marc" oils_obj:array_position="10" oils_persist:virtual="false" reporter:datatype="text" />
+ <field reporter:label="Evergreen Bib ID" name="eg_bib_id" oils_obj:array_position="11" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Source Label" name="source_label" oils_obj:array_position="12" oils_persist:virtual="false" reporter:datatype="text" />
+ <field reporter:label="Item Count" name="item_count" oils_obj:array_position="13" oils_persist:virtual="false" reporter:datatype="int" />
+ <field reporter:label="Expected Receive Date" name="expected_recv_time" oils_obj:array_position="14" oils_persist:virtual="false" reporter:datatype="timestamp" />
+ <field reporter:label="State" name="state" oils_obj:array_position="15" oils_persist:virtual="false" reporter:datatype="timestamp" />
+ <field reporter:label="Descriptive Attributes" name="attributes" oils_obj:array_position="16" oils_persist:virtual="true" reporter:datatype="link" />
+ <field reporter:label="Line Item Details" name="lineitem_details" oils_obj:array_position="17" oils_persist:virtual="true" reporter:datatype="link" />
+ <field reporter:label="Line Item Notes" name="lineitem_notes" oils_obj:array_position="18" oils_persist:virtual="true" reporter:datatype="link" />
</fields>
<links>
- <link field="picklist" reltype="has_a" key="id" map="" class="acqpl"/>
- <link field="po_lineitem" reltype="has_a" key="id" map="" class="acqpoli"/>
+ <link field="selector" reltype="has_a" key="id" map="" class="aou"/>
<link field="provider" reltype="has_a" key="id" map="" class="acqpro"/>
- <link field="eg_bib_id" reltype="has_a" key="id" map="" class="bre"/>
- <link field="attributes" reltype="has_many" key="picklist_entry" map="" class="acqplea"/>
- </links>
- </class>
-
- <class id="acqpoli" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::po_lineitem" oils_persist:tablename="acq.po_lineitem">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.po_lineitem_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="PO Line Item ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
- <field reporter:label="Purchase Order" name="purchase_order" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Creation Time" name="create_time" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="MARC" name="marc" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Evergreen Bib ID" name="eg_bib_id" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="List Price" name="list_price" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="money" />
- <field reporter:label="Item Count" name="item_count" oils_obj:array_position="10" oils_persist:virtual="false" reporter:datatype="int" />
- <field reporter:label="Expected Receive Date" name="expected_recv_time" oils_obj:array_position="11" oils_persist:virtual="false" reporter:datatype="timestamp" />
- <field reporter:label="Descriptive Attributes" name="attributes" oils_obj:array_position="12" oils_persist:virtual="true" reporter:datatype="link" />
- <field reporter:label="Line Item Details" name="lineitem_details" oils_obj:array_position="13" oils_persist:virtual="true" reporter:datatype="link" />
- </fields>
- <links>
<link field="purchase_order" reltype="has_a" key="id" map="" class="acqpo"/>
+ <link field="picklist" reltype="has_a" key="id" map="" class="acqpl"/>
<link field="eg_bib_id" reltype="has_a" key="id" map="" class="bre"/>
- <link field="attributes" reltype="has_many" key="po_lineitem" map="" class="acqpolia"/>
- <link field="lineitem_details" reltype="has_many" key="po_lineitem" map="" class="acqpolid"/>
+ <link field="attributes" reltype="has_many" key="lineitem" map="" class="acqlia"/>
+ <link field="lineitem_details" reltype="has_many" key="lineitem" map="" class="acqlid"/>
+ <link field="lineitem_notes" reltype="has_many" key="lineitem" map="" class="acqlin"/>
</links>
</class>
- <class id="acqpolin" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::po_li_note" oils_persist:tablename="acq.po_li_note">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.po_li_note_id_seq">
+ <class id="acqlin" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_note" oils_persist:tablename="acq.lineitem_note">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_note_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="PO Line Item Note ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
- <field reporter:label="Line Item" name="po_lineitem" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Line Item" name="lineitem" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
<field reporter:label="Creator" name="creator" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link" />
<field reporter:label="Creation Time" name="create_time" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp" />
<field reporter:label="Edit Time" name="edit_time" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="timestamp" />
@@ -2722,49 +2705,33 @@
<links>
<link field="creator" reltype="has_a" key="id" map="" class="au"/>
<link field="editor" reltype="has_a" key="id" map="" class="au"/>
- <link field="po_lineitem" reltype="has_a" key="id" map="" class="acqpoli"/>
+ <link field="lineitem" reltype="has_a" key="id" map="" class="jub"/>
</links>
</class>
- <class id="acqplea" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_entry_attr" oils_persist:tablename="acq.picklist_entry_attr">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_entry_attr_id_seq">
+ <class id="acqlia" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_attr" oils_persist:tablename="acq.lineitem_attr">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_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="Attribute Value ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
- <field reporter:label="Picklist Entry" name="picklist_entry" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Lineitem" name="lineitem" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
<field reporter:label="Type" name="attr_type" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Name" name="attr_name" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Value" name="attr_value" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text" />
</fields>
<links>
- <link field="picklist_entry" reltype="has_a" key="id" map="" class="acqple"/>
+ <link field="lineitem" reltype="has_a" key="id" map="" class="jub"/>
</links>
</class>
- <class id="acqpolia" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::po_li_attr" oils_persist:tablename="acq.po_li_attr">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.po_li_attr_id_seq">
+ <class id="acqlid" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_detail" oils_persist:tablename="acq.lineitem_detail">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_detail_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="Attribute Value ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
- <field reporter:label="PO Line Item" name="po_lineitem" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
- <field reporter:label="Type" name="attr_type" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Name" name="attr_name" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
- <field reporter:label="Value" name="attr_value" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text" />
- </fields>
- <links>
- <link field="po_lineitem" reltype="has_a" key="id" map="" class="acqpoli"/>
- </links>
- </class>
-
- <class id="acqpolid" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::po_li_detail" oils_persist:tablename="acq.po_li_detail">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.po_li_detail_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="Item Detail ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
- <field reporter:label="PO Line Item" name="po_lineitem" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="PO Line Item" name="lineitem" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link" />
<field reporter:label="Evergreen Copy ID" name="eg_copy_id" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="link" />
<field reporter:label="Barcode" name="barcode" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
<field reporter:label="Call Number Label" name="cn_label" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text" />
@@ -2773,15 +2740,15 @@
<field reporter:label="Fund Debit" name="fund_debit" oils_obj:array_position="10" oils_persist:virtual="false" reporter:datatype="link" />
</fields>
<links>
- <link field="po_lineitem" reltype="has_a" key="id" map="" class="acqpoli"/>
+ <link field="lineitem" reltype="has_a" key="id" map="" class="jub"/>
<link field="eg_copy_id" reltype="has_a" key="id" map="" class="acp"/>
<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
<link field="fund_debit" reltype="has_a" key="id" map="" class="acqfdeb"/>
</links>
</class>
- <class id="acqplead" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_attr_definition" oils_persist:tablename="acq.picklist_attr_definition">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_attr_definition_id_seq">
+ <class id="acqliad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_attr_definition" oils_persist:tablename="acq.lineitem_attr_definition">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_definition_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" />
@@ -2790,13 +2757,11 @@
<field reporter:label="Description" name="description" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true" />
<field reporter:label="XPath" name="xpath" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
</fields>
- <links>
- <link field="picklist_entry" reltype="has_a" key="id" map="" class="acqpl"/>
- </links>
+ <links/>
</class>
- <class id="acqplemad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_marc_attr_definition" oils_persist:tablename="acq.picklist_marc_attr_definition">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_attr_definition_id_seq">
+ <class id="acqlimad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_marc_attr_definition" oils_persist:tablename="acq.lineitem_marc_attr_definition">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_definition_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" />
@@ -2808,8 +2773,8 @@
<links/>
</class>
- <class id="acqplegad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_generated_attr_definition" oils_persist:tablename="acq.picklist_generated_attr_definition">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_attr_definition_id_seq">
+ <class id="acqligad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_generated_attr_definition" oils_persist:tablename="acq.lineitem_generated_attr_definition">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_definition_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" />
@@ -2818,13 +2783,11 @@
<field reporter:label="Description" name="description" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true" />
<field reporter:label="XPath" name="xpath" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="text" />
</fields>
- <links>
- <link field="picklist_entry" reltype="has_a" key="id" map="" class="acqpl"/>
- </links>
+ <links/>
</class>
- <class id="acqplepad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_provider_attr_definition" oils_persist:tablename="acq.picklist_provider_attr_definition">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_attr_definition_id_seq">
+ <class id="acqlipad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_provider_attr_definition" oils_persist:tablename="acq.lineitem_provider_attr_definition">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_definition_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" />
@@ -2839,8 +2802,8 @@
</links>
</class>
- <class id="acqpleuad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::picklist_usr_attr_definition" oils_persist:tablename="acq.picklist_usr_attr_definition">
- <fields oils_persist:primary="id" oils_persist:sequence="acq.picklist_attr_definition_id_seq">
+ <class id="acqliuad" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::lineitem_usr_attr_definition" oils_persist:tablename="acq.lineitem_usr_attr_definition">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.lineitem_attr_definition_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" />
@@ -2851,7 +2814,7 @@
<field reporter:label="User" name="usr" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="link" />
</fields>
<links>
- <link field="provider" reltype="has_a" key="id" map="" class="au"/>
+ <link field="usr" reltype="has_a" key="id" map="" class="au"/>
</links>
</class>
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 2008-03-04 20:41:23 UTC (rev 8863)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/200.schema.acq.sql 2008-03-05 03:30:53 UTC (rev 8864)
@@ -96,11 +96,11 @@
CREATE TABLE acq.purchase_order (
id SERIAL PRIMARY KEY,
owner INT NOT NULL REFERENCES actor.usr (id),
- default_fund INT REFERENCES acq.fund (id),
+ ordering_agency INT NOT NULL REFERENCES actor.org_unit (id),
create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
provider INT NOT NULL REFERENCES acq.provider (id),
- state TEXT NOT NULL DEFAULT 'new',
+ state TEXT NOT NULL DEFAULT 'new'
);
CREATE INDEX po_owner_idx ON acq.purchase_order (owner);
CREATE INDEX po_provider_idx ON acq.purchase_order (provider);
@@ -117,113 +117,99 @@
);
CREATE INDEX po_note_po_idx ON acq.po_note (purchase_order);
-CREATE TABLE acq.picklist_entry (
- id BIGSERIAL PRIMARY KEY,
- picklist INT NOT NULL REFERENCES acq.picklist (id) ON DELETE CASCADE,
- provider INT REFERENCES acq.provider (id),
- create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
- edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
- marc TEXT NOT NULL,
- eg_bib_id INT REFERENCES biblio.record_entry (id),
- source_label TEXT,
- po_lineitem INT REFERENCES acq.po_lineitem (id)
+CREATE TABLE acq.lineitem (
+ id BIGSERIAL PRIMARY KEY,
+ selector INT NOT NULL REFERENCES actor.org_unit (id),
+ provider INT REFERENCES acq.provider (id),
+ purchase_order INT REFERENCES acq.purchase_order (id),
+ picklist INT REFERENCES acq.picklist (id),
+ expected_recv_time TIMESTAMP WITH TIME ZONE,
+ create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ marc TEXT NOT NULL,
+ eg_bib_id INT REFERENCES biblio.record_entry (id),
+ source_label TEXT,
+ item_count INT NOT NULL DEFAULT 0,
+ state TEXT NOT NULL DEFAULT 'new',
+ 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);
+CREATE INDEX li_pl_idx ON acq.lineitem (picklist);
-CREATE TABLE acq.po_lineitem (
- id BIGSERIAL PRIMARY KEY,
- purchase_order INT NOT NULL REFERENCES acq.purchase_order (id),
- expected_recv_time TIMESTAMP WITH TIME ZONE,
- create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
- edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
- marc TEXT NOT NULL,
- eg_bib_id INT REFERENCES biblio.record_entry (id),
- list_price NUMERIC,
- item_count INT NOT NULL DEFAULT 0
-);
-CREATE INDEX po_li_po_idx ON acq.po_lineitem (purchase_order);
-
-CREATE TABLE acq.po_li_note (
+CREATE TABLE acq.lineitem_note (
id SERIAL PRIMARY KEY,
- po_lineitem INT NOT NULL REFERENCES acq.po_lineitem (id),
+ lineitem INT NOT NULL REFERENCES acq.lineitem (id),
creator INT NOT NULL REFERENCES actor.usr (id),
editor INT NOT NULL REFERENCES actor.usr (id),
create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
value TEXT NOT NULL
);
-CREATE INDEX po_li_note_li_idx ON acq.po_li_note (po_lineitem);
+CREATE INDEX li_note_li_idx ON acq.lineitem_note (lineitem);
-CREATE TABLE acq.po_li_detail (
+CREATE TABLE acq.lineitem_detail (
id BIGSERIAL PRIMARY KEY,
- po_lineitem INT NOT NULL REFERENCES acq.po_lineitem (id),
+ lineitem INT NOT NULL REFERENCES acq.lineitem (id),
fund INT REFERENCES acq.fund (id),
fund_debit INT REFERENCES acq.fund_debit (id),
- eg_copy_id BIGINT REFERENCES asset.copy (id),
+ eg_copy_id BIGINT REFERENCES asset.copy (id),
barcode TEXT,
cn_label TEXT,
recv_time TIMESTAMP WITH TIME ZONE
);
-CREATE INDEX po_li_detail_li_idx ON acq.po_li_detail (po_lineitem);
+CREATE INDEX li_detail_li_idx ON acq.lineitem_detail (lineitem);
-CREATE TABLE acq.picklist_entry_attr (
+CREATE TABLE acq.lineitem_attr (
id BIGSERIAL PRIMARY KEY,
- picklist_entry BIGINT NOT NULL REFERENCES acq.picklist_entry (id) ON DELETE CASCADE,
+ lineitem BIGINT NOT NULL REFERENCES acq.lineitem (id),
attr_type TEXT NOT NULL,
attr_name TEXT NOT NULL,
attr_value TEXT NOT NULL
);
-CREATE TABLE acq.po_li_attr (
- id BIGSERIAL PRIMARY KEY,
- po_lineitem BIGINT NOT NULL REFERENCES acq.po_lineitem (id),
- attr_type TEXT NOT NULL,
- attr_name TEXT NOT NULL,
- attr_value TEXT NOT NULL
-);
+CREATE INDEX li_attr_li_idx ON acq.lineitem_attr (lineitem);
-CREATE INDEX po_li_attr_li_idx ON acq.po_li_attr (po_lineitem);
-
-CREATE TABLE acq.picklist_attr_definition (
+CREATE TABLE acq.lineitem_attr_definition (
id BIGSERIAL PRIMARY KEY,
code TEXT NOT NULL,
description TEXT NOT NULL,
xpath TEXT NOT NULL
);
-CREATE TABLE acq.picklist_marc_attr_definition (
- id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.picklist_attr_definition_id_seq')
-) INHERITS (acq.picklist_attr_definition);
+CREATE TABLE acq.lineitem_marc_attr_definition (
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq')
+) INHERITS (acq.lineitem_attr_definition);
-CREATE TABLE acq.picklist_provider_attr_definition (
- id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.picklist_attr_definition_id_seq'),
+CREATE TABLE acq.lineitem_provider_attr_definition (
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'),
provider INT NOT NULL REFERENCES acq.provider (id)
-) INHERITS (acq.picklist_attr_definition);
+) INHERITS (acq.lineitem_attr_definition);
-CREATE TABLE acq.picklist_generated_attr_definition (
- id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.picklist_attr_definition_id_seq')
-) INHERITS (acq.picklist_attr_definition);
+CREATE TABLE acq.lineitem_generated_attr_definition (
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq')
+) INHERITS (acq.lineitem_attr_definition);
-CREATE TABLE acq.picklist_usr_attr_definition (
- id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.picklist_attr_definition_id_seq'),
+CREATE TABLE acq.lineitem_usr_attr_definition (
+ id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'),
usr INT NOT NULL REFERENCES actor.usr (id)
-) INHERITS (acq.picklist_attr_definition);
+) INHERITS (acq.lineitem_attr_definition);
-- Seed data
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('title','Title of work','//*[@tag="245"]/*[contains("abcmnopr", at code)]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('author','Author of work','//*[@tag="100" or @tag="110" or @tag="113"]/*[contains("ad", at code)]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('language','Lanuage of work','//*[@tag="240"]/*[@code="l"][1]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('pagination','Pagination','//*[@tag="300"]/*[@code="a"][1]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('isbn','ISBN','//*[@tag="020"]/*[@code="a"]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('issn','ISSN','//*[@tag="022"]/*[@code="a"]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('price','Price','//*[@tag="020" or @tag="022"]/*[@code="c"][1]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('identifier','Identifier','//*[@tag="001"]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('publisher','Publisher','//*[@tag="260"]/*[@code="b"][1]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('pubdate','Publication Date','//*[@tag="260"]/*[@code="c"][1]');
-INSERT INTO acq.picklist_marc_attr_definition ( code, description, xpath ) VALUES ('edition','Edition','//*[@tag="250"]/*[@code="a"][1]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('title','Title of work','//*[@tag="245"]/*[contains("abcmnopr", at code)]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('author','Author of work','//*[@tag="100" or @tag="110" or @tag="113"]/*[contains("ad", at code)]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('language','Lanuage of work','//*[@tag="240"]/*[@code="l"][1]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('pagination','Pagination','//*[@tag="300"]/*[@code="a"][1]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('isbn','ISBN','//*[@tag="020"]/*[@code="a"]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('issn','ISSN','//*[@tag="022"]/*[@code="a"]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('price','Price','//*[@tag="020" or @tag="022"]/*[@code="c"][1]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('identifier','Identifier','//*[@tag="001"]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('publisher','Publisher','//*[@tag="260"]/*[@code="b"][1]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('pubdate','Publication Date','//*[@tag="260"]/*[@code="c"][1]');
+INSERT INTO acq.lineitem_marc_attr_definition ( code, description, xpath ) VALUES ('edition','Edition','//*[@tag="250"]/*[@code="a"][1]');
-- Functions
@@ -234,7 +220,7 @@
$$ LANGUAGE SQL;
CREATE OR REPLACE FUNCTION public.extract_acq_marc_field ( BIGINT, TEXT ) RETURNS TEXT AS $$
- SELECT public.extract_marc_field('acq.picklist_entry', $1, $2);
+ SELECT public.extract_marc_field('acq.lineitem', $1, $2);
$$ LANGUAGE SQL;
CREATE OR REPLACE FUNCTION public.extract_bib_marc_field ( BIGINT, TEXT ) RETURNS TEXT AS $$
@@ -246,7 +232,7 @@
$$ LANGUAGE SQL;
-- For example:
--- INSERT INTO acq.picklist_provider_attr_definition ( provider, code, description, xpath ) VALUES (1,'price','Price','//*[@tag="020" or @tag="022"]/*[@code="a"][1]');
+-- INSERT INTO acq.lineitem_provider_attr_definition ( provider, code, description, xpath ) VALUES (1,'price','Price','//*[@tag="020" or @tag="022"]/*[@code="a"][1]');
/*
Suggested vendor fields:
@@ -264,17 +250,17 @@
prov INT;
adef RECORD;
BEGIN
- FOR adef IN SELECT *,tableoid FROM acq.picklist_attr_definition LOOP
+ FOR adef IN SELECT *,tableoid FROM acq.lineitem_attr_definition LOOP
SELECT relname::TEXT INTO atype FROM pg_class WHERE oid = adef.tableoid;
- IF (atype = 'picklist_provider_attr_definition') THEN
- SELECT provider INTO prov FROM acq.picklist_provider_attr_definition WHERE id = adef.id;
+ IF (atype = 'lineitem_provider_attr_definition') THEN
+ SELECT provider INTO prov FROM acq.lineitem_provider_attr_definition WHERE id = adef.id;
CONTINUE WHEN NEW.provider IS NULL OR prov <> NEW.provider;
END IF;
- SELECT extract_acq_marc_field(id, adef.xpath) INTO value FROM acq.picklist_entry WHERE id = NEW.id;
+ SELECT extract_acq_marc_field(id, adef.xpath) INTO value FROM acq.lineitem WHERE id = NEW.id;
IF (value IS NOT NULL AND value <> '') THEN
- INSERT INTO acq.picklist_entry_attr (picklist_entry, attr_type, attr_name, attr_value) VALUES (NEW.id, atype, adef.code, value);
+ INSERT INTO acq.lineitem_attr (lineitem, attr_type, attr_name, attr_value) VALUES (NEW.id, atype, adef.code, value);
END IF;
END LOOP;
@@ -284,21 +270,22 @@
CREATE OR REPLACE FUNCTION public.cleanup_acq_marc ( ) RETURNS TRIGGER AS $$
BEGIN
- DELETE FROM acq.picklist_entry_attr WHERE picklist_entry = OLD.id;
IF TG_OP = 'UPDATE' THEN
+ DELETE FROM acq.lineitem_attr WHERE lineitem = OLD.id AND attr_type IN ('lineitem_provider_attr_definition', 'lineitem_marc_attr_definition');
RETURN NEW;
ELSE
+ DELETE FROM acq.lineitem_attr WHERE lineitem = OLD.id;
RETURN OLD;
END IF;
END;
$$ LANGUAGE PLPGSQL;
-CREATE TRIGGER cleanup_picklist_entry_trigger
- BEFORE UPDATE OR DELETE ON acq.picklist_entry
+CREATE TRIGGER cleanup_lineitem_trigger
+ BEFORE UPDATE OR DELETE ON acq.lineitem
FOR EACH ROW EXECUTE PROCEDURE public.cleanup_acq_marc();
-CREATE TRIGGER ingest_picklist_entry_trigger
- AFTER INSERT OR UPDATE ON acq.picklist_entry
+CREATE TRIGGER ingest_lineitem_trigger
+ AFTER INSERT OR UPDATE ON acq.lineitem
FOR EACH ROW EXECUTE PROCEDURE public.ingest_acq_marc();
CREATE OR REPLACE FUNCTION acq.exchange_ratio ( from_ex TEXT, to_ex TEXT ) RETURNS NUMERIC AS $$
More information about the open-ils-commits
mailing list