From e78db56d368b33e94e15e858d4b59f1340925898 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 17 Feb 2006 04:04:10 +0000 Subject: [PATCH] adding method to complete reshelving of copies git-svn-id: svn://svn.open-ils.org/ILS/trunk@3099 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../Application/Storage/Publisher/action.pm | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) 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 4775f2b3dc..77cd0cfbff 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm @@ -76,6 +76,42 @@ sub overdue_circs { } +sub complete_reshelving { + my $self = shift; + my $client = shift; + my $window = shift; + + throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!") + unless (interval_to_seconds( $window )); + + my $circ = action::circulation->table; + my $cp = asset::copy->table; + + my $sql = <<" SQL"; + UPDATE $cp + SET status = 0 + WHERE id IN ( SELECT cp.id + FROM $cp cp + JOIN $circ circ ON (circ.target_copy = cp.id) + WHERE circ.checkin_time IS NOT NULL + AND circ.checkin_time < NOW() - CAST(? AS INTERVAL) + AND cp.status = 7 ) + SQL + + my $sth = action::circulation->db_Main->prepare_cached($sql); + $sth->execute($window); + + return $sth->rows; + +} +__PACKAGE__->register_method( + api_name => 'open-ils.storage.action.circulation.reshelving.complete', + api_level => 1, + stream => 1, + argc => 1, + method => 'complete_reshelving', +); + sub grab_overdue { my $self = shift; my $client = shift; -- 2.43.2