Create events for hold_request.cancel.patron
authorBill Erickson <berick@esilibrary.com>
Thu, 15 Sep 2011 17:38:17 +0000 (13:38 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 18 Oct 2011 17:27:42 +0000 (13:27 -0400)
When a patron cancels his/her own hold, create events for the
(already-existing) hold_request.cancel.patron A/T hook.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index e3ec8b7..60563f3 100644 (file)
@@ -765,8 +765,11 @@ sub cancel_hold {
     $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;
+    if ($e->requestor->id == $hold->usr) {
+        $U->create_events_for_hook('hold_request.cancel.patron', $hold, $hold->pickup_lib)
+    } else {
+        $U->create_events_for_hook('hold_request.cancel.staff', $hold, $hold->pickup_lib)
+    }
 
        return 1;
 }