From: Llewellyn Marshall Date: Wed, 17 Jun 2020 20:43:05 +0000 (-0400) Subject: added template export module X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=abc6b44e7351219e890a3619dec78165493df090;p=working%2FEvergreen.git added template export module (cherry picked from commit 7cc07bad7b5d258e5dd8462eee39049d1a8484ef) --- 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');