LP1744341 Hold targeter --retarget-frozen - upgrade script user/stompro/lp1744341-retarget-frozen-holds-v3-withupgrade
authorJosh Stompro <stomproj@larl.org>
Thu, 2 Mar 2023 18:12:17 +0000 (12:12 -0600)
committerJosh Stompro <stomproj@larl.org>
Thu, 2 Mar 2023 18:12:17 +0000 (12:12 -0600)
Side effect is that frozen holds get checked to see if they are expired.
Normally expire_time is unset when a hold is frozen, but there may have
been some bugs in the past that have allowed frozen holds to have it set.

This will just fix those so no holds get unexpectedly canceled when the
new option is used.

Signed-off-by: Josh Stompro <stomproj@larl.org>
Open-ILS/src/sql/Pg/upgrade/xxxx.data.lp1744341.frozen_hold_remove_expire.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.data.lp1744341.frozen_hold_remove_expire.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.data.lp1744341.frozen_hold_remove_expire.sql
new file mode 100644 (file)
index 0000000..1cd0a94
--- /dev/null
@@ -0,0 +1,24 @@
+BEGIN;
+
+#SELECT evergreen.upgrade_deps_block_check('xxxx', :eg_version);
+
+# LP#1744341 - Allow hold targeter to process frozen holds to update hold copy maps.
+
+# Side effect is that frozen holds get checked to see if they are expired.
+# Normally expire_time is unset when a hold is frozen, but there may have 
+# been some bugs in the past that have allowed frozen holds to have it set.
+
+# This will just fix those so no holds get unexpectedly canceled.
+
+# Clear the expire_time from frozen holds.
+UPDATE action.hold_request
+  set expire_time=null
+where
+  frozen
+  and expire_time IS NOT NULL
+  and cancel_time IS NULL
+  and fulfillment_time IS NULL
+  and capture_time IS NULL
+; 
+
+COMMIT;