From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 1 Apr 2010 19:21:01 +0000 (+0000)
Subject: fields for supporting bib record ownership and sharing
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a41a38db3045504ecc3dedfa07fe89c913d627db;p=evergreen%2Fmasslnc.git

fields for supporting bib record ownership and sharing

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16094 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 0497560e0a..9d4cc783a9 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -1702,6 +1702,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Record Source" name="source" reporter:datatype="link"/>
 			<field reporter:label="TCN Source" name="tcn_source"  reporter:datatype="text"/>
 			<field reporter:label="TCN Value" name="tcn_value"  reporter:datatype="text"/>
+			<field reporter:label="Owner" name="owner"  reporter:datatype="org_unit"/>
+			<field reporter:label="Share Depth" name="share_depth"  reporter:datatype="int"/>
 			<field reporter:label="Metarecord" name="metarecord" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Language Code" name="language" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Non-MARC Record Notes" name="notes" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -1714,6 +1716,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Simple Record Extracts " name="simple_record" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
 		<links>
+			<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
 			<link field="editor" reltype="has_a" key="id" map="" class="au"/>
 			<link field="creator" reltype="has_a" key="id" map="" class="au"/>
 			<link field="simple_record" reltype="might_have" key="id" map="" class="rmsr"/>
diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/biblio.pm
index 0a6b447a09..46fefaab6e 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/biblio.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/biblio.pm
@@ -10,7 +10,7 @@ use base qw/biblio/;
 
 biblio::record_entry->table( 'biblio_record_entry' );
 biblio::record_entry->columns( Essential => qw/id tcn_source tcn_value creator editor
-				      create_date edit_date source active quality
+				      create_date edit_date source active quality owner share_depth
 				      deleted marc last_xact_id fingerprint/ );
 
 #-------------------------------------------------------------------------------
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index fec295ed6d..ea1a63b04c 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -60,7 +60,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0224'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0225'); -- miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/010.schema.biblio.sql b/Open-ILS/src/sql/Pg/010.schema.biblio.sql
index e55cecdca4..afae8b3277 100644
--- a/Open-ILS/src/sql/Pg/010.schema.biblio.sql
+++ b/Open-ILS/src/sql/Pg/010.schema.biblio.sql
@@ -39,7 +39,9 @@ CREATE TABLE biblio.record_entry (
 	tcn_source	TEXT		NOT NULL DEFAULT 'AUTOGEN',
 	tcn_value	TEXT		NOT NULL DEFAULT biblio.next_autogen_tcn_value(),
 	marc		TEXT		NOT NULL,
-	last_xact_id	TEXT		NOT NULL
+	last_xact_id	TEXT		NOT NULL,
+    owner       INT,
+    share_depth INT
 );
 CREATE INDEX biblio_record_entry_creator_idx ON biblio.record_entry ( creator );
 CREATE INDEX biblio_record_entry_create_date_idx ON biblio.record_entry ( create_date );
diff --git a/Open-ILS/src/sql/Pg/800.fkeys.sql b/Open-ILS/src/sql/Pg/800.fkeys.sql
index 4480a30a41..06de96b52b 100644
--- a/Open-ILS/src/sql/Pg/800.fkeys.sql
+++ b/Open-ILS/src/sql/Pg/800.fkeys.sql
@@ -47,6 +47,7 @@ ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_editor_fkey FOR
 
 ALTER TABLE biblio.record_entry ADD CONSTRAINT biblio_record_entry_creator_fkey FOREIGN KEY (creator) REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED;
 ALTER TABLE biblio.record_entry ADD CONSTRAINT biblio_record_entry_editor_fkey FOREIGN KEY (editor) REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE biblio.record_entry ADD CONSTRAINT biblio_record_entry_owner_fkey FOREIGN KEY (owner) REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED;
 
 ALTER TABLE metabib.metarecord ADD CONSTRAINT metabib_metarecord_master_record_fkey FOREIGN KEY (master_record) REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED;
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/0225.schema.record_ownership.sql b/Open-ILS/src/sql/Pg/upgrade/0225.schema.record_ownership.sql
new file mode 100644
index 0000000000..94adad7f94
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/0225.schema.record_ownership.sql
@@ -0,0 +1,13 @@
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0225');
+
+ALTER TABLE biblio.record_entry ADD COLUMN owner INT REFERENCES actor.org_unit (id);
+ALTER TABLE biblio.record_entry ADD COLUMN share_depth INT;
+
+ALTER TABLE auditor.biblio_record_entry_history ADD COLUMN owner INT;
+ALTER TABLE auditor.biblio_record_entry_history ADD COLUMN share_depth INT;
+
+COMMIT;
+