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 # use the search api for bib container items
32 my $items = $U->bib_container_items_via_search(
33 $env->{target}->id, $env->{user_data}{item_search}
34 ) or return 0; # TODO build error output for db?
36 $env->{items} = $items;
38 # XXX TODO If we're going to support other types of containers here,
39 # we'll probably just want to flesh those containers' items directly,
40 # not involve the search API.
42 $logger->warn("ContainerCSV reactor used without item_search, doesn't know what to do."); # XXX
45 return 1 if $self->run_TT($env);