added support for setting hold expire time using an interval defined in the org unit...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 19 Jun 2008 15:57:08 +0000 (15:57 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 19 Jun 2008 15:57:08 +0000 (15:57 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9876 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index 97bf16f..f02962c 100644 (file)
@@ -18,10 +18,12 @@ package OpenILS::Application::Circ::Holds;
 use base qw/OpenILS::Application/;
 use strict; use warnings;
 use OpenILS::Application::AppUtils;
+use DateTime;
 use Data::Dumper;
 use OpenSRF::EX qw(:try);
 use OpenILS::Perm;
 use OpenILS::Event;
+use OpenSRF::Utils;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenILS::Utils::CStoreEditor q/:funcs/;
 use OpenILS::Utils::PermitHold;
@@ -34,6 +36,7 @@ my $U = $apputils;
 
 
 
+
 __PACKAGE__->register_method(
        method  => "create_hold",
        api_name        => "open-ils.circ.holds.create",
@@ -138,6 +141,13 @@ sub create_hold {
                        }
                }
 
+        # set the configured expire time
+        my $interval = $U->ou_ancestor_setting_value($recipient->home_ou, OILS_SETTING_HOLD_EXPIRE);
+        if($interval) {
+            my $date = DateTime->now->add(seconds => OpenSRF::Utils::interval_to_seconds($interval));
+            $hold->expire_time($U->epoch2ISO8601($date->epoch));
+        }
+
                $hold->requestor($e->requestor->id); 
                $hold->request_lib($e->requestor->ws_ou);
                $hold->selection_ou($hold->pickup_lib) unless $hold->selection_ou;