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>
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]