From 6f8de773efc03e8c8869d34207468c46cd3a6b3e Mon Sep 17 00:00:00 2001 From: dbwells Date: Mon, 19 Jul 2010 14:00:41 +0000 Subject: [PATCH] - Latest serials development schema and IDL - Changes to rdetail.js (default only for now) to send serial 'drawn' event information to client git-svn-id: svn://svn.open-ils.org/ILS/branches/seials-integration@16976 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 366 ++++++++++++++++++++++++--- Open-ILS/src/sql/Pg/210.schema.serials.sql | 255 ++++++++++++++++--- Open-ILS/web/opac/skin/default/js/rdetail.js | 15 ++ 3 files changed, 576 insertions(+), 60 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 8066397b2d..aac171bd8d 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2937,6 +2937,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + @@ -2967,77 +2968,382 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - + + + + + + - - - + + + + - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + - - - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + - + + - + - + + + + + + + + + - + + - + - + + + + + + + + + diff --git a/Open-ILS/src/sql/Pg/210.schema.serials.sql b/Open-ILS/src/sql/Pg/210.schema.serials.sql index 1eadf55db3..69766f0b3c 100644 --- a/Open-ILS/src/sql/Pg/210.schema.serials.sql +++ b/Open-ILS/src/sql/Pg/210.schema.serials.sql @@ -1,6 +1,6 @@ -DROP SCHEMA serial CASCADE; +DROP SCHEMA IF EXISTS serial CASCADE; BEGIN; @@ -17,7 +17,7 @@ CREATE TABLE serial.record_entry ( edit_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), active BOOL NOT NULL DEFAULT TRUE, deleted BOOL NOT NULL DEFAULT FALSE, - marc TEXT NOT NULL, + marc TEXT, last_xact_id TEXT NOT NULL ); CREATE INDEX serial_record_entry_creator_idx ON serial.record_entry ( creator ); @@ -27,48 +27,243 @@ CREATE INDEX serial_record_entry_owning_lib_idx ON serial.record_entry ( owning_ CREATE RULE protect_mfhd_delete AS ON DELETE TO serial.record_entry DO INSTEAD UPDATE serial.record_entry SET deleted = true WHERE old.id = serial.record_entry.id; CREATE TABLE serial.subscription ( - id SERIAL PRIMARY KEY, - callnumber BIGINT REFERENCES asset.call_number (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, - uri INT REFERENCES asset.uri (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, - start_date DATE NOT NULL, - end_date DATE -- interpret NULL as current subscription + id SERIAL PRIMARY KEY, + owning_lib INT NOT NULL DEFAULT 1 REFERENCES actor.org_unit (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, + start_date TIMESTAMP WITH TIME ZONE NOT NULL, + end_date TIMESTAMP WITH TIME ZONE, -- interpret NULL as current subscription + record_entry BIGINT REFERENCES biblio.record_entry (id) + ON DELETE SET NULL + DEFERRABLE INITIALLY DEFERRED, + expected_date_offset INTERVAL + -- acquisitions/business-side tables link to here ); -CREATE TABLE serial.binding_unit ( - id SERIAL PRIMARY KEY, - subscription INT NOT NULL REFERENCES serial.subscription (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - label TEXT NOT NULL, - CONSTRAINT bu_label_once_per_sub UNIQUE (subscription, label) +CREATE TABLE serial.subscription_note ( + id SERIAL PRIMARY KEY, + subscription INT NOT NULL + REFERENCES serial.subscription (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + creator INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + pub BOOL NOT NULL DEFAULT FALSE, + title TEXT NOT NULL, + value TEXT NOT NULL +); + +CREATE TABLE serial.caption_and_pattern ( + id SERIAL PRIMARY KEY, + subscription INT NOT NULL + REFERENCES serial.subscription (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + type TEXT NOT NULL + CONSTRAINT cap_type CHECK ( type in + ( 'basic', 'supplement', 'index' )), + create_date TIMESTAMPTZ NOT NULL DEFAULT now(), + active BOOL NOT NULL DEFAULT FALSE, + pattern_code TEXT NOT NULL, -- must contain JSON + enum_1 TEXT, + enum_2 TEXT, + enum_3 TEXT, + enum_4 TEXT, + enum_5 TEXT, + enum_6 TEXT, + chron_1 TEXT, + chron_2 TEXT, + chron_3 TEXT, + chron_4 TEXT, + chron_5 TEXT +); + +--at least one distribution per org_unit holding issues +CREATE TABLE serial.distribution ( + id SERIAL PRIMARY KEY, + record_entry BIGINT REFERENCES serial.record_entry (id) + ON DELETE SET NULL + DEFERRABLE INITIALLY DEFERRED, + subscription INT NOT NULL + REFERENCES serial.subscription (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + holding_lib INT NOT NULL + REFERENCES actor.org_unit (id) + DEFERRABLE INITIALLY DEFERRED, + label TEXT NOT NULL, + receive_call_number BIGINT REFERENCES asset.call_number (id) + DEFERRABLE INITIALLY DEFERRED, + receive_unit_template INT REFERENCES asset.copy_template (id) + DEFERRABLE INITIALLY DEFERRED, + bind_call_number BIGINT REFERENCES asset.call_number (id) + DEFERRABLE INITIALLY DEFERRED, + bind_unit_template INT REFERENCES asset.copy_template (id) + DEFERRABLE INITIALLY DEFERRED, + unit_label_prefix TEXT, + unit_label_suffix TEXT +); +CREATE UNIQUE INDEX one_dist_per_sre_idx ON serial.distribution (record_entry); + +CREATE TABLE serial.distribution_note ( + id SERIAL PRIMARY KEY, + distribution INT NOT NULL + REFERENCES serial.distribution (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + creator INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + pub BOOL NOT NULL DEFAULT FALSE, + title TEXT NOT NULL, + value TEXT NOT NULL +); + +CREATE TABLE serial.stream ( + id SERIAL PRIMARY KEY, + distribution INT NOT NULL + REFERENCES serial.distribution (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + routing_label TEXT +); + +CREATE UNIQUE INDEX label_once_per_dist + ON serial.stream (distribution, routing_label) + WHERE routing_label IS NOT NULL; + +CREATE TABLE serial.routing_list_user ( + id SERIAL PRIMARY KEY, + stream INT NOT NULL + REFERENCES serial.stream + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + pos INT NOT NULL DEFAULT 1, + reader INT REFERENCES actor.usr + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + department TEXT, + note TEXT, + CONSTRAINT one_pos_per_routing_list UNIQUE ( stream, pos ), + CONSTRAINT reader_or_dept CHECK + ( + -- Recipient is a person or a department, but not both + (reader IS NOT NULL AND department IS NULL) OR + (reader IS NULL AND department IS NOT NULL) + ) ); CREATE TABLE serial.issuance ( - id SERIAL PRIMARY KEY, - subscription INT NOT NULL REFERENCES serial.subscription (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - target_copy BIGINT REFERENCES asset.copy (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - location BIGINT REFERENCES asset.copy_location(id) DEFERRABLE INITIALLY DEFERRED, - binding_unit INT REFERENCES serial.binding_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - label TEXT + id SERIAL PRIMARY KEY, + creator INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + editor INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + edit_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + subscription INT NOT NULL + REFERENCES serial.subscription (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + label TEXT, + date_published TIMESTAMP WITH TIME ZONE, + caption_and_pattern INT REFERENCES serial.caption_and_pattern (id) + DEFERRABLE INITIALLY DEFERRED, + holding_code TEXT, + holding_type TEXT CONSTRAINT valid_holding_type CHECK + ( + holding_type IS NULL + OR holding_type IN ('basic','supplement','index') + ), + holding_link_id INT -- probably defunct + -- TODO: add columns for separate enumeration/chronology values +); + +CREATE TABLE serial.unit ( + sort_key TEXT, + detailed_contents TEXT NOT NULL, + summary_contents TEXT NOT NULL +) INHERITS (asset.copy); + +ALTER TABLE serial.unit ADD PRIMARY KEY (id); + +-- must create this rule explicitly; it is not inherited from asset.copy +CREATE RULE protect_serial_unit_delete AS ON DELETE TO serial.unit DO INSTEAD UPDATE serial.unit SET deleted = TRUE WHERE OLD.id = serial.unit.id; + +CREATE TABLE serial.item ( + id SERIAL PRIMARY KEY, + creator INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + editor INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + edit_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), + issuance INT NOT NULL + REFERENCES serial.issuance (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + stream INT NOT NULL + REFERENCES serial.stream (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + unit INT REFERENCES serial.unit (id) + ON DELETE SET NULL + DEFERRABLE INITIALLY DEFERRED, + uri INT REFERENCES asset.uri (id) + ON DELETE SET NULL + DEFERRABLE INITIALLY DEFERRED, + date_expected TIMESTAMP WITH TIME ZONE, + date_received TIMESTAMP WITH TIME ZONE +); + +CREATE TABLE serial.item_note ( + id SERIAL PRIMARY KEY, + item INT NOT NULL + REFERENCES serial.item (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + creator INT NOT NULL + REFERENCES actor.usr (id) + DEFERRABLE INITIALLY DEFERRED, + create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), + pub BOOL NOT NULL DEFAULT FALSE, + title TEXT NOT NULL, + value TEXT NOT NULL ); CREATE TABLE serial.bib_summary ( - id SERIAL PRIMARY KEY, - subscription INT UNIQUE NOT NULL REFERENCES serial.subscription (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - generated_coverage TEXT NOT NULL, - textual_holdings TEXT + id SERIAL PRIMARY KEY, + distribution INT NOT NULL + REFERENCES serial.distribution (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + generated_coverage TEXT NOT NULL, + textual_holdings TEXT ); CREATE TABLE serial.sup_summary ( - id SERIAL PRIMARY KEY, - subscription INT UNIQUE NOT NULL REFERENCES serial.subscription (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - generated_coverage TEXT NOT NULL, - textual_holdings TEXT + id SERIAL PRIMARY KEY, + distribution INT NOT NULL + REFERENCES serial.distribution (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + generated_coverage TEXT NOT NULL, + textual_holdings TEXT ); CREATE TABLE serial.index_summary ( - id SERIAL PRIMARY KEY, - subscription INT UNIQUE NOT NULL REFERENCES serial.subscription (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, - generated_coverage TEXT NOT NULL, - textual_holdings TEXT + id SERIAL PRIMARY KEY, + distribution INT NOT NULL + REFERENCES serial.distribution (id) + ON DELETE CASCADE + DEFERRABLE INITIALLY DEFERRED, + generated_coverage TEXT NOT NULL, + textual_holdings TEXT ); COMMIT; diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index d9d05b8821..0713e97e2d 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -42,6 +42,8 @@ var rdetailNext = null; var rdetailStart = null; var rdetailEnd = null; +var mfhdDetails = []; + /* serials are currently the only use of Dojo strings in the OPAC */ if (rdetailDisplaySerialHoldings) { dojo.require("dijit.Menu"); @@ -243,6 +245,10 @@ function _holdingsDraw(h) { dojo.forEach(holdings, _holdingsDrawMFHD); + // Populate XUL menus + if (isXUL()) { + runEvt('rdetail','MFHDDrawn'); + } } function _holdingsDrawMFHD(holdings, entryNum) { @@ -284,6 +290,14 @@ function _holdingsDrawMFHD(holdings, entryNum) { } } + // Show entryNum + 1 in staff client for better menu correlation + // Maybe this should be holdings.id() instead? (which could get long after time) + var entryNumString = ''; + if (isXUL()) { + var entryNumInc = entryNum + 1; + entryNumString = ' [Entry #'+entryNumInc+'] '; + } + dojo.place("
" + dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) + "