LP1248734: Add workstation to in-house use
authorChris Sharp <csharp@georgialibraries.org>
Tue, 16 Jun 2020 15:56:33 +0000 (11:56 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 27 Jul 2020 14:03:33 +0000 (10:03 -0400)
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/action.pm
Open-ILS/src/sql/Pg/090.schema.action.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1248734_add_ws_to_ihu.sql [new file with mode: 0644]

index 8b4bf85..f7bfcf7 100644 (file)
@@ -2402,11 +2402,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Item" name="item" reporter:datatype="int" />
                        <field reporter:label="Using Library" name="org_unit" reporter:datatype="org_unit"/>
                        <field reporter:label="Recording Staff" name="staff" reporter:datatype="link"/>
+                       <field reporter:label="Workstation" name="workstation" reporter:datatype="link"/>
                        <field reporter:label="Use Date/Time" name="use_time" reporter:datatype="timestamp"/>
                </fields>
                <links>
                        <link field="item" reltype="has_a" key="id" map="" class="acp"/>
                        <link field="staff" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="workstation" reltype="has_a" key="id" map="" class="aws"/>
                        <link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
@@ -2421,11 +2423,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Item Type" name="item_type" reporter:datatype="link"/>
                        <field reporter:label="Using Library" name="org_unit" reporter:datatype="org_unit"/>
                        <field reporter:label="Recording Staff" name="staff" reporter:datatype="link"/>
+                       <field reporter:label="Workstation" name="workstation" reporter:datatype="link"/>
                        <field reporter:label="Use Date/Time" name="use_time" reporter:datatype="timestamp"/>
                </fields>
                <links>
                        <link field="item_type" reltype="has_a" key="id" map="" class="cnct"/>
                        <link field="staff" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="workstation" reltype="has_a" key="id" map="" class="aws"/>
                        <link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
index af9c9af..bb4412b 100644 (file)
@@ -773,6 +773,7 @@ sub create_in_house_use {
         }
 
         $ihu->staff($e->requestor->id);
+        $ihu->workstation($e->requestor->wsid);
         $ihu->org_unit($org);
         $ihu->use_time($use_time);
 
index 599764f..1a43510 100644 (file)
@@ -702,6 +702,7 @@ sub modify_from_fieldmapper {
 
     action::in_house_use->has_a( org_unit => 'actor::org_unit' );
     action::in_house_use->has_a( staff => 'actor::user' );
+    action::in_house_use->has_a( workstation => 'actor::workstation' );
     action::in_house_use->has_a( item => 'asset::copy' );
 
     action::non_cataloged_circulation->has_a( circ_lib => 'actor::org_unit' );
index 5a59393..1dd595d 100644 (file)
@@ -10,14 +10,14 @@ package action::in_house_use;
 use base qw/action/;
 __PACKAGE__->table('action_in_house_use');
 __PACKAGE__->columns(Primary => 'id');
-__PACKAGE__->columns(Essential => qw/item staff org_unit use_time/);
+__PACKAGE__->columns(Essential => qw/item staff workstation org_unit use_time/);
 #-------------------------------------------------------------------------------
 
 package action::non_cat_in_house_use;
 use base qw/action/;
 __PACKAGE__->table('action_non_cat_in_house_use');
 __PACKAGE__->columns(Primary => 'id');
-__PACKAGE__->columns(Essential => qw/item_type staff org_unit use_time/);
+__PACKAGE__->columns(Essential => qw/item_type staff workstation org_unit use_time/);
 #-------------------------------------------------------------------------------
 
 package action::non_cataloged_circulation;
index 8d8163b..685a4c3 100644 (file)
@@ -25,10 +25,12 @@ CREATE TABLE action.in_house_use (
        id              SERIAL                          PRIMARY KEY,
        item            BIGINT                          NOT NULL, -- REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED, -- XXX could be an serial.issuance
        staff           INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
+       workstation INT                         REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED,
        org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
        use_time        TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW()
 );
 CREATE INDEX action_in_house_use_staff_idx      ON action.in_house_use ( staff );
+CREATE INDEX action_in_house_use_ws_idx ON action.in_house_use ( workstation );
 
 CREATE TABLE action.non_cataloged_circulation (
        id              SERIAL                          PRIMARY KEY,
@@ -45,10 +47,12 @@ CREATE TABLE action.non_cat_in_house_use (
        id              SERIAL                          PRIMARY KEY,
        item_type       BIGINT                          NOT NULL REFERENCES config.non_cataloged_type(id) DEFERRABLE INITIALLY DEFERRED,
        staff           INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
+       workstation INT                         REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED,
        org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
        use_time        TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW()
 );
 CREATE INDEX non_cat_in_house_use_staff_idx ON action.non_cat_in_house_use ( staff );
+CREATE INDEX non_cat_in_house_use_ws_idx ON action.non_cat_in_house_use ( workstation );
 
 CREATE TABLE action.survey (
        id              SERIAL                          PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1248734_add_ws_to_ihu.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1248734_add_ws_to_ihu.sql
new file mode 100644 (file)
index 0000000..5cb74bf
--- /dev/null
@@ -0,0 +1,8 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE action.in_house_use ADD COLUMN workstation INT REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE action.non_cat_in_house_use ADD COLUMN workstation INT REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;