<class id="sunit" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="serial::unit" oils_persist:tablename="serial.unit" reporter:label="Unit">
<fields oils_persist:primary="id" oils_persist:sequence="asset.copy_id_seq">
<field reporter:label="ID" name="id" reporter:datatype="id"/>
- <field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Age Hold Protection" name="age_protect" reporter:datatype="link"/>
<field reporter:label="Alert Message" name="alert_message" reporter:datatype="text"/>
<field reporter:label="Barcode" name="barcode" reporter:datatype="text"/>
<field reporter:label="Copy Status Changed Time" name="status_changed_time" reporter:datatype="timestamp"/>
<field reporter:label="Is Mint Condition" name="mint_condition" reporter:datatype="bool"/>
<field reporter:label="Is Floating" name="floating" reporter:datatype="bool"/>
+ <field reporter:label="Cost" name="cost" reporter:datatype="money"/>
+ <field reporter:label="Sort Key" name="sort_key" reporter:datatype="text"/>
+ <field reporter:label="Summary Contents" name="summary_contents" reporter:datatype="text"/>
+ <field reporter:label="Detailed Contents" name="detailed_contents" reporter:datatype="text"/>
<field reporter:label="Copy Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Stat-Cat entry maps" name="stat_cat_entry_copy_maps" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Circulations" name="circulations" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Total Circulations" name="total_circ_count" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Holds" name="holds" oils_persist:virtual="true" reporter:datatype="link"/>
- <field reporter:label="Sort Key" name="sort_key" reporter:datatype="text"/>
- <field reporter:label="Summary Contents" name="summary_contents" reporter:datatype="text"/>
- <field reporter:label="Detailed Contents" name="detailed_contents" reporter:datatype="text"/>
+ <field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>
</class>
<class id="acp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy" oils_persist:tablename="asset.copy" reporter:core="true" reporter:label="Item">
<fields oils_persist:primary="id" oils_persist:sequence="asset.copy_id_seq">
- <field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Age Hold Protection" name="age_protect" reporter:datatype="link"/>
<field reporter:label="Alert Message" name="alert_message" reporter:datatype="text"/>
<field reporter:label="Barcode" name="barcode" reporter:datatype="text"/>
<field reporter:label="Copy Status Changed Time" name="status_changed_time" reporter:datatype="timestamp"/>
<field reporter:label="Is Mint Condition" name="mint_condition" reporter:datatype="bool"/>
<field reporter:label="Is Floating" name="floating" reporter:datatype="bool"/>
+ <field reporter:label="Cost" name="cost" reporter:datatype="money"/>
<field reporter:label="Copy Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Stat-Cat entry maps" name="stat_cat_entry_copy_maps" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Circulations" name="circulations" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Total Circulations" name="total_circ_count" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Holds" name="holds" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Statistical Category Entries" name="stat_cat_entries" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="age_protect" reltype="has_a" key="id" map="" class="crahp"/>
<field reporter:label="Fund" name="fund" reporter:datatype="link" />
<field reporter:label="Amount Paid" name="amount_paid" reporter:datatype="money" />
<field reporter:label="Purchase Order Item" name="po_item" reporter:datatype="link" />
+ <field reporter:label="Target" name="target" reporter:datatype="int" />
</fields>
<links>
<link field="invoice" reltype="has_a" key="id" map="" class="acqinv"/>
<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"/>
+ <field reporter:label="Target" name="target" reporter:datatype="int" />
</fields>
<links>
<link field="purchase_order" reltype="has_a" key="id" map="" class="acqpo"/>
</permacrud>
</class>
+ <class id="acqscl" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::serial_claim" oils_persist:tablename="acq.serial_claim" reporter:label="Serial Claim">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.serial_claim_id_seq">
+ <field reporter:label="Claim ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Claim Type" name="type" reporter:datatype="link"/>
+ <field reporter:label="Serial Item" name="item" reporter:datatype="link"/>
+ </fields>
+ <links>
+ <link field="type" reltype="has_a" key="id" map="" class="acqclt"/>
+ <link field="item" reltype="has_a" key="id" map="" class="sitem"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ </permacrud>
+ </class>
+
+ <class id="acqscle" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::serial_claim_event" oils_persist:tablename="acq.serial_claim_event" reporter:label="Serial Claim Event">
+ <fields oils_persist:primary="id" oils_persist:sequence="acq.serial_claim_event_id_seq">
+ <field reporter:label="Claim Event ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Claim Event Type" name="type" reporter:datatype="link"/>
+ <field reporter:label="Claim ID" name="claim" reporter:datatype="link"/>
+ <field reporter:label="Event Date" name="event_date" reporter:datatype="timestamp"/>
+ <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
+ <field reporter:label="Note" name="note" reporter:datatype="text"/>
+ </fields>
+ <links>
+ <link field="type" reltype="has_a" key="id" map="" class="acqclet"/>
+ <link field="claim" reltype="has_a" key="id" map="" class="acqscl"/>
+ <link field="creator" reltype="has_a" key="id" map="" class="au"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ </permacrud>
+ </class>
+
<class id="acqclp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::claim_policy" oils_persist:tablename="acq.claim_policy" reporter:label="Claim Policy">
<fields oils_persist:primary="id" oils_persist:sequence="acq.claim_policy_id_seq">
<field reporter:label="ID" name="id" reporter:datatype="id" reporter:selector="name"/>
note TEXT,
estimated_cost NUMERIC(8,2),
fund INT REFERENCES acq.fund (id)
- DEFERRABLE INITIALLY DEFERRED
+ DEFERRABLE INITIALLY DEFERRED,
+ target BIGINT
);
CREATE TABLE acq.invoice_item ( -- for invoice-only debits: taxes/fees/non-bib items/etc
DEFERRABLE INITIALLY DEFERRED,
amount_paid NUMERIC (8,2),
po_item INT REFERENCES acq.po_item (id)
- DEFERRABLE INITIALLY DEFERRED
+ DEFERRABLE INITIALLY DEFERRED,
+ target BIGINT
);
-- Patron requests
CREATE INDEX claim_event_claim_date_idx ON acq.claim_event( claim, event_date );
+-- And the serials version of claiming
+CREATE TABLE acq.serial_claim (
+ id SERIAL PRIMARY KEY,
+ type INT NOT NULL REFERENCES acq.claim_type
+ DEFERRABLE INITIALLY DEFERRED,
+ item BIGINT NOT NULL REFERENCES serial.item
+ DEFERRABLE INITIALLY DEFERRED
+);
+
+CREATE INDEX serial_claim_lid_idx ON acq.serial_claim( item );
+
+CREATE TABLE acq.serial_claim_event (
+ id BIGSERIAL PRIMARY KEY,
+ type INT NOT NULL REFERENCES acq.claim_event_type
+ DEFERRABLE INITIALLY DEFERRED,
+ claim SERIAL NOT NULL REFERENCES acq.serial_claim
+ DEFERRABLE INITIALLY DEFERRED,
+ event_date TIMESTAMPTZ NOT NULL DEFAULT now(),
+ creator INT NOT NULL REFERENCES actor.usr
+ DEFERRABLE INITIALLY DEFERRED,
+ note TEXT
+);
+
+CREATE INDEX serial_claim_event_claim_date_idx ON acq.serial_claim_event( claim, event_date );
+
COMMIT;
INSERT INTO acq.invoice_item_type (code,name) VALUES ('SHP',oils_i18n_gettext('SHP', 'Shipping Charge', 'aiit', 'name'));
INSERT INTO acq.invoice_item_type (code,name) VALUES ('HND',oils_i18n_gettext('HND', 'Handling Charge', 'aiit', 'name'));
INSERT INTO acq.invoice_item_type (code,name) VALUES ('ITM',oils_i18n_gettext('ITM', 'Non-library Item', 'aiit', 'name'));
+INSERT INTO acq.invoice_item_type (code,name) VALUES ('SUB',oils_i18n_gettext('SUB', 'Searial Subscription', 'aiit', 'name'));
INSERT INTO acq.invoice_method (code,name) VALUES ('EDI',oils_i18n_gettext('EDI', 'EDI', 'acqim', 'name'));
INSERT INTO acq.invoice_method (code,name) VALUES ('PPR',oils_i18n_gettext('PPR', 'Paper', 'acqit', 'name'));
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0360'); -- miker
+
+INSERT INTO acq.invoice_item_type (code,name) VALUES ('SUB',oils_i18n_gettext('SUB', 'Searial Subscription', 'aiit', 'name'));
+
+ALTER TABLE acq.po_item ADD COLUMN target BIGINT;
+ALTER TABLE acq.invoice_item ADD COLUMN target BIGINT;
+ALTER TABLE asset.copy ADD COLUMN cost NUMERIC(8,2);
+
+CREATE TABLE acq.serial_claim (
+ id SERIAL PRIMARY KEY,
+ type INT NOT NULL REFERENCES acq.claim_type
+ DEFERRABLE INITIALLY DEFERRED,
+ item BIGINT NOT NULL REFERENCES serial.item
+ DEFERRABLE INITIALLY DEFERRED
+);
+
+CREATE INDEX serial_claim_lid_idx ON acq.serial_claim( item );
+
+CREATE TABLE acq.serial_claim_event (
+ id BIGSERIAL PRIMARY KEY,
+ type INT NOT NULL REFERENCES acq.claim_event_type
+ DEFERRABLE INITIALLY DEFERRED,
+ claim SERIAL NOT NULL REFERENCES acq.serial_claim
+ DEFERRABLE INITIALLY DEFERRED,
+ event_date TIMESTAMPTZ NOT NULL DEFAULT now(),
+ creator INT NOT NULL REFERENCES actor.usr
+ DEFERRABLE INITIALLY DEFERRED,
+ note TEXT
+);
+
+CREATE INDEX serial_claim_event_claim_date_idx ON acq.serial_claim_event( claim, event_date );
+
+COMMIT;
+