From 0d73ab390d2791035c123b040d938ec7e07cc477 Mon Sep 17 00:00:00 2001 From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Tue, 20 Oct 2009 18:59:20 +0000 Subject: [PATCH] Adding support for pushing to the front of the hold queue with a cut_in_line boolean field. Setting this on an action.hold_request will cause the hold to sort to the top of the queue in calls to open-ils.storage.action.hold_request.nearest_hold, which is used to capture holds in priority order. Currently, this field sorts /after/ the hold proximity. When strict FIFO holds are implemented, this sort will go to the front of the line, followed by request_time and then proximity. git-svn-id: svn://svn.open-ils.org/ILS/trunk@14509 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 1 + .../src/perlmods/OpenILS/Application/Storage/CDBI/action.pm | 2 +- .../perlmods/OpenILS/Application/Storage/Publisher/action.pm | 1 + Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/090.schema.action.sql | 3 ++- .../src/sql/Pg/upgrade/0040.schema.force-hold-to-front.sql | 10 ++++++++++ 6 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0040.schema.force-hold-to-front.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index fe7f6cc69e..44a6475325 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2713,6 +2713,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA <field reporter:label="Shelf Time" name="shelf_time" reporter:datatype="timestamp"/> <field reporter:label="Cancelation cause" name="cancel_cause" reporter:datatype="link" /> <field reporter:label="Cancelation note" name="cancel_note" reporter:datatype="text" /> + <field reporter:label="Top of Queue" name="cut_in_line" reporter:datatype="bool" /> <field reporter:label="Notes" name="notes" reporter:datatype="link" oils_persist:virtual="true"/> </fields> <links> diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm index 0710c3fbdc..31136d4176 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm @@ -97,7 +97,7 @@ __PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time hold_type holdable_formats target cancel_time shelf_time phone_notify email_notify selection_depth cancel_note pickup_lib current_copy request_lib frozen thaw_date - fulfillment_staff fulfillment_lib selection_ou/); + fulfillment_staff fulfillment_lib selection_ou cut_in_line/); #------------------------------------------------------------------------------- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm index 4dfb654ff5..d894bfbda3 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -273,6 +273,7 @@ sub nearest_hold { AND h.frozen IS FALSE ORDER BY p.prox, + CASE WHEN h.cut_in_line IS TRUE THEN 0 ELSE 1 END, h.selection_depth DESC, h.request_time LIMIT $limit diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index fa183ad786..2a095d8283 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -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 ('0039'); -- mck9 +INSERT INTO config.upgrade_log (version) VALUES ('0040'); -- miker CREATE TABLE config.bib_source ( diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 402ac44856..f5ece155ca 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -349,7 +349,8 @@ CREATE TABLE action.hold_request ( email_notify BOOL NOT NULL DEFAULT TRUE, frozen BOOL NOT NULL DEFAULT FALSE, thaw_date TIMESTAMP WITH TIME ZONE, - shelf_time TIMESTAMP WITH TIME ZONE + shelf_time TIMESTAMP WITH TIME ZONE, + cut_in_line BOOL ); CREATE INDEX hold_request_target_idx ON action.hold_request (target); diff --git a/Open-ILS/src/sql/Pg/upgrade/0040.schema.force-hold-to-front.sql b/Open-ILS/src/sql/Pg/upgrade/0040.schema.force-hold-to-front.sql new file mode 100644 index 0000000000..cec7a6c4e2 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0040.schema.force-hold-to-front.sql @@ -0,0 +1,10 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0040'); -- miker + +ALTER TABLE action.hold_request ADD COLUMN cut_in_line BOOL; + +COMMIT; + +ALTER TABLE auditor.action_hold_request_history ADD COLUMN cut_in_line BOOL; + -- 2.11.0