public function preProcess() {
parent::preProcess();
+ $this->setContext();
CRM_Utils_System::setTitle(ts('Manage - Scheduled Jobs'));
$this->add('select', 'run_frequency', ts('Run frequency'), CRM_Core_SelectValues::getJobFrequency());
// CRM-17686
- $this->add('datepicker', 'scheduled_run_date', ts('Scheduled Run Date'), NULL, FALSE, ['minDate' => time()]);
+ $this->add('datepicker', 'scheduled_run_date', ts('Scheduled Run Date'), NULL, FALSE, ['minDate' => date('Y-m-d')]);
$this->add('textarea', 'parameters', ts('Command parameters'),
"cols=50 rows=6"
$jm->executeJobById($this->_id);
$jobName = self::getJobName($this->_id);
CRM_Core_Session::setStatus(ts('%1 Scheduled Job has been executed. See the log for details.', [1 => $jobName]), ts("Executed"), "success");
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/job', 'reset=1'));
+
+ if ($this->getContext() === 'joblog') {
+ // If we were triggered via the joblog form redirect back there when we finish
+ $redirectUrl = CRM_Utils_System::url('civicrm/admin/joblog', 'reset=1&jid=' . $this->_id);
+ }
+ else {
+ $redirectUrl = CRM_Utils_System::url('civicrm/admin/job', 'reset=1');
+ }
+ CRM_Utils_System::redirect($redirectUrl);
return;
}