my $circs = $e->search_action_circulation({ id => $circlist });
return $e->event if $e->event;
+ my $hook = 'circ.checkout.batch_notify';
+ $hook .= '.session' if $self->api_name =~ /session/;
+
for my $circ (@$circs) {
- return undef if $circ->usr != $patronid;
+ # WISHLIST: This may become more sophisticated and check "friend" permissions
+ # in the future, at lease in the non-session variant.
+ return OpenILS::Event->new('PATRON_CIRC_MISMATCH') if $circ->usr != $patronid;
return $e->event unless $e->allowed('VIEW_CIRCULATIONS', $circ->circ_lib);
}
- my $hook = 'circ.checkout.batch_notify';
- $hook .= '.session' if $self->api_name =~ /session/;
-
-
my %events;
my $multi = OpenSRF::MultiSession->new(
app => 'open-ils.trigger',
- cap => 3, #
+ cap => 3,
success_handler => sub {
my $self = shift;
my $req = shift;
$multi->session_wait(1);
$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+ if (!keys(%events)) {
+ return $client->respond_complete;
+ }
+
my @out;
$multi = OpenSRF::MultiSession->new(
app => 'open-ils.trigger',
- cap => 3, #
+ cap => 3,
success_handler => sub {
my $self = shift;
my $req = shift;
) for ( sort keys %events );
$multi->session_wait(1);
- $client->respond_complete;
+ return $client->respond_complete;
}
__PACKAGE__->register_method(
- method => 'circ_batch_notify',
+ method => 'circ_batch_notify',
api_name => 'open-ils.circ.checkout.batch_notify',
+ stream => 1,
+ signature => {
+ desc => 'Creates and fires grouped events for a set of circulation IDs',
+ params => [
+ { name => 'authtoken', desc => 'Staff auth token', type => 'string' },
+ { name => 'patronid', desc => 'actor.usr.id of patron which must own the circulations', type => 'number' }
+ { name => 'circlist', desc => 'Arrayref of circulation IDs to bundle into the event group', type => 'array' }
+ ],
+ return => {
+ desc => 'Event on error, stream of zero or more event group firing results '.
+ 'otherwise. See: open-ils.trigger.event_group.fire'
+ }
+ }
);
__PACKAGE__->register_method(
- method => 'circ_batch_notify',
+ method => 'circ_batch_notify',
api_name => 'open-ils.circ.checkout.batch_notify.session',
+ stream => 1,
+ signature => {
+ desc => 'Creates and fires grouped events for a set of circulation IDs. '.
+ 'For use by session-specific actions such as self-checkout or circ desk checkout.',
+ params => [
+ { name => 'authtoken', desc => 'Staff auth token', type => 'string' },
+ { name => 'patronid', desc => 'actor.usr.id of patron which must own the circulations', type => 'number' }
+ { name => 'circlist', desc => 'Arrayref of circulation IDs to bundle into the event group', type => 'array' }
+ ],
+ return => {
+ desc => 'Event on error, stream of zero or more event group firing results '.
+ 'otherwise. See: open-ils.trigger.event_group.fire'
+ }
+ }
);
1;