From: Bill Erickson Date: Tue, 21 May 2013 15:59:36 +0000 (-0400) Subject: LP1182519 Per-Hold Behind Desk SQL/IDL X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=14a57adcdd0a8ec9c2796be9d554523197b2383e;p=evergreen%2Fequinox.git LP1182519 Per-Hold Behind Desk SQL/IDL Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 122e04486a..828e92a611 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -5148,6 +5148,7 @@ SELECT usr, + @@ -5281,6 +5282,7 @@ SELECT usr, + @@ -5349,6 +5351,7 @@ SELECT usr, + diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 9dec15f306..c2066f3ad4 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -402,7 +402,8 @@ CREATE TABLE action.hold_request ( cut_in_line BOOL, mint_condition BOOL NOT NULL DEFAULT TRUE, shelf_expire_time TIMESTAMPTZ, - current_shelf_lib INT REFERENCES actor.org_unit DEFERRABLE INITIALLY DEFERRED + current_shelf_lib INT REFERENCES actor.org_unit DEFERRABLE INITIALLY DEFERRED, + behind_desk BOOLEAN NOT NULL DEFAULT FALSE ); ALTER TABLE action.hold_request ADD CONSTRAINT sms_check CHECK ( sms_notify IS NULL diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.per-hold-behind-desk.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.per-hold-behind-desk.sql new file mode 100644 index 0000000000..4f0458cb0a --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.per-hold-behind-desk.sql @@ -0,0 +1,31 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +ALTER TABLE action.hold_request + ADD COLUMN behind_desk BOOLEAN NOT NULL DEFAULT FALSE; + +-- The value on the hold is the new arbiter of whether a +-- hold should be held behind the desk and reported as such +-- Update existing holds that would in the current regime +-- be considered behind-the-desk holds to use the new column + +UPDATE action.hold_request ahr + SET behind_desk = TRUE + FROM actor.usr_setting aus + WHERE + ahr.cancel_time IS NULL AND + ahr.fulfillment_time IS NULL AND + aus.usr = ahr.usr AND + aus.name = 'circ.holds_behind_desk' AND + aus.value = 'true' AND + EXISTS ( + SELECT 1 + FROM actor.org_unit_ancestor_setting( + 'circ.holds.behind_desk_pickup_supported', + ahr.pickup_lib + ) + WHERE value = 'true' + ); + +COMMIT;