reports can now be rescheduled and disabled
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Dec 2005 22:44:34 +0000 (22:44 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Dec 2005 22:44:34 +0000 (22:44 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2540 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/reporter/clark-kent.pl
Open-ILS/src/reporter/config.sql
Open-ILS/src/reporter/templates/dashboard.ttk
Open-ILS/src/reporter/templates/stage3.ttk

index 77bf3b4..fb55b11 100755 (executable)
@@ -61,6 +61,7 @@ INSERT INTO reporter.output ( stage3, state )
        SELECT  id, 'wait'
          FROM  reporter.stage3 
          WHERE runtime <= $1
+               AND NOT disable
                AND (   (       recurrence = '0 seconds'::INTERVAL
                                AND (
                                        id NOT IN ( SELECT stage3 FROM reporter.output )
index 373cb8f..dabff18 100644 (file)
@@ -52,6 +52,8 @@ CREATE TABLE reporter.stage3 (
                                                                initially deferred,
        params          text                            not null,
        owner           int                             not null,
+       disable         bool                            not null
+                                                       default false,
        pub             bool                            not null
                                                        default false,
        create_date     timestamp with time zone        not null
index 9c0a02b..6cc2233 100644 (file)
@@ -183,12 +183,18 @@ BLOCK show_reports;
                        
                        WRAPPER html/row;
                                p = utils.JSON2perl( report.params );
+
+                               rtime = report.runtime.chunk(19).0;
+                               IF report.disable;
+                                       rtime = rtime _ '<br/>(Disabled)';
+                               END;
+
                                INCLUDE html/cell content=(report.pub ? 'Y' : 'N') col=bg style='border:solid gray 1px;' align='center';
                                INCLUDE html/cell content=link(content=p.reportname,href="stage3?id=$rid") col=bg style='border:solid gray 1px;';
                                INCLUDE html/cell nowrap='nowrap' content=report.create_date.chunk(19).0 col=bg style='border:solid gray 1px;';
                                INCLUDE html/cell
                                        nowrap='nowrap'
-                                       content=report.runtime.chunk(19).0
+                                       content=rtime
                                        col=bg
                                        style='border:solid gray 1px;';
                                INCLUDE html/cell content=run_count.get.count col=bg style='border:solid gray 1px;';
index f9193ac..26d9f57 100644 (file)
@@ -37,6 +37,12 @@ WRAPPER html/html;
    WRAPPER html/body;
       IF CGI.param('action') == 'Schedule';
          PROCESS schedule_stage3;
+      ELSIF CGI.param('action') == 'enable_stage3';
+         PROCESS enable;
+      ELSIF CGI.param('action') == 'disable_stage3';
+         PROCESS disable;
+      ELSIF CGI.param('action') == 'Reschedule';
+         PROCESS resched;
       ELSIF CGI.param('action') == 'Save';
          PROCESS save_stage3;
       ELSIF CGI.param('action') == 'delete_stage3';
@@ -212,6 +218,24 @@ BLOCK delete_output;
        INCLUDE view_stage3;
 END;
 
+BLOCK enable;
+       q = DBI.prepare( 'UPDATE reporter.stage3 SET disable = FALSE WHERE id = ?' );
+       CALL q.execute(CGI.param('id'));
+       INCLUDE view_stage3;
+END;
+
+BLOCK disable;
+       q = DBI.prepare( 'UPDATE reporter.stage3 SET disable = TRUE WHERE id = ?' );
+       CALL q.execute(CGI.param('id'));
+       INCLUDE view_stage3;
+END;
+
+BLOCK resched;
+       q = DBI.prepare( 'UPDATE reporter.stage3 SET runtime = ? WHERE id = ?' );
+       CALL q.execute(CGI.param('newtime'), CGI.param('id'));
+       INCLUDE view_stage3;
+END;
+
 BLOCK rerun;
        q = DBI.prepare( 'UPDATE reporter.stage3 SET rerun = TRUE WHERE id = ?' );
        CALL q.execute(rpt.id);
@@ -236,11 +260,21 @@ BLOCK view_stage3;
                        END;
                        WRAPPER html/row;
                                INCLUDE html/cell content="<b>Creation Time</b>" style="border:solid gray 1px;";
-                               INCLUDE html/cell content=rpt.create_date style="border:solid gray 1px;";
+                               INCLUDE html/cell content=rpt.create_date.chunk(19).0 style="border:solid gray 1px;";
                        END;
                        WRAPPER html/row;
                                INCLUDE html/cell content="<b>Scheduled Run Time</b>" style="border:solid gray 1px;";
-                               INCLUDE html/cell content=rpt.runtime style="border:solid gray 1px;";
+                               IF user.id == rpt.owner;
+                                       WRAPPER html/cell style="border:solid gray 1px;";
+                                               WRAPPER form method="post";
+                                                       INCLUDE hidden name="id" value=rpt.id;
+                                                       INCLUDE text name="newtime" value=rpt.runtime.chunk(19).0;
+                                                       INCLUDE submit name="action" value="Reschedule";
+                                               END;
+                                       END;
+                               ELSE;
+                                       INCLUDE html/cell content=rpt.runtime style="border:solid gray 1px;";
+                               END;
                        END;
                        WRAPPER html/row;
                                INCLUDE html/cell content="<b>Recurrence Interval</b>" style="border:solid gray 1px;";
@@ -254,6 +288,12 @@ BLOCK view_stage3;
                                        IF user.id == rpt.owner;
                                                INCLUDE anchor content='Run again' href=CGI.url('-path', 1) _ '?action=rerun&id=' _ rpt.id;
                                                '&nbsp;&nbsp;&nbsp;';
+                                               IF rpt.disable;
+                                                       INCLUDE anchor content='Enable' href=CGI.url('-path', 1) _ '?action=enable_stage3&id=' _ rpt.id;
+                                               ELSE;
+                                                       INCLUDE anchor content='Disable' href=CGI.url('-path', 1) _ '?action=disable_stage3&id=' _ rpt.id;
+                                               END;
+                                               '&nbsp;&nbsp;&nbsp;';
                                                INCLUDE anchor content='Delete' href=CGI.url('-path', 1) _ '?action=delete_stage3&id=' _ rpt.id;
                                                '&nbsp;&nbsp;&nbsp;';
                                        END;