From: Bill Erickson Date: Thu, 19 Jun 2014 19:45:25 +0000 (-0400) Subject: LP#1329503 Reporter report.fleshed.retrieve API X-Git-Tag: sprint4-merge-nov22~1970 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f8296e924a84555e5beba6bcab1eeabb92ddad8c;p=working%2FEvergreen.git LP#1329503 Reporter report.fleshed.retrieve API API for fetching fleshed reports, including the most recent reporter.schedule. Useful for modifying existing reports. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier Signed-off-by: Ben Shum --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm index c0d754aef9..897fb224ae 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm @@ -259,6 +259,43 @@ sub retrieve_report { return $r; } +__PACKAGE__->register_method( + api_name => 'open-ils.reporter.report.fleshed.retrieve', + method => 'retrieve_fleshed_report', + signature => { + desc => q/Returns report, fleshed with template, template.owner + and schedules. Fleshes report.runs() as a single-item array + containing the most recently created reporter.schedule./ + } +); +sub retrieve_fleshed_report { + my( $self, $conn, $auth, $id, $options ) = @_; + $options ||= {}; + + my $e = new_rstore_editor(authtoken=>$auth); + return $e->event unless $e->checkauth; + return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']); + my $r = $e->retrieve_reporter_report([ + $id, { + flesh => 2, + flesh_fields => { + rr => ['template'], + rt => ['owner'] + } + }]) or return $e->event; + + my $output = $e->search_reporter_schedule([ + {report => $id}, + {limit => 1, order_by => {rs => 'run_time DESC'}} + ]); + + $r->runs($output); + + return $r; +} + + + __PACKAGE__->register_method( api_name => 'open-ils.reporter.template.update',