From e1f8a9fc862e75cde3e518ff03489ddb6afbfcda Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 12 Sep 2007 16:07:01 +0000 Subject: [PATCH] backporting frozen hold auto-thaw support before 1.2.0 ... should have been there all along git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@7766 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 1 + .../OpenILS/Application/Storage/CDBI/action.pm | 2 +- .../Application/Storage/Publisher/action.pm | 24 ++++++++++++++++++++++ Open-ILS/src/sql/Pg/090.schema.action.sql | 3 ++- .../thaw_expired_frozen_holds.srfsh | 2 ++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100755 Open-ILS/src/support-scripts/thaw_expired_frozen_holds.srfsh diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index aaa5ea439d..f6bf30c914 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -1248,6 +1248,7 @@ + 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 2f9f8526a8..c8d6bec80d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm @@ -96,7 +96,7 @@ __PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time prev_check_time expire_time requestor usr hold_type holdable_formats target cancel_time phone_notify email_notify selection_depth - pickup_lib current_copy request_lib frozen + 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 04f04eacca..06f2b1505b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -160,6 +160,30 @@ __PACKAGE__->register_method( method => 'complete_reshelving', ); +sub auto_thaw_frozen_holds { + my $self = shift; + my $client = shift; + + local $OpenILS::Application::Storage::WRITE = 1; + + my $holds = action::hold_request->table; + + my $sql = "UPDATE $holds SET frozen = FALSE WHERE frozen IS TRUE AND thaw_date < NOW();"; + + my $sth = action::hold_request->db_Main->prepare_cached($sql); + $sth->execute(); + + return $sth->rows; + +} +__PACKAGE__->register_method( + api_name => 'open-ils.storage.action.hold_request.thaw_expired_frozen', + api_level => 1, + stream => 0, + argc => 0, + method => 'auto_thaw_frozen_holds', +); + sub grab_overdue { my $self = shift; my $client = shift; diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 029867d1a7..0e06d3b43a 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -179,7 +179,8 @@ CREATE TABLE action.hold_request ( holdable_formats TEXT, phone_notify TEXT, email_notify BOOL NOT NULL DEFAULT TRUE, - frozen BOOL NOT NULL DEFAULT FALSE + frozen BOOL NOT NULL DEFAULT FALSE, + thaw_date TIMESTAMP WITH TIME ZONE ); CREATE INDEX hold_request_target_idx ON action.hold_request (target); diff --git a/Open-ILS/src/support-scripts/thaw_expired_frozen_holds.srfsh b/Open-ILS/src/support-scripts/thaw_expired_frozen_holds.srfsh new file mode 100755 index 0000000000..96d6828183 --- /dev/null +++ b/Open-ILS/src/support-scripts/thaw_expired_frozen_holds.srfsh @@ -0,0 +1,2 @@ +#!/openils/bin/srfsh +request open-ils.storage open-ils.storage.action.hold_request.thaw_expired_frozen -- 2.11.0