[open-ils-commits] [GIT] Evergreen ILS branch master updated. 11c9d08d61d0d8fa9a4d68c42367e398b930e2d5

Evergreen Git git at git.evergreen-ils.org
Wed Dec 14 15:25:14 EST 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, master has been updated
       via  11c9d08d61d0d8fa9a4d68c42367e398b930e2d5 (commit)
      from  fb2229781b11f34508713a6cd36162aa85654b93 (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 11c9d08d61d0d8fa9a4d68c42367e398b930e2d5
Author: Bill Erickson <berick at esilibrary.com>
Date:   Wed Dec 14 13:36:05 2011 -0500

    Process still-shelved, canceled holds in clear-shelf process
    
    Holds that are canceled but still physically on the hold shelf are
    processed like other holds during the clear-shelf process.  They will be
    grouped in the same manner and if a custom post-clear status is
    configured, copies linked to already-canceled holds will get the custom
    status.  The only difference is already-canceled holds will not be
    re-canceled during the clear-shelf process.
    
    This change has the added benefit of leveraging another API call to
    retrieve the shelf-expired holds instead of using its own custom
    json-query.
    
    See https://bugs.launchpad.net/evergreen/+bug/904332
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index 0a6bdfc..2004ceb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -3283,23 +3283,15 @@ sub clear_shelf_process {
 
     my $copy_status = $U->ou_ancestor_setting_value($org_id, 'circ.holds.clear_shelf.copy_status');
 
-    # Find holds on the shelf that have been there too long
-    my $hold_ids = $e->search_action_hold_request(
-        {   shelf_expire_time => {'<' => 'now'},
-            pickup_lib        => $org_id,
-            cancel_time       => undef,
-            fulfillment_time  => undef,
-            shelf_time        => {'!=' => undef},
-            capture_time      => {'!=' => undef},
-            current_copy      => $current_copy,
-        },
-        { idlist => 1 }
-    );
+    my @hold_ids = $self->method_lookup(
+        "open-ils.circ.captured_holds.id_list.expired_on_shelf.retrieve"
+    )->run($auth, $org_id);
 
     my @holds;
+    my @canceled_holds; # newly canceled holds
     my $chunk_size = 25; # chunked status updates
     my $counter = 0;
-    for my $hold_id (@$hold_ids) {
+    for my $hold_id (@hold_ids) {
 
         $logger->info("Clear shelf processing hold $hold_id");
         
@@ -3310,10 +3302,13 @@ sub clear_shelf_process {
             }
         ]);
 
-        $hold->cancel_time('now');
-        $hold->cancel_cause(2); # Hold Shelf expiration
-        $e->update_action_hold_request($hold) or return $e->die_event;
-        delete_hold_copy_maps($self, $e, $hold->id) and return $e->die_event;
+        if (!$hold->cancel_time) { # may be canceled but still on the holds shelf
+            $hold->cancel_time('now');
+            $hold->cancel_cause(2); # Hold Shelf expiration
+            $e->update_action_hold_request($hold) or return $e->die_event;
+            delete_hold_copy_maps($self, $e, $hold->id) and return $e->die_event;
+            push(@canceled_holds, $hold_id);
+        }
 
         my $copy = $hold->current_copy;
 
@@ -3369,7 +3364,7 @@ sub clear_shelf_process {
         # refetch the holds to pick up the caclulated cancel_time, 
         # which may be needed by Action/Trigger
         $e->xact_begin;
-        my $updated_holds = $e->search_action_hold_request({id => $hold_ids}, {substream => 1});
+        my $updated_holds = $e->search_action_hold_request({id => \@canceled_holds}, {substream => 1});
         $e->rollback;
 
         $U->create_events_for_hook(

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |   31 ++++++++-----------
 1 files changed, 13 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list