Clear shelf canceled holds notification fix
authorBill Erickson <berick@esilibrary.com>
Mon, 24 Oct 2011 20:27:29 +0000 (16:27 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 15 Nov 2011 17:07:24 +0000 (12:07 -0500)
After cancelling a batch of holds via the clear-shelf process, before we
send the holds off to action/trigger for potential notification
generation, re-fetch the holds from the DB to pick up the calculated
cancel_time value (i.e. get a real value for "now").  Otherwise, A/T may
die attempting to create a DateTime object by parsing "now".

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index 3719afc..ad5e9ad 100644 (file)
@@ -3347,10 +3347,18 @@ sub clear_shelf_process {
         # tell the client we're done
         $client->respond_complete({cache_key => $cache_key});
 
+        # ------------
         # fire off the hold cancelation trigger and wait for response so don't flood the service
+
+        # 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});
+        $e->rollback;
+
         $U->create_events_for_hook(
             'hold_request.cancel.expire_holds_shelf', 
-            $_, $org_id, undef, undef, 1) for @holds;
+            $_, $org_id, undef, undef, 1) for @$updated_holds;
 
     } else {
         # tell the client we're done