1 package OpenILS::Application::Trigger::Reactor::ContainerCSV;
2 use base "OpenILS::Application::Trigger::Reactor";
5 use OpenSRF::Utils::Logger qw/:logger/;
7 $Data::Dumper::Indent = 0;
8 my $U = "OpenILS::Application::AppUtils";
13 The ContainerCSV Reactor Module processes the configured template after
14 fetching the items from the bookbag refererred to in $env->{target}
15 by using the search api with the query in $env->{params}{search}. It's
16 the event-creator's responsibility to build a correct search query and check
17 permissions and do that sort of thing.
19 open-ils.trigger is not a public service, so that should be ok.
21 The output, like all processed templates, is stored in the event_output table.
27 my ($self, $env) = @_;
29 # get items for bookbags (bib containers of btype bookbag)
30 if ($env->{user_data}{item_search}) {
31 # Since the search is by default limited to 10, let's bump the limit
32 # to 1,000 just for giggles. This oughta be a setting, either YAOUS
34 my $args = {limit => 1000};
36 # use the search api for bib container items. fetch record IDs only.
37 my $items = $U->bib_container_items_via_search(
38 $env->{target}->id, $env->{user_data}{item_search}, $args, 1
39 ) or return 0; # TODO build error output for db?
41 $env->{items} = $items;
43 # XXX TODO If we're going to support other types of containers here,
44 # we'll probably just want to flesh those containers' items directly,
45 # not involve the search API.
47 $logger->warn("ContainerCSV reactor used without item_search, doesn't know what to do."); # XXX
50 return 1 if $self->run_TT($env);