return $U->fire_object_event($event_def, undef, $circ, $e->requestor->ws_ou)
}
+
__PACKAGE__->register_method(
method => "fire_circ_events",
api_name => "open-ils.circ.fire_circ_trigger_events",
/
);
+__PACKAGE__->register_method(
+ method => "fire_circ_events",
+ api_name => "open-ils.circ.fire_hold_trigger_events",
+ signature => q/
+ General event def runner for hold objects. If no event def ID
+ is provided, the hook will be used to find the best event_def
+ match based on the context org unit
+ /
+);
+
+__PACKAGE__->register_method(
+ method => "fire_circ_events",
+ api_name => "open-ils.circ.fire_user_trigger_events",
+ signature => q/
+ General event def runner for user objects. If no event def ID
+ is provided, the hook will be used to find the best event_def
+ match based on the context org unit
+ /
+);
+
+
sub fire_circ_events {
- my($self, $conn, $auth, $org_id, $event_def, $hook, $granularity, $circ_ids, $user_data) = @_;
+ my($self, $conn, $auth, $org_id, $event_def, $hook, $granularity, $target_ids, $user_data) = @_;
my $e = new_editor(authtoken => $auth);
return $e->event unless $e->checkauth;
- return $e->event unless $e->allowed('VIEW_CIRCULATIONS', $org_id);
- my $circs = $e->batch_retrieve_action_circulation($circ_ids);
- return undef unless @$circs;
- return $U->fire_object_event($event_def, $hook, $circs, $org_id, $granularity, $user_data)
+ my $targets;
+
+ if($self->api_name =~ /hold/) {
+ return $e->event unless $e->allowed('VIEW_HOLD', $org_id);
+ $targets = $e->batch_retrieve_action_hold_request($target_ids);
+ } elsif($self->api_name =~ /user/) {
+ return $e->event unless $e->allowed('VIEW_USER', $org_id);
+ $targets = $e->batch_retrieve_actor_user($target_ids);
+ } else {
+ return $e->event unless $e->allowed('VIEW_CIRCULATIONS', $org_id);
+ $targets = $e->batch_retrieve_action_circulation($target_ids);
+ }
+
+ return undef unless @$targets;
+ return $U->fire_object_event($event_def, $hook, $targets, $org_id, $granularity, $user_data)
}
__PACKAGE__->register_method(