LP#1963541: Add canceling staff information to hold requests
authorChris Sharp <csharp@georgialibraries.org>
Fri, 19 Aug 2022 19:58:00 +0000 (15:58 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 4 May 2023 13:58:07 +0000 (09:58 -0400)
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.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.add_cancel_info_to_hold_requests.sql [new file with mode: 0644]

index 949ed2b..1746312 100644 (file)
@@ -6837,6 +6837,8 @@ SELECT  usr,
                        <field reporter:label="Target Object ID" name="target" reporter:datatype="link"/>
                        <field reporter:label="Hold User" name="usr" reporter:datatype="link"/>
                        <field reporter:label="Hold Cancel Date/Time" name="cancel_time" reporter:datatype="timestamp"/>
+                       <field reporter:label="Hold Canceling Staff" name="canceled_by" reporter:datatype="link"/>
+                       <field reporter:label="Hold Canceling Workstation" name="canceling_ws" reporter:datatype="link"/>
                        <field reporter:label="Notify Time" name="notify_time" oils_persist:virtual="true" reporter:datatype="timestamp"/>
                        <field reporter:label="Notify Count" name="notify_count" oils_persist:virtual="true" reporter:datatype="int" />
                        <field reporter:label="Notifications" name="notifications" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -6870,6 +6872,8 @@ SELECT  usr,
                        <link field="eligible_copies" reltype="has_many" key="hold" map="target_copy" class="ahcm"/>
                        <link field="bib_rec" reltype="might_have" key="id" map="" class="rhrr"/>
                        <link field="cancel_cause" reltype="might_have" key="id" map="" class="ahrcc"/>
+                       <link field="canceled_by" reltype="might_have" key="id" map="" class="au"/>
+                       <link field="canceling_ws" reltype="might_have" key="id" map="" class="aws"/>
                        <link field="notes" reltype="has_many" key="hold" map="" class="ahrn"/>
                        <link field="current_shelf_lib" reltype="has_a" key="id" map="" class="aou"/>
                        <link field="sms_carrier" reltype="has_a" key="id" map="" class="csc"/>
index d295fa2..d432bbe 100644 (file)
@@ -1120,6 +1120,8 @@ sub cancel_hold {
     $hold->cancel_time('now');
     $hold->cancel_cause($cause);
     $hold->cancel_note($note);
+    $hold->canceled_by($e->requestor->id);
+    $hold->canceling_ws($e->requestor->wsid);
     $e->update_action_hold_request($hold)
         or return $e->die_event;
 
index 1dd595d..48fa9cc 100644 (file)
@@ -94,7 +94,7 @@ __PACKAGE__->table('action_hold_request');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time
                      prev_check_time expire_time requestor usr cancel_cause
-                     hold_type holdable_formats target cancel_time shelf_time
+                     hold_type holdable_formats target cancel_time canceled_by canceling_ws shelf_time
                      phone_notify email_notify sms_notify sms_carrier selection_depth cancel_note
                      pickup_lib current_copy request_lib frozen thaw_date mint_condition
                      fulfillment_staff fulfillment_lib selection_ou cut_in_line
index 69d6b03..380cc2e 100644 (file)
@@ -465,6 +465,8 @@ CREATE TABLE action.hold_request (
        cancel_time             TIMESTAMP WITH TIME ZONE,
        cancel_cause    INT REFERENCES action.hold_request_cancel_cause (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
        cancel_note             TEXT,
+       canceled_by             INT REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
+    canceling_ws    INT REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED,   
        target                  BIGINT                          NOT NULL, -- see hold_type
        current_copy            BIGINT,                         -- REFERENCES asset.copy (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,  -- XXX could be an serial.unit now...
        fulfillment_staff       INT                             REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.add_cancel_info_to_hold_requests.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.add_cancel_info_to_hold_requests.sql
new file mode 100644 (file)
index 0000000..2039f01
--- /dev/null
@@ -0,0 +1,13 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE action.hold_request 
+ADD COLUMN canceled_by INT REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
+ADD COLUMN canceling_ws INT REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED;
+
+CREATE INDEX hold_request_canceled_by_idx ON action.hold_request (canceled_by);
+CREATE INDEX hold_request_canceling_ws_idx ON action.hold_request (canceling_ws);
+
+COMMIT;
+