add tracking table for booking reservations transits (similar to hold transits)
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 17 Dec 2009 21:49:05 +0000 (21:49 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 17 Dec 2009 21:49:05 +0000 (21:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15188 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/095.schema.booking.sql
Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql [new file with mode: 0644]

index 2196918..3a104da 100644 (file)
@@ -4065,6 +4065,41 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
        </class>
 
 
+       <class id="artc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::reservation_transit_copy" oils_persist:tablename="action.reservation_transit_copy" reporter:core="true" reporter:label="Reservation Transit">
+               <fields oils_persist:primary="id" oils_persist:sequence="action.transit_copy_id_seq">
+                       <field reporter:label="Copy Status at Transit" name="copy_status" reporter:datatype="link"/>
+                       <field reporter:label="Destination Library" name="dest" reporter:datatype="org_unit"/>
+                       <field reporter:label="Receive Date/Time" name="dest_recv_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Reservation requiring Transit" name="reservation" reporter:datatype="link"/>
+                       <field reporter:label="Transit ID" name="id" reporter:datatype="id" />
+                       <field reporter:label="Is Persistent?" name="persistant_transfer" reporter:datatype="bool"/>
+                       <field reporter:label="Previous Stop" name="prev_hop" reporter:datatype="link"/>
+                       <field reporter:label="Sending Library" name="source" reporter:datatype="org_unit"/>
+                       <field reporter:label="Send Date/Time" name="source_send_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Transited Copy" name="target_copy" reporter:datatype="link"/>
+                       <field reporter:label="Base Transit" name="transit_copy" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Prev Destination Library" name="prev_dest" reporter:datatype="org_unit"/>
+               </fields>
+               <links>
+                       <link field="transit_copy" reltype="might_have" key="id" map="" class="atc"/>
+                       <link field="target_copy" reltype="has_a" key="id" map="" class="brsrc"/>
+                       <link field="source" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="copy_status" reltype="has_a" key="id" map="" class="ccs"/>
+                       <link field="dest" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="prev_dest" reltype="has_a" key="id" map="" class="aou"/>
+                       <link field="reservation" reltype="has_a" key="id" map="" class="bresv"/>
+               </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="TRANSIT_COPY">
+                    <context link="target_copy" field="owner"/>
+                </create>
+                <retrieve/>
+                <update permission="UPDATE_TRANSIT" context_field="dest source"/>
+                <delete permission="DELETE_TRANSIT" context_field="dest source"/>
+            </actions>
+        </permacrud>
+       </class>
        <class id="ahtc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::hold_transit_copy" oils_persist:tablename="action.hold_transit_copy" reporter:core="true" reporter:label="Hold Transit">
                <fields oils_persist:primary="id" oils_persist:sequence="action.transit_copy_id_seq">
                        <field reporter:label="Copy Status at Transit" name="copy_status" reporter:datatype="link"/>
index 8802e57..8346ea4 100644 (file)
@@ -127,6 +127,16 @@ __PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy
 
 #-------------------------------------------------------------------------------
 
+package action::reservation_transit_copy;
+use base qw/action/;
+__PACKAGE__->table('action_reservation_transit_copy');
+__PACKAGE__->columns(Primary => 'id');
+__PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy
+                                    source_send_time dest_recv_time prev_hop prev_dest
+                                    copy_status reservation/);
+
+#-------------------------------------------------------------------------------
+
 package action::transit_copy;
 use base qw/action/;
 __PACKAGE__->table('action_transit_copy');
index a3fd66e..b44a836 100644 (file)
 
        #-------------------------------------------------------------------------------
 
+       package action::reservation_transit_copy;
+
+       action::reservation_transit_copy->sequence( 'action.transit_copy_id_seq' );
+       action::reservation_transit_copy->table('action.reservation_transit_copy');
+
+       #-------------------------------------------------------------------------------
+
        package action::transit_copy;
 
        action::transit_copy->sequence( 'action.transit_copy_id_seq' );
index 46fe211..ec33e7d 100644 (file)
@@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0118'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0119'); -- miker
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index 3a878a8..94ce38e 100644 (file)
@@ -156,4 +156,13 @@ CREATE TABLE booking.reservation_attr_value_map (
        CONSTRAINT bravm_logical_key UNIQUE(reservation, attr_value)
 );
 
+CREATE TABLE action.reservation_transit_copy (
+    reservation    INT REFERENCES booking.reservation (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
+) INHERITS (action.transit_copy);
+ALTER TABLE action.reservation_transit_copy ADD PRIMARY KEY (id);
+ALTER TABLE action.reservation_transit_copy ADD CONSTRAINT artc_tc_fkey FOREIGN KEY (target_copy) REFERENCES booking.resource (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+CREATE INDEX active_reservation_transit_dest_idx ON "action".reservation_transit_copy (dest);
+CREATE INDEX active_reservation_transit_source_idx ON "action".reservation_transit_copy (source);
+CREATE INDEX active_reservation_transit_cp_idx ON "action".reservation_transit_copy (target_copy);
+
 COMMIT;
diff --git a/Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql b/Open-ILS/src/sql/Pg/upgrade/119.schema.booking.transits.sql
new file mode 100644 (file)
index 0000000..c3a1814
--- /dev/null
@@ -0,0 +1,15 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0119'); -- miker
+
+CREATE TABLE action.reservation_transit_copy (
+    reservation    INT REFERENCES booking.reservation (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
+) INHERITS (action.transit_copy);
+ALTER TABLE action.reservation_transit_copy ADD PRIMARY KEY (id);
+ALTER TABLE action.reservation_transit_copy ADD CONSTRAINT artc_tc_fkey FOREIGN KEY (target_copy) REFERENCES booking.resource (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+CREATE INDEX active_reservation_transit_dest_idx ON "action".reservation_transit_copy (dest);
+CREATE INDEX active_reservation_transit_source_idx ON "action".reservation_transit_copy (source);
+CREATE INDEX active_reservation_transit_cp_idx ON "action".reservation_transit_copy (target_copy);
+
+COMMIT;
+