From e64d2e58586fe7be50e435b01c7b84437ace4499 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 6 Feb 2009 02:07:42 +0000 Subject: [PATCH] adding hold-cancel cause and note table and fields; teaching hold targeter how to use the cancel_cause field git-svn-id: svn://svn.open-ils.org/ILS/trunk@12088 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 24 ++++++++++++++++++++++ .../OpenILS/Application/Storage/CDBI/action.pm | 4 ++-- .../Application/Storage/Publisher/action.pm | 2 +- Open-ILS/src/sql/Pg/090.schema.action.sql | 11 ++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index a9ba57b446..5edc7a37a2 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2614,6 +2614,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + @@ -2628,6 +2630,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + @@ -3637,6 +3640,27 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + + + + + + 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 208d3a5e69..c8335b4217 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm @@ -93,9 +93,9 @@ use base qw/action/; __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 + prev_check_time expire_time requestor usr cancel_cause hold_type holdable_formats target cancel_time - phone_notify email_notify selection_depth + phone_notify email_notify selection_depth cancel_note pickup_lib current_copy request_lib frozen thaw_date fulfillment_staff fulfillment_lib selection_ou/); 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 5e90be8aea..8a9495797d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -890,7 +890,7 @@ sub new_hold_copy_targeter { if ($hold->expire_time) { my $ex_time = $parser->parse_datetime( clense_ISO8601( $hold->expire_time ) ); - $hold->update( { cancel_time => 'now' } ) if ( DateTime->compare($ex_time, DateTime->now) < 0 ); + $hold->update( { cancel_cause => 1, cancel_time => 'now' } ) if ( DateTime->compare($ex_time, DateTime->now) < 0 ); $self->method_lookup('open-ils.storage.transaction.commit')->run; } diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 7acb64a588..8eb20006d4 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -247,6 +247,15 @@ CREATE TRIGGER action_circulation_stop_fines_tgr FOR EACH ROW EXECUTE PROCEDURE action.circulation_claims_returned (); +CREATE TABLE action.hold_request_cancel_cause ( + id SERIAL PRIMARY KEY, + label TEXT UNIQUE +); +INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Untargeted expiration'); +INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Hold Shelf expiration'); +INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Patron via phone'); +INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Patron in person'); +INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Staff forced'); CREATE TABLE action.hold_request ( id SERIAL PRIMARY KEY, @@ -258,6 +267,8 @@ CREATE TABLE action.hold_request ( prev_check_time TIMESTAMP WITH TIME ZONE, expire_time TIMESTAMP WITH TIME ZONE, cancel_time TIMESTAMP WITH TIME ZONE, + cancel_cause INT REFERENCES action.hold_request_cancel_cause (id) ON DELETE SET NULL, + cancel_note TEXT, target BIGINT NOT NULL, -- see hold_type current_copy BIGINT REFERENCES asset.copy (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, fulfillment_staff INT REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, -- 2.11.0