Adding support for pushing to the front of the hold queue with a cut_in_line
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Oct 2009 18:59:20 +0000 (18:59 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Oct 2009 18:59:20 +0000 (18:59 +0000)
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
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/090.schema.action.sql
Open-ILS/src/sql/Pg/upgrade/0040.schema.force-hold-to-front.sql [new file with mode: 0644]

index fe7f6cc..44a6475 100644 (file)
@@ -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>
index 0710c3f..31136d4 100644 (file)
@@ -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/);
 
 #-------------------------------------------------------------------------------
 
index 4dfb654..d894bfb 100644 (file)
@@ -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
index fa183ad..2a095d8 100644 (file)
@@ -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 (
index 402ac44..f5ece15 100644 (file)
@@ -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 (file)
index 0000000..cec7a6c
--- /dev/null
@@ -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;
+