New tables/classes
authorMike Rylander <mrylander@gmail.com>
Tue, 15 Feb 2011 21:11:36 +0000 (16:11 -0500)
committerMike Rylander <mrylander@gmail.com>
Tue, 15 Feb 2011 21:11:36 +0000 (16:11 -0500)
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm
Open-ILS/src/sql/Pg/010.schema.biblio.sql
Open-ILS/src/sql/Pg/040.schema.asset.sql

index 0f13006..baa6955 100644 (file)
@@ -1933,6 +1933,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
             </actions>
         </permacrud>
        </class>
+       <class id="bmp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="biblio::monograph_part" oils_persist:tablename="biblio.monograph_part" reporter:label="Monograph Parts">
+               <fields oils_persist:primary="id" oils_persist:sequence="biblio.monograph_part_id_seq">
+                       <field name="id" reporter:datatype="id" />
+                       <field name="record" reporter:datatype="link"/>
+                       <field name="label" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="record" reltype="has_a" key="id" map="" class="bre"/>
+               </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_MONOGRAPH_PART" global_required="true"/>
+                <retrieve/>
+                <update permission="UPDATE_MONOGRAPH_PART" global_required="true"/>
+                <delete permission="DELETE_MONOGRAPH_PART" global_required="true"/>
+            </actions>
+        </permacrud>
+       </class>
+       <class id="acpm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy_part_map" oils_persist:tablename="asset.copy_part_map" reporter:label="Copy Monograph Part Map">
+               <fields oils_persist:primary="target_copy">
+                       <field name="target_copy" reporter:datatype="link" />
+                       <field name="part" reporter:datatype="link"/>
+               </fields>
+               <links>
+                       <link field="target_copy" reltype="has_a" key="id" map="" class="acp"/>
+                       <link field="part" reltype="has_a" key="id" map="" class="bmp"/>
+               </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="MAP_MONOGRAPH_PART" global_required="true"/>
+                <retrieve/>
+                <update permission="MAP_MONOGRAPH_PART" global_required="true"/>
+                <delete permission="MAP_MONOGRAPH_PART" global_required="true"/>
+            </actions>
+        </permacrud>
+       </class>
        <class id="aoucd" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_unit::closed_date" oils_persist:tablename="actor.org_unit_closed" reporter:label="Closed Dates">
                <fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_closed_id_seq">
                        <field name="close_end" reporter:datatype="timestamp" />
index 39eb01b..e69e101 100644 (file)
@@ -59,6 +59,14 @@ __PACKAGE__->columns( Essential => qw/call_number barcode creator create_date ed
                                   age_protect floating cost status_changed_time/ );
 
 #-------------------------------------------------------------------------------
+package asset::copy_part_map;
+use base qw/asset/;
+
+__PACKAGE__->table( 'asset_copy_part_map' );
+__PACKAGE__->columns( Primary => qw/target_copy/ );
+__PACKAGE__->columns( Essential => qw/part/);
+
+#-------------------------------------------------------------------------------
 package asset::stat_cat;
 use base qw/asset/;
 
index 46fefaa..5d104ab 100644 (file)
@@ -22,5 +22,13 @@ biblio::record_note->columns( Essential => qw/id record value creator
                                        editor create_date edit_date pub/ );
 #-------------------------------------------------------------------------------
 
+#-------------------------------------------------------------------------------
+package biblio::monograph_part;
+use base qw/biblio/;
+
+biblio::monograph_part->table( 'biblio_monograph_part' );
+biblio::monograph_part->columns( Essential => qw/id record label/ );
+#-------------------------------------------------------------------------------
+
 1;
 
index 428b575..ce208b2 100644 (file)
@@ -79,4 +79,11 @@ CREATE INDEX biblio_record_note_record_idx ON biblio.record_note ( record );
 CREATE INDEX biblio_record_note_creator_idx ON biblio.record_note ( creator );
 CREATE INDEX biblio_record_note_editor_idx ON biblio.record_note ( editor );
 
+CREATE TABLE biblio.monograph_part (
+    id      SERIAL  PRIMARY KEY,
+    record  BIGINT  NOT NULL REFERENCES biblio.record_entry (id),
+    label   TEXT    NOT NULL,
+    CONSTRAINT record_label_unique UNIQUE (record,label)
+);
+
 COMMIT;
index cb73896..d203ef7 100644 (file)
@@ -91,6 +91,11 @@ CREATE INDEX cp_editor_idx   ON asset.copy ( editor );
 CREATE INDEX cp_create_date  ON asset.copy (create_date);
 CREATE RULE protect_copy_delete AS ON DELETE TO asset.copy DO INSTEAD UPDATE asset.copy SET deleted = TRUE WHERE OLD.id = asset.copy.id;
 
+CREATE TABLE asset.copy_part_map (
+    target_copy BIGINT  PRIMARY KEY, -- points o asset.copy
+    part        INT     NOT NULL REFERENCES biblio.monograph_part (id) ON DELETE CASCADE
+);
+
 CREATE TABLE asset.opac_visible_copies (
   id        BIGINT primary key, -- copy id
   record    BIGINT,