[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. eec4e4cf061b916852ab01837a46485305d6cc0f

Evergreen Git git at git.evergreen-ils.org
Wed Jun 8 16:30:17 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_1 has been updated
       via  eec4e4cf061b916852ab01837a46485305d6cc0f (commit)
      from  5ce213dcb221fd7e776fdcf28a1afc45c7bf4a88 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit eec4e4cf061b916852ab01837a46485305d6cc0f
Author: Bill Erickson <berick at esilibrary.com>
Date:   Wed Jun 8 15:44:37 2011 -0400

    Extend hold shelf expire date beyond closed dates
    
    If the shelf_expire_time on a hold would land on a closed date for the
    pickup library, push the expire time out to just beyond the close date
    range, similar to the circulation due date overlap logic.
    
    In the current iteration, the time component of the date is pushed out
    to the end of the day (23:59:59).  If this is not generally the desired
    behavior, an org setting could be added to bypass this step so that the
    time matches "now" (i.e. capture time) instead.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
index 02eebd5..1479c1f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -2913,12 +2913,29 @@ sub put_hold_on_shelf {
     my $shelf_expire = $U->ou_ancestor_setting_value(
         $self->circ_lib, 'circ.holds.default_shelf_expire_interval', $self->editor);
 
-    if($shelf_expire) {
-        my $seconds = OpenSRF::Utils->interval_to_seconds($shelf_expire);
-        my $expire_time = DateTime->now->add(seconds => $seconds);
-        $hold->shelf_expire_time($expire_time->strftime('%FT%T%z'));
+    return undef unless $shelf_expire;
+
+    my $seconds = OpenSRF::Utils->interval_to_seconds($shelf_expire);
+    my $expire_time = DateTime->now->add(seconds => $seconds);
+
+    # if the shelf expire time overlaps with a pickup lib's 
+    # closed date, push it out to the first open date
+    my $dateinfo = $U->storagereq(
+        'open-ils.storage.actor.org_unit.closed_date.overlap', 
+        $hold->pickup_lib, $expire_time);
+
+    if($dateinfo) {
+        my $dt_parser = DateTime::Format::ISO8601->new;
+        $expire_time = $dt_parser->parse_datetime(cleanse_ISO8601($dateinfo->{end}));
+
+        # TODO: enable/disable time bump via setting?
+        $expire_time->set(hour => '23', minute => '59', second => '59');
+
+        $logger->info("circulator: shelf_expire_time overlaps".
+            " with closed date, pushing expire time to $expire_time");
     }
 
+    $hold->shelf_expire_time($expire_time->strftime('%FT%T%z'));
     return undef;
 }
 

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/Application/Circ/Circulate.pm      |   25 ++++++++++++++++---
 1 files changed, 21 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list