From abc6b44e7351219e890a3619dec78165493df090 Mon Sep 17 00:00:00 2001 From: Llewellyn Marshall Date: Wed, 17 Jun 2020 16:43:05 -0400 Subject: [PATCH] added template export module (cherry picked from commit 7cc07bad7b5d258e5dd8462eee39049d1a8484ef) --- .../src/perlmods/lib/OpenILS/Application/Reporter.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm index 81964ab3e1..b4182d78f5 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm @@ -246,6 +246,23 @@ sub retrieve_template { return $t; } +__PACKAGE__->register_method( + api_name => 'open-ils.reporter.template.export', + method => 'sql_export'); +sub sql_export { + my( $self, $conn, $auth, $id ) = @_; + my $e = new_rstore_editor(authtoken=>$auth); + return $e->die_event unless $e->checkauth; + return $e->die_event unless $e->allowed('RUN_REPORTS'); + my $b = OpenILS::Reporter::SQLBuilder->new; + my $t = $e->retrieve_reporter_template($id) + or return $e->event; + # where are the params going to come from? + # my $report_data = OpenSRF::Utils::JSON->JSON2perl( $t->{report}->{data} ); + # $b->register_params( $report_data ); + $rs = $b->parse_report( OpenSRF::Utils::JSON->JSON2perl( $t->{data} ) ); + return $rs->toSQL; +} __PACKAGE__->register_method( api_name => 'open-ils.reporter.report.retrieve', @@ -616,8 +633,6 @@ sub has_output { return 0; } - - __PACKAGE__->register_method( method => 'org_full_path', api_name => 'open-ils.reporter.org_unit.full_path'); -- 2.11.0