LP#1329503 avoid run now + later combined schedule
authorBill Erickson <berick@esilibrary.com>
Fri, 8 Aug 2014 00:39:47 +0000 (20:39 -0400)
committerBen Shum <bshum@biblio.org>
Fri, 8 Aug 2014 01:51:58 +0000 (21:51 -0400)
When editing a report, ensure only one of "now" vs. "schedule for later"
options is selected by default.  Similarly, if the schedule option is
activated by default, ensure the date fields are enabled.

If the run time of the most recent report is in the past, default to the
current date for the schedule instead of the no longer valid date.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/web/reports/oils_rpt_report_editor.js

index 5bc5e89..5db7a33 100644 (file)
@@ -125,11 +125,15 @@ oils_rpt_editor_pivot_data
             DOM.oils_rpt_param_editor_sched_email.value = run.email();
 
             if (run.run_time()) {
+                DOM.oils_rpt_report_editor_run_now.checked = false;
                 DOM.oils_rpt_report_editor_schedule.checked = true;
+                DOM.oils_rpt_param_editor_sched_start_date.disabled = false;
+                DOM.oils_rpt_param_editor_sched_start_hour.disabled = false;
+
                 if (new Date(Date.parse(run.run_time())) < new Date()) {
                     // editing a report with a past-tense run time
                     // clear the value so the user will have to edit
-                    DOM.oils_rpt_param_editor_sched_start_date.value = '';
+                    DOM.oils_rpt_param_editor_sched_start_date.value = mkYearMonDay();
                 } else {
                     DOM.oils_rpt_param_editor_sched_start_date.value = 
                         run.run_time().match(/(\d\d\d\d-\d\d-\d\d)/)[1]