Re-fetch hold for cancel notify to correct timestamp
authorBill Erickson <berick@esilibrary.com>
Tue, 18 Oct 2011 16:07:46 +0000 (12:07 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 18 Oct 2011 16:15:25 +0000 (12:15 -0400)
Re-fetch the cancelled hold from the DB before passing it off to
action/trigger for notification processing.  Otherwise, A/T attempts to
perform date math on "now" instead of a valid timestamp and subsequently
croaks.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index 584b4c7..e3ec8b7 100644 (file)
@@ -760,6 +760,11 @@ sub cancel_hold {
 
        $e->commit;
 
+    # re-fetch the hold to pick up the real cancel_time (not "now") for A/T
+    $e->xact_begin;
+    $hold = $e->retrieve_action_hold_request($hold->id) or return $e->die_event;
+    $e->rollback;
+
     $U->create_events_for_hook('hold_request.cancel.staff', $hold, $hold->pickup_lib)
         if $e->requestor->id != $hold->usr;