added method to check on an existing report with the given name in the given folder
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Jun 2007 21:49:29 +0000 (21:49 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Jun 2007 21:49:29 +0000 (21:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@7438 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Reporter.pm

index 43eb35e..915c35d 100644 (file)
@@ -32,6 +32,28 @@ sub create_folder {
 
 
 __PACKAGE__->register_method(
+    api_name => 'open-ils.reporter.report.exists',
+    method => 'report_exists',
+    notes => q/
+        Returns 1 if a report with the given name and folder already exists.
+    /
+);
+
+sub report_exists {
+    my( $self, $conn, $auth, $report ) = @_;
+
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('RUN_REPORTS');
+
+    my $existing = $e->search_reporter_report(
+        {folder=>$report->folder, name=>$report->name});
+    return 1 if @$existing;
+    return 0;
+}
+
+
+__PACKAGE__->register_method(
        api_name => 'open-ils.reporter.folder.visible.retrieve',
        method => 'retrieve_visible_folders'
 );